From: Aryeh Gregor Date: Fri, 25 Jul 2008 20:16:24 +0000 (+0000) Subject: Move more initialization to member variable defaults. (The Title constructor now... X-Git-Tag: 1.31.0-rc.0~46364 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=783010c62f23016113e4251eedcec38996cddd72;p=lhc%2Fweb%2Fwiklou.git Move more initialization to member variable defaults. (The Title constructor now actually does nothing, but I left it for the comment.) --- diff --git a/includes/Article.php b/includes/Article.php index ef1cf86751..ad45b44e2d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -16,27 +16,30 @@ class Article { /**@{{ * @private */ - var $mComment; //!< - var $mContent; //!< - var $mContentLoaded; //!< - var $mCounter; //!< - var $mForUpdate; //!< - var $mGoodAdjustment; //!< - var $mLatest; //!< - var $mMinorEdit; //!< - var $mOldId; //!< - var $mRedirectedFrom; //!< - var $mRedirectUrl; //!< - var $mRevIdFetched; //!< - var $mRevision; //!< - var $mTimestamp; //!< - var $mTitle; //!< - var $mTotalAdjustment; //!< - var $mTouched; //!< - var $mUser; //!< - var $mUserText; //!< - var $mRedirectTarget; //!< - var $mIsRedirect; + var $mComment = ''; //!< + var $mContent; //!< + var $mContentLoaded = false; //!< + var $mCounter = -1; //!< Not loaded + var $mCurID = -1; //!< Not loaded + var $mDataLoaded = false; //!< + var $mForUpdate = false; //!< + var $mGoodAdjustment = 0; //!< + var $mIsRedirect = false; //!< + var $mLatest = false; //!< + var $mMinorEdit; //!< + var $mOldId; //!< + var $mPreparedEdit = false; //!< Title object if set + var $mRedirectedFrom = null; //!< Title object if set + var $mRedirectTarget = null; //!< Title object if set + var $mRedirectUrl = false; //!< + var $mRevIdFetched = 0; //!< + var $mRevision; //!< + var $mTimestamp = ''; //!< + var $mTitle; //!< + var $mTotalAdjustment = 0; //!< + var $mTouched = '19700101000000'; //!< + var $mUser = -1; //!< Not loaded + var $mUserText = ''; //!< /**@}}*/ /** @@ -47,7 +50,6 @@ class Article { function __construct( Title $title, $oldId = null ) { $this->mTitle =& $title; $this->mOldId = $oldId; - $this->clear(); } /** diff --git a/includes/Title.php b/includes/Title.php index ad425c5e41..71a601c229 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -44,27 +44,30 @@ class Title { * @private */ - var $mTextform; # Text form (spaces not underscores) of the main part - var $mUrlform; # URL-encoded form of the main part - var $mDbkeyform; # Main part with underscores - var $mUserCaseDBKey; # DB key with the initial letter in the case specified by the user - var $mNamespace; # Namespace index, i.e. one of the NS_xxxx constants - var $mInterwiki; # Interwiki prefix (or null string) - var $mFragment; # Title fragment (i.e. the bit after the #) - var $mArticleID; # Article ID, fetched from the link cache on demand - var $mLatestID; # ID of most recent revision - var $mRestrictions; # Array of groups allowed to edit this article - var $mCascadeRestriction; # Cascade restrictions on this page to included templates and images? - var $mRestrictionsExpiry; # When do the restrictions on this page expire? - var $mHasCascadingRestrictions; # Are cascading restrictions in effect on this page? - var $mCascadeRestrictionSources;# Where are the cascading restrictions coming from on this page? - var $mRestrictionsLoaded; # Boolean for initialisation on demand - var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand - var $mDefaultNamespace; # Namespace index when there is no namespace - # Zero except in {{transclusion}} tags - var $mWatched; # Is $wgUser watching this page? NULL if unfilled, accessed through userIsWatching() - var $mLength; # The page length, 0 for special pages - var $mRedirect; # Is the article at this title a redirect? + var $mTextform = ''; # Text form (spaces not underscores) of the main part + var $mUrlform = ''; # URL-encoded form of the main part + var $mDbkeyform = ''; # Main part with underscores + var $mUserCaseDBKey; # DB key with the initial letter in the case specified by the user + var $mNamespace = NS_MAIN; # Namespace index, i.e. one of the NS_xxxx constants + var $mInterwiki = ''; # Interwiki prefix (or null string) + var $mFragment; # Title fragment (i.e. the bit after the #) + var $mArticleID = -1; # Article ID, fetched from the link cache on demand + var $mLatestID = false; # ID of most recent revision + var $mRestrictions = array(); # Array of groups allowed to edit this article + var $mOldRestrictions = false; + var $mCascadeRestriction; # Cascade restrictions on this page to included templates and images? + var $mRestrictionsExpiry; # When do the restrictions on this page expire? + var $mHasCascadingRestrictions; # Are cascading restrictions in effect on this page? + var $mCascadeRestrictionSources; # Where are the cascading restrictions coming from on this page? + var $mRestrictionsLoaded = false; # Boolean for initialisation on demand + var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand + # Don't change the following default, NS_MAIN is hardcoded in several + # places. See bug 696. + var $mDefaultNamespace = NS_MAIN; # Namespace index when there is no namespace + # Zero except in {{transclusion}} tags + var $mWatched = null; # Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() + var $mLength = -1; # The page length, 0 for special pages + var $mRedirect = null; # Is the article at this title a redirect? /**#@-*/ @@ -72,22 +75,7 @@ class Title { * Constructor * @private */ - /* private */ function __construct() { - $this->mInterwiki = $this->mUrlform = - $this->mTextform = $this->mDbkeyform = ''; - $this->mArticleID = -1; - $this->mNamespace = NS_MAIN; - $this->mRestrictionsLoaded = false; - $this->mRestrictions = array(); - # Dont change the following, NS_MAIN is hardcoded in several place - # See bug #696 - $this->mDefaultNamespace = NS_MAIN; - $this->mWatched = NULL; - $this->mLatestID = false; - $this->mOldRestrictions = false; - $this->mLength = -1; - $this->mRedirect = NULL; - } + /* private */ function __construct() {} /** * Create a new Title from a prefixed DB key