Index: trunk/phase3/includes/Title.php |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | var $mCascadeSources; ///< Where are the cascading restrictions coming from on this page? |
65 | 65 | var $mRestrictionsLoaded = false; ///< Boolean for initialisation on demand |
66 | 66 | var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand |
| 67 | + var $mTitleProtection; ///< Cached value of getTitleProtection |
67 | 68 | # Don't change the following default, NS_MAIN is hardcoded in several |
68 | 69 | # places. See bug 696. |
69 | 70 | var $mDefaultNamespace = NS_MAIN; ///< Namespace index when there is no namespace |
— | — | @@ -1481,16 +1482,16 @@ |
1482 | 1483 | return false; |
1483 | 1484 | } |
1484 | 1485 | |
1485 | | - $dbr = wfGetDB( DB_SLAVE ); |
1486 | | - $res = $dbr->select( 'protected_titles', '*', |
1487 | | - array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ), |
1488 | | - __METHOD__ ); |
| 1486 | + if ( !isset( $this->mTitleProtection ) ) { |
| 1487 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1488 | + $res = $dbr->select( 'protected_titles', '*', |
| 1489 | + array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ), |
| 1490 | + __METHOD__ ); |
1489 | 1491 | |
1490 | | - if ($row = $dbr->fetchRow( $res )) { |
1491 | | - return $row; |
1492 | | - } else { |
1493 | | - return false; |
| 1492 | + // fetchRow returns false if there are no rows. |
| 1493 | + $this->mTitleProtection = $dbr->fetchRow( $res ); |
1494 | 1494 | } |
| 1495 | + return $this->mTitleProtection; |
1495 | 1496 | } |
1496 | 1497 | |
1497 | 1498 | /** |