Index: branches/werdna/restrictions-separation/includes/Parser.php |
— | — | @@ -94,7 +94,8 @@ |
95 | 95 | * @private |
96 | 96 | */ |
97 | 97 | # Persistent: |
98 | | - var $mTagHooks, $mFunctionHooks, $mFunctionSynonyms, $mVariables, $mTlUpdatePages; |
| 98 | + var $mTagHooks, $mFunctionHooks, $mFunctionSynonyms, $mVariables; |
| 99 | + var $mTlDoneUpdateFor; |
99 | 100 | |
100 | 101 | # Cleared with clearState(): |
101 | 102 | var $mOutput, $mAutonumber, $mDTopen, $mStripState; |
— | — | @@ -3064,17 +3065,18 @@ |
3065 | 3066 | $title = Title::newFromText( $part1, $ns ); |
3066 | 3067 | |
3067 | 3068 | # If this page is subject to cascading restrictions, check that the template is included in templatelinks |
3068 | | - if ($this->mTitle->areRestrictionsCascading()) { |
| 3069 | + if ( $this->mTitle->areRestrictionsCascading( ) ) { |
3069 | 3070 | # Subject to cascading restrictions. Check for templatelinks entry |
3070 | 3071 | |
3071 | | - # Use mTlUpdatePages to avoid recursion. |
3072 | | - if (!$this->mTlUpdatePages) { |
3073 | | - $this->mTlUpdatePages = array (); |
| 3072 | + $res = in_array( $part1, $this->mTlTemplates ); |
| 3073 | + |
| 3074 | + if ( !is_array( $this->mTlDoneUpdateFor ) ) { |
| 3075 | + $this->mTlDoneUpdateFor = array (); |
3074 | 3076 | } |
3075 | 3077 | |
3076 | | - $res = in_array($part1, $this->mTlTemplates); |
| 3078 | + if ( !$res && !in_array( $this->mTitle->getPrefixedText(), $this->mTlDoneUpdateFor ) ) { |
| 3079 | + $this->mTlDoneUpdateFor[] = $this->mTitle->getPrefixedText(); |
3077 | 3080 | |
3078 | | - if (!$res && !in_array($this->mTitle->getPrefixedText(), $this->mTlUpdatePages)) { |
3079 | 3081 | $cc_article = new Article( $this->mTitle ); |
3080 | 3082 | |
3081 | 3083 | # This title needs a templatelinks refresh. Do it now. |
Index: branches/werdna/restrictions-separation/includes/Title.php |
— | — | @@ -1388,7 +1388,7 @@ |
1389 | 1389 | * @param resource $res restrictions as an SQL result. |
1390 | 1390 | * @access public |
1391 | 1391 | */ |
1392 | | - function loadRestrictions( $res ) { |
| 1392 | + function loadRestrictionsFromRow( $res ) { |
1393 | 1393 | $dbr =& wfGetDb( DB_SLAVE ); |
1394 | 1394 | |
1395 | 1395 | if (!$dbr->numRows( $res ) ) { |
— | — | @@ -1413,6 +1413,16 @@ |
1414 | 1414 | $this->mRestrictionsLoaded = true; |
1415 | 1415 | } |
1416 | 1416 | |
| 1417 | + function loadRestrictions() { |
| 1418 | + if( !$this->mRestrictionsLoaded ) { |
| 1419 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 1420 | + |
| 1421 | + $res = $dbr->select( 'page_restrictions', '*', |
| 1422 | + array ( 'pr_page' => $this->getArticleId() ), __METHOD__ ); |
| 1423 | + $this->loadRestrictionsFromRow( $res ); |
| 1424 | + } |
| 1425 | + } |
| 1426 | + |
1417 | 1427 | /** |
1418 | 1428 | * Accessor/initialisation for mRestrictions |
1419 | 1429 | * |
— | — | @@ -1423,11 +1433,7 @@ |
1424 | 1434 | function getRestrictions( $action ) { |
1425 | 1435 | if( $this->exists() ) { |
1426 | 1436 | if( !$this->mRestrictionsLoaded ) { |
1427 | | - $dbr =& wfGetDB( DB_SLAVE ); |
1428 | | - |
1429 | | - $res = $dbr->select( 'page_restrictions', '*', |
1430 | | - array ( 'pr_page' => $this->getArticleId() ), __METHOD__ ); |
1431 | | - $this->loadRestrictions( $res ); |
| 1437 | + $this->loadRestrictions(); |
1432 | 1438 | } |
1433 | 1439 | return isset( $this->mRestrictions[$action] ) |
1434 | 1440 | ? $this->mRestrictions[$action] |