Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -37,7 +37,6 @@ |
38 | 38 | array( 'filearchive', 'patch-filearchive.sql' ), |
39 | 39 | array( 'redirect', 'patch-redirect.sql' ), |
40 | 40 | array( 'querycachetwo', 'patch-querycachetwo.sql' ), |
41 | | -# array( 'page_restrictions', 'patch-page_restrictions.sql' ), |
42 | 41 | ); |
43 | 42 | |
44 | 43 | $wgNewFields = array( |
Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | // but the db allows multiples separated by commas. |
41 | 41 | $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); |
42 | 42 | } |
43 | | - $this->mCascade = $this->mTitle->getRestrictionCascadingFlags() & 1; |
| 43 | + $this->mCascade = $this->mTitle->areRestrictionsCascading(); |
44 | 44 | } |
45 | 45 | |
46 | 46 | // The form will be available in read-only to show levels. |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1649,7 +1649,7 @@ |
1650 | 1650 | $updated = Article::flattenRestrictions( $limit ); |
1651 | 1651 | |
1652 | 1652 | $changed = ( $current != $updated ); |
1653 | | - $changed = $changed || ($this->mTitle->getRestrictionCascadingFlags() != $cascade); |
| 1653 | + $changed = $changed || ($this->mTitle->areRestrictionsCascading() != $cascade); |
1654 | 1654 | $protect = ( $updated != '' ); |
1655 | 1655 | |
1656 | 1656 | # If nothing's changed, do nothing |
— | — | @@ -2798,6 +2798,7 @@ |
2799 | 2799 | /** |
2800 | 2800 | * Add the primary page-view wikitext to the output buffer |
2801 | 2801 | * Saves the text into the parser cache if possible. |
| 2802 | + * Updates templatelinks if it is out of date. |
2802 | 2803 | * |
2803 | 2804 | * @param string $text |
2804 | 2805 | * @param Article $article |
— | — | @@ -2806,12 +2807,10 @@ |
2807 | 2808 | public function outputWikiText( $text, $cache = true ) { |
2808 | 2809 | global $wgParser, $wgUser, $wgOut; |
2809 | 2810 | |
2810 | | - $article = $this; |
2811 | | - |
2812 | 2811 | $popts = $wgOut->parserOptions(); |
2813 | 2812 | $popts->setTidy(true); |
2814 | | - $parserOutput = $wgParser->parse( $text, $article->mTitle, |
2815 | | - $popts, true, true, $this->mRevisionId ); |
| 2813 | + $parserOutput = $wgParser->parse( $text, $this->mTitle, |
| 2814 | + $popts, true, true, $this->getRevIdFetched() ); |
2816 | 2815 | $popts->setTidy(false); |
2817 | 2816 | if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) { |
2818 | 2817 | $parserCache =& ParserCache::singleton(); |
— | — | @@ -2821,13 +2820,27 @@ |
2822 | 2821 | if ( !wfReadOnly() ) { |
2823 | 2822 | |
2824 | 2823 | # Get templates from templatelinks |
2825 | | - $tlTemplates_titles = $this->getUsedTemplates(); |
| 2824 | + $result = array(); |
| 2825 | + $id = $this->mTitle->getArticleID(); |
2826 | 2826 | |
2827 | | - $tlTemplates = array (); |
2828 | | - foreach( $tlTemplates_titles as $template_title) { |
2829 | | - $tlTemplates[] = $template_title->getDBkey(); |
| 2827 | + if( $id == 0 ) { |
| 2828 | + $tlTemplates = array(); |
2830 | 2829 | } |
2831 | 2830 | |
| 2831 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 2832 | + $res = $dbr->select( array( 'templatelinks' ), |
| 2833 | + array( 'tl_namespace', 'tl_title' ), |
| 2834 | + array( 'tl_from' => $id ), |
| 2835 | + 'Article:getUsedTemplates' ); |
| 2836 | + |
| 2837 | + if ( false !== $res ) { |
| 2838 | + if ( $dbr->numRows( $res ) ) { |
| 2839 | + while ( $row = $dbr->fetchObject( $res ) ) { |
| 2840 | + $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ; |
| 2841 | + } |
| 2842 | + } |
| 2843 | + } |
| 2844 | + |
2832 | 2845 | # Get templates from parser output. |
2833 | 2846 | $poTemplates_allns = $parserOutput->getTemplates(); |
2834 | 2847 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -17,6 +17,9 @@ |
18 | 18 | # reset the cache. |
19 | 19 | define( 'MW_TITLECACHE_MAX', 1000 ); |
20 | 20 | |
| 21 | +# Constants for pr_cascade bitfield |
| 22 | +define( 'CASCADE', 1 ); |
| 23 | + |
21 | 24 | /** |
22 | 25 | * Title class |
23 | 26 | * - Represents a title, which may contain an interwiki designation or namespace |
— | — | @@ -50,7 +53,7 @@ |
51 | 54 | var $mArticleID; # Article ID, fetched from the link cache on demand |
52 | 55 | var $mLatestID; # ID of most recent revision |
53 | 56 | var $mRestrictions; # Array of groups allowed to edit this article |
54 | | - var $mCascadeRestrictionFlags; |
| 57 | + var $mCascadeRestriction; |
55 | 58 | var $mRestrictionsLoaded; # Boolean for initialisation on demand |
56 | 59 | var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
57 | 60 | var $mDefaultNamespace; # Namespace index when there is no namespace |
— | — | @@ -1328,7 +1331,7 @@ |
1329 | 1332 | function isCascadeProtectedImage() { |
1330 | 1333 | global $wgEnableCascadingProtection; |
1331 | 1334 | if (!$wgEnableCascadingProtection) |
1332 | | - return; |
| 1335 | + return false; |
1333 | 1336 | |
1334 | 1337 | wfProfileIn(__METHOD__); |
1335 | 1338 | |
— | — | @@ -1340,8 +1343,6 @@ |
1341 | 1344 | |
1342 | 1345 | $res = $dbr->select( $tables, $cols, $where_clauses, __METHOD__); |
1343 | 1346 | |
1344 | | - //die($dbr->numRows($res)); |
1345 | | - |
1346 | 1347 | if ($dbr->numRows($res)) { |
1347 | 1348 | wfProfileOut(__METHOD__); |
1348 | 1349 | return true; |
— | — | @@ -1360,7 +1361,7 @@ |
1361 | 1362 | function isCascadeProtectedPage() { |
1362 | 1363 | global $wgEnableCascadingProtection; |
1363 | 1364 | if (!$wgEnableCascadingProtection) |
1364 | | - return; |
| 1365 | + return false; |
1365 | 1366 | |
1366 | 1367 | wfProfileIn(__METHOD__); |
1367 | 1368 | |
— | — | @@ -1381,12 +1382,12 @@ |
1382 | 1383 | } |
1383 | 1384 | } |
1384 | 1385 | |
1385 | | - function getRestrictionCascadingFlags() { |
| 1386 | + function areRestrictionsCascading() { |
1386 | 1387 | if (!$this->mRestrictionsLoaded) { |
1387 | 1388 | $this->loadRestrictions(); |
1388 | 1389 | } |
1389 | 1390 | |
1390 | | - return $this->mCascadeRestrictionFlags; |
| 1391 | + return $this->mCascadeRestriction; |
1391 | 1392 | } |
1392 | 1393 | |
1393 | 1394 | /** |
— | — | @@ -1411,7 +1412,7 @@ |
1412 | 1413 | |
1413 | 1414 | $this->mRestrictions[$row->pr_type] = explode( ',', trim( $row->pr_level ) ); |
1414 | 1415 | |
1415 | | - $this->mCascadeRestrictionFlags |= $row->pr_cascade; |
| 1416 | + $this->mCascadeRestriction |= $row->pr_cascade; |
1416 | 1417 | } |
1417 | 1418 | |
1418 | 1419 | $this->mRestrictionsLoaded = true; |