Index: trunk/phase3/includes/Title.php |
— | — | @@ -45,29 +45,28 @@ |
46 | 46 | * @private |
47 | 47 | */ |
48 | 48 | |
49 | | - var $mTextform = ''; # Text form (spaces not underscores) of the main part |
50 | | - var $mUrlform = ''; # URL-encoded form of the main part |
51 | | - var $mDbkeyform = ''; # Main part with underscores |
| 49 | + var $mTextform = ''; # Text form (spaces not underscores) of the main part |
| 50 | + var $mUrlform = ''; # URL-encoded form of the main part |
| 51 | + var $mDbkeyform = ''; # Main part with underscores |
52 | 52 | var $mUserCaseDBKey; # DB key with the initial letter in the case specified by the user |
53 | 53 | var $mNamespace = NS_MAIN; # Namespace index, i.e. one of the NS_xxxx constants |
54 | | - var $mInterwiki = ''; # Interwiki prefix (or null string) |
55 | | - var $mFragment; # Title fragment (i.e. the bit after the #) |
| 54 | + var $mInterwiki = ''; # Interwiki prefix (or null string) |
| 55 | + var $mFragment; # Title fragment (i.e. the bit after the #) |
56 | 56 | var $mArticleID = -1; # Article ID, fetched from the link cache on demand |
57 | 57 | var $mLatestID = false; # ID of most recent revision |
58 | 58 | var $mRestrictions = array(); # Array of groups allowed to edit this article |
59 | 59 | var $mOldRestrictions = false; |
60 | | - var $mCascadeRestriction; # Cascade restrictions on this page to included templates and images? |
61 | | - var $mRestrictionsExpiry; # When do the restrictions on this page expire? |
| 60 | + var $mCascadeRestriction; # Cascade restrictions on this page to included templates and images? |
| 61 | + var $mRestrictionsExpiry; # When do the restrictions on this page expire? |
62 | 62 | var $mHasCascadingRestrictions; # Are cascading restrictions in effect on this page? |
63 | 63 | var $mCascadeRestrictionSources; # Where are the cascading restrictions coming from on this page? |
64 | 64 | var $mRestrictionsLoaded = false; # Boolean for initialisation on demand |
65 | | - var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
66 | | - |
| 65 | + var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
67 | 66 | # Don't change the following default, NS_MAIN is hardcoded in several |
68 | 67 | # places. See bug 696. |
69 | 68 | var $mDefaultNamespace = NS_MAIN; # Namespace index when there is no namespace |
70 | | - # Zero except in {{transclusion}} tags |
71 | | - var $mWatched = null; # Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() |
| 69 | + # Zero except in {{transclusion}} tags |
| 70 | + var $mWatched = null; # Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() |
72 | 71 | var $mLength = -1; # The page length, 0 for special pages |
73 | 72 | var $mRedirect = null; # Is the article at this title a redirect? |
74 | 73 | /**#@-*/ |
— | — | @@ -1340,26 +1339,15 @@ |
1341 | 1340 | return false; |
1342 | 1341 | } |
1343 | 1342 | |
1344 | | - // Cache to avoid multiple database queries for the same title |
1345 | | - if ( isset($this->mProtections) ) { |
1346 | | - return $this->mProtections; |
1347 | | - } |
1348 | | - |
1349 | | - $conds = array( |
1350 | | - 'pt_namespace' => $this->getNamespace(), |
1351 | | - 'pt_title' => $this->getDBkey() |
1352 | | - ); |
1353 | | - |
1354 | 1343 | $dbr = wfGetDB( DB_SLAVE ); |
1355 | | - $res = $dbr->select( 'protected_titles', '*', $conds, __METHOD__ ); |
| 1344 | + $res = $dbr->select( 'protected_titles', '*', |
| 1345 | + array ('pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey()) ); |
1356 | 1346 | |
1357 | 1347 | if ($row = $dbr->fetchRow( $res )) { |
1358 | | - $this->mProtections = $row; |
| 1348 | + return $row; |
1359 | 1349 | } else { |
1360 | | - $this->mProtections = false; |
| 1350 | + return false; |
1361 | 1351 | } |
1362 | | - |
1363 | | - return $this->mProtections; |
1364 | 1352 | } |
1365 | 1353 | |
1366 | 1354 | public function updateTitleProtection( $create_perm, $reason, $expiry ) { |
— | — | @@ -1891,30 +1879,19 @@ |
1892 | 1880 | * @return int the number of archived revisions |
1893 | 1881 | */ |
1894 | 1882 | public function isDeleted() { |
| 1883 | + $fname = 'Title::isDeleted'; |
1895 | 1884 | if ( $this->getNamespace() < 0 ) { |
1896 | | - return 0; |
| 1885 | + $n = 0; |
| 1886 | + } else { |
| 1887 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1888 | + $n = $dbr->selectField( 'archive', 'COUNT(*)', array( 'ar_namespace' => $this->getNamespace(), |
| 1889 | + 'ar_title' => $this->getDBkey() ), $fname ); |
| 1890 | + if( $this->getNamespace() == NS_IMAGE ) { |
| 1891 | + $n += $dbr->selectField( 'filearchive', 'COUNT(*)', |
| 1892 | + array( 'fa_name' => $this->getDBkey() ), $fname ); |
| 1893 | + } |
1897 | 1894 | } |
1898 | | - |
1899 | | - // Cache to avoid multiple queries for the same title |
1900 | | - if ( isset($this->mIsDeleted) ) { |
1901 | | - return $this->mIsDeleted; |
1902 | | - } |
1903 | | - |
1904 | | - $dbr = wfGetDB( DB_SLAVE ); |
1905 | | - $aConds = array( |
1906 | | - 'ar_namespace' => $this->getNamespace(), |
1907 | | - 'ar_title' => $this->getDBkey() |
1908 | | - ); |
1909 | | - $n = $dbr->selectField( 'archive', 'COUNT(*)', $aConds, __METHOD__ ); |
1910 | | - |
1911 | | - if ( $this->getNamespace() == NS_IMAGE ) { |
1912 | | - $faConds = array( 'fa_name' => $this->getDBkey() ); |
1913 | | - $n += $dbr->selectField( 'filearchive', 'COUNT(*)', $faConds , __METHOD__ ); |
1914 | | - } |
1915 | | - |
1916 | | - $this->mIsDeleted = (int) $n; |
1917 | | - |
1918 | | - return $this->mIsDeleted; |
| 1895 | + return (int)$n; |
1919 | 1896 | } |
1920 | 1897 | |
1921 | 1898 | /** |