r60046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60045‎ | r60046 | r60047 >
Date:20:37, 14 December 2009
Author:ialex
Status:ok
Tags:
Comment:
Whitespaces fixes:
* replaced tabs with spaces for Title members variables description so that it's the same for everybody
* removed trailing spaces
* removed/replaced tabs before spaces
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -44,32 +44,32 @@
4545 */
4646 //@{
4747
48 - var $mTextform = ''; ///< Text form (spaces not underscores) of the main part
49 - var $mUrlform = ''; ///< URL-encoded form of the main part
50 - var $mDbkeyform = ''; ///< Main part with underscores
 48+ var $mTextform = ''; ///< Text form (spaces not underscores) of the main part
 49+ var $mUrlform = ''; ///< URL-encoded form of the main part
 50+ var $mDbkeyform = ''; ///< Main part with underscores
5151 var $mUserCaseDBKey; ///< DB key with the initial letter in the case specified by the user
5252 var $mNamespace = NS_MAIN; ///< Namespace index, i.e. one of the NS_xxxx constants
53 - var $mInterwiki = ''; ///< Interwiki prefix (or null string)
54 - var $mFragment; ///< Title fragment (i.e. the bit after the #)
 53+ var $mInterwiki = ''; ///< Interwiki prefix (or null string)
 54+ var $mFragment; ///< Title fragment (i.e. the bit after the #)
5555 var $mArticleID = -1; ///< Article ID, fetched from the link cache on demand
5656 var $mLatestID = false; ///< ID of most recent revision
5757 var $mRestrictions = array(); ///< Array of groups allowed to edit this article
5858 var $mOldRestrictions = false;
59 - var $mCascadeRestriction; ///< Cascade restrictions on this page to included templates and images?
60 - var $mRestrictionsExpiry = array(); ///< When do the restrictions on this page expire?
61 - var $mHasCascadingRestrictions; ///< Are cascading restrictions in effect on this page?
62 - var $mCascadeSources; ///< Where are the cascading restrictions coming from on this page?
 59+ var $mCascadeRestriction; ///< Cascade restrictions on this page to included templates and images?
 60+ var $mRestrictionsExpiry = array(); ///< When do the restrictions on this page expire?
 61+ var $mHasCascadingRestrictions; ///< Are cascading restrictions in effect on this page?
 62+ var $mCascadeSources; ///< Where are the cascading restrictions coming from on this page?
6363 var $mRestrictionsLoaded = false; ///< Boolean for initialisation on demand
64 - var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand
 64+ var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand
6565 # Don't change the following default, NS_MAIN is hardcoded in several
6666 # places. See bug 696.
6767 var $mDefaultNamespace = NS_MAIN; ///< Namespace index when there is no namespace
68 - # Zero except in {{transclusion}} tags
69 - var $mWatched = null; ///< Is $wgUser watching this page? null if unfilled, accessed through userIsWatching()
 68+ # Zero except in {{transclusion}} tags
 69+ var $mWatched = null; ///< Is $wgUser watching this page? null if unfilled, accessed through userIsWatching()
7070 var $mLength = -1; ///< The page length, 0 for special pages
7171 var $mRedirect = null; ///< Is the article at this title a redirect?
7272 var $mNotificationTimestamp = array(); ///< Associative array of user ID -> timestamp/false
73 - var $mBacklinkCache = null; ///< Cache of links to this title
 73+ var $mBacklinkCache = null; ///< Cache of links to this title
7474 //@}
7575
7676
@@ -280,7 +280,7 @@
281281 } else {
282282 return null;
283283 }
284 - }
 284+ }
285285
286286 /**
287287 * Create a new Title for the Main Page
@@ -307,7 +307,7 @@
308308 public static function newFromRedirect( $text ) {
309309 return self::newFromRedirectInternal( $text );
310310 }
311 -
 311+
312312 /**
313313 * Extract a redirect destination from a string and return the
314314 * Title, or null if the text doesn't contain a valid redirect
@@ -321,7 +321,7 @@
322322 $titles = self::newFromRedirectArray( $text );
323323 return $titles ? array_pop( $titles ) : null;
324324 }
325 -
 325+
326326 /**
327327 * Extract a redirect destination from a string and return an
328328 * array of Titles, or null if the text doesn't contain a valid redirect
@@ -360,7 +360,7 @@
361361 }
362362 return $titles;
363363 }
364 -
 364+
365365 /**
366366 * Really extract the redirect destination
367367 * Do not call this function directly, use one of the newFromRedirect* functions above
@@ -404,14 +404,14 @@
405405 * Get the prefixed DB key associated with an ID
406406 * @param $id \type{\int} the page_id of the article
407407 * @return \type{Title} an object representing the article, or NULL
408 - * if no such article was found
 408+ * if no such article was found
409409 */
410410 public static function nameOf( $id ) {
411411 $dbr = wfGetDB( DB_SLAVE );
412412
413413 $s = $dbr->selectRow( 'page',
414414 array( 'page_namespace','page_title' ),
415 - array( 'page_id' => $id ),
 415+ array( 'page_id' => $id ),
416416 __METHOD__ );
417417 if ( $s === false ) { return null; }
418418
@@ -435,7 +435,7 @@
436436 * @param $ns \type{\int} a namespace index
437437 * @param $title \type{\string} text-form main part
438438 * @return \type{\string} a stripped-down title string ready for the
439 - * search index
 439+ * search index
440440 */
441441 public static function indexTitle( $ns, $title ) {
442442 global $wgContLang;
@@ -499,7 +499,7 @@
500500 public function isTrans() {
501501 if ($this->mInterwiki == '')
502502 return false;
503 -
 503+
504504 return Interwiki::fetch( $this->mInterwiki )->isTranscludable();
505505 }
506506
@@ -621,7 +621,7 @@
622622 /**
623623 * Get title for search index
624624 * @return \type{\string} a stripped-down title string ready for the
625 - * search index
 625+ * search index
626626 */
627627 public function getIndexTitle() {
628628 return Title::indexTitle( $this->mNamespace, $this->mTextform );
@@ -630,7 +630,7 @@
631631 /**
632632 * Get the prefixed database key form
633633 * @return \type{\string} the prefixed title, with underscores and
634 - * any interwiki and namespace prefixes
 634+ * any interwiki and namespace prefixes
635635 */
636636 public function getPrefixedDBkey() {
637637 $s = $this->prefix( $this->mDbkeyform );
@@ -656,7 +656,7 @@
657657 * Get the prefixed title with spaces, plus any fragment
658658 * (part beginning with '#')
659659 * @return \type{\string} the prefixed title, with spaces and
660 - * the fragment, including '#'
 660+ * the fragment, including '#'
661661 */
662662 public function getFullText() {
663663 $text = $this->getPrefixedText();
@@ -764,7 +764,7 @@
765765 * Get a URL with no fragment or server name. If this page is generated
766766 * with action=render, $wgServer is prepended.
767767 * @param mixed $query an optional query string; if not specified,
768 - * $wgArticlePath will be used. Can be specified as an associative array
 768+ * $wgArticlePath will be used. Can be specified as an associative array
769769 * as well, e.g., array( 'action' => 'edit' ) (keys and values will be
770770 * URL-escaped).
771771 * @param $variant \type{\string} language variant of url (for sr, zh..)
@@ -913,7 +913,7 @@
914914 /**
915915 * Get the edit URL for this Title
916916 * @return \type{\string} the URL, or a null string if this is an
917 - * interwiki link
 917+ * interwiki link
918918 */
919919 public function getEditURL() {
920920 if ( '' != $this->mInterwiki ) { return ''; }
@@ -970,7 +970,7 @@
971971 */
972972 public function isProtected( $action = '' ) {
973973 global $wgRestrictionLevels;
974 -
 974+
975975 $restrictionTypes = $this->getRestrictionTypes();
976976
977977 # Special pages have inherent protection
@@ -1021,7 +1021,7 @@
10221022 *
10231023 * @param $action \type{\string} action that permission needs to be checked for
10241024 * @return \type{\bool}
1025 - */
 1025+ */
10261026 public function quickUserCan( $action ) {
10271027 return $this->userCan( $action, false );
10281028 }
@@ -1048,7 +1048,7 @@
10491049 * @param $action \type{\string} action that permission needs to be checked for
10501050 * @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries.
10511051 * @return \type{\bool}
1052 - */
 1052+ */
10531053 public function userCan( $action, $doExpensiveQueries = true ) {
10541054 global $wgUser;
10551055 return ($this->getUserPermissionsErrorsInternal( $action, $wgUser, $doExpensiveQueries, true ) === array());
@@ -1128,15 +1128,15 @@
11291129
11301130 $intended = $user->mBlock->mAddress;
11311131
1132 - $errors[] = array( ($block->mAuto ? 'autoblockedtext' : 'blockedtext'), $link, $reason, $ip, $name,
 1132+ $errors[] = array( ($block->mAuto ? 'autoblockedtext' : 'blockedtext'), $link, $reason, $ip, $name,
11331133 $blockid, $blockExpiry, $intended, $blockTimestamp );
11341134 }
1135 -
 1135+
11361136 // Remove the errors being ignored.
1137 -
 1137+
11381138 foreach( $errors as $index => $error ) {
11391139 $error_key = is_array($error) ? $error[0] : $error;
1140 -
 1140+
11411141 if (in_array( $error_key, $ignoreErrors )) {
11421142 unset($errors[$index]);
11431143 }
@@ -1169,12 +1169,12 @@
11701170 // Show user page-specific message only if the user can move other pages
11711171 $errors[] = array( 'cant-move-user-page' );
11721172 }
1173 -
 1173+
11741174 // Check if user is allowed to move files if it's a file
11751175 if( $this->getNamespace() == NS_FILE && !$user->isAllowed( 'movefile' ) ) {
11761176 $errors[] = array( 'movenotallowedfile' );
11771177 }
1178 -
 1178+
11791179 if( !$user->isAllowed( 'move' ) ) {
11801180 // User can't move anything
11811181 global $wgGroupPermissions;
@@ -1211,14 +1211,14 @@
12121212 }
12131213 } elseif( !$user->isAllowed( $action ) ) {
12141214 $return = null;
1215 -
 1215+
12161216 // We avoid expensive display logic for quickUserCan's and such
1217 - $groups = false;
 1217+ $groups = false;
12181218 if (!$short) {
12191219 $groups = array_map( array( 'User', 'makeGroupLinkWiki' ),
12201220 User::getGroupsWithPermission( $action ) );
1221 - }
1222 -
 1221+ }
 1222+
12231223 if( $groups ) {
12241224 $return = array( 'badaccess-groups',
12251225 array( implode( ', ', $groups ), count( $groups ) ) );
@@ -1271,7 +1271,7 @@
12721272 wfProfileOut( __METHOD__ );
12731273 return $errors;
12741274 }
1275 -
 1275+
12761276 # Only 'createaccount' and 'execute' can be performed on
12771277 # special pages, which don't actually exist in the DB.
12781278 $specialOKActions = array( 'createaccount', 'execute' );
@@ -1289,7 +1289,7 @@
12901290
12911291 # Protect css/js subpages of user pages
12921292 # XXX: this might be better using restrictions
1293 - # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssSubpage()
 1293+ # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssSubpage()
12941294 # and $this->userCanEditJsSubpage() from working
12951295 # XXX: right 'editusercssjs' is deprecated, for backward compatibility only
12961296 if( $this->isCssSubpage() && !( $user->isAllowed('editusercssjs') || $user->isAllowed('editusercss') )
@@ -1329,7 +1329,7 @@
13301330 wfProfileOut( __METHOD__ );
13311331 return $errors;
13321332 }
1333 -
 1333+
13341334 if( $doExpensiveQueries && !$this->isCssJsSubpage() ) {
13351335 # We /could/ use the protection level on the source page, but it's fairly ugly
13361336 # as we have to establish a precedence hierarchy for pages included by multiple
@@ -1407,7 +1407,7 @@
14081408 if ( $this->getNamespace() < 0 ) {
14091409 return false;
14101410 }
1411 -
 1411+
14121412 // Can't protect pages that exist.
14131413 if ($this->exists()) {
14141414 return false;
@@ -1454,7 +1454,7 @@
14551455 else {
14561456 $expiry_description .= ' (' . wfMsgForContent( 'protect-expiry-indefinite' ).')';
14571457 }
1458 -
 1458+
14591459 # Update protection table
14601460 if ($create_perm != '' ) {
14611461 $dbw->replace( 'protected_titles', array(array('pt_namespace', 'pt_title')),
@@ -1494,7 +1494,7 @@
14951495 $dbw = wfGetDB( DB_MASTER );
14961496
14971497 $dbw->delete( 'protected_titles',
1498 - array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ),
 1498+ array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ),
14991499 __METHOD__ );
15001500 }
15011501
@@ -1515,7 +1515,7 @@
15161516 */
15171517 public function userCanRead() {
15181518 global $wgUser, $wgGroupPermissions;
1519 -
 1519+
15201520 static $useShortcut = null;
15211521
15221522 # Initialize the $useShortcut boolean, to determine if we can skip quite a bit of code below
@@ -1541,7 +1541,7 @@
15421542 }
15431543 }
15441544 }
1545 -
 1545+
15461546 $result = null;
15471547 wfRunHooks( 'userCan', array( &$this, &$wgUser, 'read', &$result ) );
15481548 if ( $result !== null ) {
@@ -1652,7 +1652,7 @@
16531653 return $this->mHasSubpages = (bool)$subpages->count();
16541654 return $this->mHasSubpages = false;
16551655 }
1656 -
 1656+
16571657 /**
16581658 * Get all subpages of this page.
16591659 * @param $limit Maximum number of subpages to fetch; -1 for no limit
@@ -1741,7 +1741,7 @@
17421742 */
17431743 public function userCanEditCssSubpage() {
17441744 global $wgUser;
1745 - return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('editusercss') )
 1745+ return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('editusercss') )
17461746 || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
17471747 }
17481748 /**
@@ -1754,7 +1754,7 @@
17551755 public function userCanEditJsSubpage() {
17561756 global $wgUser;
17571757 return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('edituserjs') )
1758 - || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
 1758+ || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
17591759 }
17601760
17611761 /**
@@ -1771,7 +1771,7 @@
17721772 * Cascading protection: Get the source of any cascading restrictions on this page.
17731773 *
17741774 * @param $get_pages \type{\bool} Whether or not to retrieve the actual pages that the restrictions have come from.
1775 - * @return \type{\arrayof{mixed title array, restriction array}} Array of the Title objects of the pages from
 1775+ * @return \type{\arrayof{mixed title array, restriction array}} Array of the Title objects of the pages from
17761776 * which cascading restrictions have come, false for none, or true if such restrictions exist, but $get_pages was not set.
17771777 * The restriction array is an array of each type, each of which contains an array of unique groups.
17781778 */
@@ -1827,11 +1827,11 @@
18281828 $sources[$page_id] = Title::makeTitle($page_ns, $page_title);
18291829 # Add groups needed for each restriction type if its not already there
18301830 # Make sure this restriction type still exists
1831 -
 1831+
18321832 if ( !isset( $pagerestrictions[$row->pr_type] ) ) {
18331833 $pagerestrictions[$row->pr_type] = array();
18341834 }
1835 -
 1835+
18361836 if ( isset($pagerestrictions[$row->pr_type]) &&
18371837 !in_array($row->pr_level, $pagerestrictions[$row->pr_type]) ) {
18381838 $pagerestrictions[$row->pr_type][]=$row->pr_level;
@@ -1874,17 +1874,17 @@
18751875 private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) {
18761876 $rows = array();
18771877 $dbr = wfGetDB( DB_SLAVE );
1878 -
 1878+
18791879 while( $row = $dbr->fetchObject( $res ) ) {
18801880 $rows[] = $row;
18811881 }
1882 -
 1882+
18831883 $this->loadRestrictionsFromRows( $rows, $oldFashionedRestrictions );
18841884 }
1885 -
 1885+
18861886 public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) {
18871887 $dbr = wfGetDB( DB_SLAVE );
1888 -
 1888+
18891889 $restrictionTypes = $this->getRestrictionTypes();
18901890
18911891 foreach( $restrictionTypes as $type ){
@@ -1897,7 +1897,7 @@
18981898 # Backwards-compatibility: also load the restrictions from the page record (old format).
18991899
19001900 if ( $oldFashionedRestrictions === null ) {
1901 - $oldFashionedRestrictions = $dbr->selectField( 'page', 'page_restrictions',
 1901+ $oldFashionedRestrictions = $dbr->selectField( 'page', 'page_restrictions',
19021902 array( 'page_id' => $this->getArticleId() ), __METHOD__ );
19031903 }
19041904
@@ -1927,7 +1927,7 @@
19281928 # Cycle through all the restrictions.
19291929
19301930 // Don't take care of restrictions types that aren't allowed
1931 -
 1931+
19321932 if( !in_array( $row->pr_type, $restrictionTypes ) )
19331933 continue;
19341934
@@ -2022,7 +2022,7 @@
20232023
20242024 /**
20252025 * Get the expiry time for the restriction against a given action
2026 - * @return 14-char timestamp, or 'infinity' if the page is protected forever
 2026+ * @return 14-char timestamp, or 'infinity' if the page is protected forever
20272027 * or not protected at all, or false if the action is not recognised.
20282028 */
20292029 public function getRestrictionExpiry( $action ) {
@@ -2041,7 +2041,7 @@
20422042 $n = 0;
20432043 } else {
20442044 $dbr = wfGetDB( DB_SLAVE );
2045 - $n = $dbr->selectField( 'archive', 'COUNT(*)',
 2045+ $n = $dbr->selectField( 'archive', 'COUNT(*)',
20462046 array( 'ar_namespace' => $this->getNamespace(), 'ar_title' => $this->getDBkey() ),
20472047 __METHOD__
20482048 );
@@ -2054,7 +2054,7 @@
20552055 }
20562056 return (int)$n;
20572057 }
2058 -
 2058+
20592059 /**
20602060 * Is there a version of this page in the deletion archive?
20612061 * @return bool
@@ -2081,7 +2081,7 @@
20822082 * Get the article ID for this Title from the link cache,
20832083 * adding it if necessary
20842084 * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select
2085 - * for update
 2085+ * for update
20862086 * @return \type{\int} the ID
20872087 */
20882088 public function getArticleID( $flags = 0 ) {
@@ -2184,8 +2184,8 @@
21852185 }
21862186 $dbw = wfGetDB( DB_MASTER );
21872187 $success = $dbw->update( 'page',
2188 - array( 'page_touched' => $dbw->timestamp() ),
2189 - $this->pageCond(),
 2188+ array( 'page_touched' => $dbw->timestamp() ),
 2189+ $this->pageCond(),
21902190 __METHOD__
21912191 );
21922192 HTMLFileCache::clearFileCache( $this );
@@ -2210,7 +2210,7 @@
22112211 }
22122212 return $p . $name;
22132213 }
2214 -
 2214+
22152215 // Returns a simple regex that will match on characters and sequences invalid in titles.
22162216 // Note that this doesn't pick up many things that could be wrong with titles, but that
22172217 // replacing this regex with something valid will make many titles valid.
@@ -2230,16 +2230,16 @@
22312231 '|&#x[0-9A-Fa-f]+;' .
22322232 '/S';
22332233 }
2234 -
 2234+
22352235 return $rxTc;
22362236 }
2237 -
 2237+
22382238 /**
22392239 * Capitalize a text if it belongs to a namespace that capitalizes
22402240 */
22412241 public static function capitalize( $text, $ns = NS_MAIN ) {
22422242 global $wgContLang;
2243 -
 2243+
22442244 if ( MWNamespace::isCapitalized( $ns ) )
22452245 return $wgContLang->ucfirst( $text );
22462246 else
@@ -2457,7 +2457,7 @@
24582458
24592459 /**
24602460 * Set the fragment for this title. Removes the first character from the
2461 - * specified fragment before setting, so it assumes you're passing it with
 2461+ * specified fragment before setting, so it assumes you're passing it with
24622462 * an initial "#".
24632463 *
24642464 * Deprecated for public use, use Title::makeTitle() with fragment parameter.
@@ -2569,8 +2569,8 @@
25702570 ),
25712571 __METHOD__, array(),
25722572 array(
2573 - 'page' => array(
2574 - 'LEFT JOIN',
 2573+ 'page' => array(
 2574+ 'LEFT JOIN',
25752575 array( 'pl_namespace=page_namespace', 'pl_title=page_title' )
25762576 )
25772577 )
@@ -2635,14 +2635,14 @@
26362636 * Returns true if ok, or a getUserPermissionsErrors()-like array otherwise
26372637 * @param &$nt \type{Title} the new title
26382638 * @param $auth \type{\bool} indicates whether $wgUser's permissions
2639 - * should be checked
 2639+ * should be checked
26402640 * @param $reason \type{\string} is the log summary of the move, used for spam checking
26412641 * @return \type{\mixed} True on success, getUserPermissionsErrors()-like array on failure
26422642 */
26432643 public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) {
26442644 global $wgUser;
26452645
2646 - $errors = array();
 2646+ $errors = array();
26472647 if( !$nt ) {
26482648 // Normally we'd add this to $errors, but we'll get
26492649 // lots of syntax errors if $nt is not an object
@@ -2702,7 +2702,7 @@
27032703 // This is kind of lame, won't display nice
27042704 $errors[] = array('spamprotectiontext');
27052705 }
2706 -
 2706+
27072707 $err = null;
27082708 if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) {
27092709 $errors[] = array('hookaborted', $err);
@@ -2732,7 +2732,7 @@
27332733 * Move a title to a new location
27342734 * @param &$nt \type{Title} the new title
27352735 * @param $auth \type{\bool} indicates whether $wgUser's permissions
2736 - * should be checked
 2736+ * should be checked
27372737 * @param $reason \type{\string} The reason for the move
27382738 * @param $createRedirect \type{\bool} Whether to create a redirect from the old title to the new title.
27392739 * Ignored if the user doesn't have the suppressredirect right.
@@ -2794,7 +2794,7 @@
27952795 if( $protected ) {
27962796 # Protect the redirect title as the title used to be...
27972797 $dbw->insertSelect( 'page_restrictions', 'page_restrictions',
2798 - array(
 2798+ array(
27992799 'pr_page' => $redirid,
28002800 'pr_type' => 'pr_type',
28012801 'pr_level' => 'pr_level',
@@ -2874,7 +2874,7 @@
28752875 * source page
28762876 *
28772877 * @param &$nt \type{Title} the page to move to, which should currently
2878 - * be a redirect
 2878+ * be a redirect
28792879 * @param $reason \type{\string} The reason for the move
28802880 * @param $createRedirect \type{\bool} Whether to leave a redirect at the old title.
28812881 * Ignored if the user doesn't have the suppressredirect right
@@ -2917,16 +2917,16 @@
29182918 $dbw->delete( 'langlinks', array( 'll_from' => $newid ), __METHOD__ );
29192919 $dbw->delete( 'redirect', array( 'rd_from' => $newid ), __METHOD__ );
29202920 }
2921 - // If the redirect was recently created, it may have an entry in recentchanges still
2922 - $dbw->delete( 'recentchanges',
2923 - array( 'rc_timestamp' => $rcts, 'rc_namespace' => $newns, 'rc_title' => $newdbk, 'rc_new' => 1 ),
 2921+ // If the redirect was recently created, it may have an entry in recentchanges still
 2922+ $dbw->delete( 'recentchanges',
 2923+ array( 'rc_timestamp' => $rcts, 'rc_namespace' => $newns, 'rc_title' => $newdbk, 'rc_new' => 1 ),
29242924 __METHOD__
29252925 );
29262926
29272927 # Save a null revision in the page's history notifying of the move
29282928 $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
29292929 $nullRevId = $nullRevision->insertOn( $dbw );
2930 -
 2930+
29312931 $article = new Article( $this );
29322932 wfRunHooks( 'NewRevisionFromEditComplete', array($article, $nullRevision, $latest, $wgUser) );
29332933
@@ -2955,7 +2955,7 @@
29562956 'text' => $redirectText ) );
29572957 $redirectRevision->insertOn( $dbw );
29582958 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
2959 -
 2959+
29602960 wfRunHooks( 'NewRevisionFromEditComplete', array($redirectArticle, $redirectRevision, false, $wgUser) );
29612961
29622962 # Now, we record the link from the redirect to the new title.
@@ -2983,7 +2983,7 @@
29842984 $u = new SquidUpdate( $urls );
29852985 $u->doUpdate();
29862986 }
2987 -
 2987+
29882988 }
29892989
29902990 /**
@@ -3006,7 +3006,7 @@
30073007 $newid = $nt->getArticleID();
30083008 $oldid = $this->getArticleID();
30093009 $latest = $this->getLatestRevId();
3010 -
 3010+
30113011 $dbw = wfGetDB( DB_MASTER );
30123012 $now = $dbw->timestamp();
30133013
@@ -3016,7 +3016,7 @@
30173017 throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
30183018 }
30193019 $nullRevId = $nullRevision->insertOn( $dbw );
3020 -
 3020+
30213021 $article = new Article( $this );
30223022 wfRunHooks( 'NewRevisionFromEditComplete', array($article, $nullRevision, $latest, $wgUser) );
30233023
@@ -3045,7 +3045,7 @@
30463046 'text' => $redirectText ) );
30473047 $redirectRevision->insertOn( $dbw );
30483048 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
3049 -
 3049+
30503050 wfRunHooks( 'NewRevisionFromEditComplete', array($redirectArticle, $redirectRevision, false, $wgUser) );
30513051
30523052 # Record the just-created redirect's linking to the page
@@ -3071,9 +3071,9 @@
30723072 # Purge old title from squid
30733073 # The new title, and links to the new title, are purged in Article::onArticleCreate()
30743074 $this->purgeSquid();
3075 -
 3075+
30763076 }
3077 -
 3077+
30783078 /**
30793079 * Move this page's subpages to be subpages of $nt
30803080 * @param $nt Title Move target
@@ -3139,7 +3139,7 @@
31403140 }
31413141 return $retval;
31423142 }
3143 -
 3143+
31443144 /**
31453145 * Checks if this page is just a one-rev redirect.
31463146 * Adds lock, so don't use just for light purposes.
@@ -3169,7 +3169,7 @@
31703170 'page_title' => $this->getDBkey(),
31713171 'page_id=rev_page',
31723172 'page_latest != rev_id'
3173 - ),
 3173+ ),
31743174 __METHOD__,
31753175 array( 'FOR UPDATE' )
31763176 );
@@ -3269,7 +3269,7 @@
32703270 * @return \type{\array} Tree of parent categories
32713271 */
32723272 public function getParentCategoryTree( $children = array() ) {
3273 - $stack = array();
 3273+ $stack = array();
32743274 $parents = $this->getParentCategories();
32753275
32763276 if( $parents ) {
@@ -3343,7 +3343,7 @@
33443344 array( 'ORDER BY' => 'rev_id' )
33453345 );
33463346 }
3347 -
 3347+
33483348 /**
33493349 * Get the first revision of the page
33503350 *
@@ -3365,7 +3365,7 @@
33663366 return new Revision( $row );
33673367 }
33683368 }
3369 -
 3369+
33703370 /**
33713371 * Check if this is a new page
33723372 *
@@ -3509,7 +3509,7 @@
35103510 public function isKnown() {
35113511 return $this->exists() || $this->isAlwaysKnown();
35123512 }
3513 -
 3513+
35143514 /**
35153515 * Is this in a namespace that allows actual pages?
35163516 *
@@ -3690,21 +3690,21 @@
36913691 /**
36923692 * Get all extant redirects to this Title
36933693 *
3694 - * @param $ns \twotypes{\int,\null} Single namespace to consider;
 3694+ * @param $ns \twotypes{\int,\null} Single namespace to consider;
36953695 * NULL to consider all namespaces
36963696 * @return \type{\arrayof{Title}} Redirects to this title
36973697 */
36983698 public function getRedirectsHere( $ns = null ) {
36993699 $redirs = array();
3700 -
3701 - $dbr = wfGetDB( DB_SLAVE );
 3700+
 3701+ $dbr = wfGetDB( DB_SLAVE );
37023702 $where = array(
37033703 'rd_namespace' => $this->getNamespace(),
37043704 'rd_title' => $this->getDBkey(),
37053705 'rd_from = page_id'
37063706 );
37073707 if ( !is_null($ns) ) $where['page_namespace'] = $ns;
3708 -
 3708+
37093709 $res = $dbr->select(
37103710 array( 'redirect', 'page' ),
37113711 array( 'page_namespace', 'page_title' ),
@@ -3718,7 +3718,7 @@
37193719 }
37203720 return $redirs;
37213721 }
3722 -
 3722+
37233723 /**
37243724 * Check if this Title is a valid redirect target
37253725 *
@@ -3726,18 +3726,18 @@
37273727 */
37283728 public function isValidRedirectTarget() {
37293729 global $wgInvalidRedirectTargets;
3730 -
 3730+
37313731 // invalid redirect targets are stored in a global array, but explicity disallow Userlogout here
37323732 if( $this->isSpecial( 'Userlogout' ) ) {
37333733 return false;
37343734 }
3735 -
 3735+
37363736 foreach( $wgInvalidRedirectTargets as $target ) {
37373737 if( $this->isSpecial( $target ) ) {
37383738 return false;
37393739 }
37403740 }
3741 -
 3741+
37423742 return true;
37433743 }
37443744
@@ -3767,17 +3767,17 @@
37683768 return !in_array( $this->mNamespace, $bannedNamespaces );
37693769
37703770 }
3771 -
 3771+
37723772 public function getRestrictionTypes() {
37733773 global $wgRestrictionTypes;
37743774 $types = $this->exists() ? $wgRestrictionTypes : array('create');
3775 -
 3775+
37763776 if ( $this->getNamespace() == NS_FILE ) {
37773777 $types[] = 'upload';
37783778 }
3779 -
 3779+
37803780 wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
3781 -
 3781+
37823782 return $types;
37833783 }
37843784 }

Status & tagging log