From 8fdf96fbb888dc0d5ea53bad16256b168f7e4cde Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 21 Mar 2004 06:58:12 +0000 Subject: [PATCH] fixed error handling broken since 1.96 --- includes/Article.php | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 435c19640d..0467539564 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -121,8 +121,21 @@ class Article { if ( $this->mContentLoaded ) return; $fname = "Article::loadContent"; - $success = true; + # Pre-fill content with error message so that if something + # fails we'll have something telling us what we intended. + + $t = $this->mTitle->getPrefixedText(); + if ( isset( $oldid ) ) { + $oldid = IntVal( $oldid ); + $t .= ",oldid={$oldid}"; + } + if ( isset( $redirect ) ) { + $redirect = ($redirect == "no") ? "no" : "yes"; + $t .= ",redirect={$redirect}"; + } + $this->mContent = wfMsg( "missingarticle", $t ); + if ( ! $oldid ) { # Retrieve current version $id = $this->getID(); if ( 0 == $id ) return; @@ -194,22 +207,6 @@ class Article { $this->mTimestamp = $s->old_timestamp; wfFreeResult( $res ); } - - # Return error message :P - # Horrible, confusing UI and data. I think this should return false on error -- TS - if ( !$success ) { - $t = $this->mTitle->getPrefixedText(); - if ( isset( $oldid ) ) { - $oldid = IntVal( $oldid ); - $t .= ",oldid={$oldid}"; - } - if ( isset( $redirect ) ) { - $redirect = ($redirect == "no") ? "no" : "yes"; - $t .= ",redirect={$redirect}"; - } - $this->mContent = wfMsg( "missingarticle", $t ); - } - $this->mContentLoaded = true; } -- 2.20.1