Tweak for r29561: don't grab a database object until we need it
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 11 Jan 2008 04:41:11 +0000 (04:41 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 11 Jan 2008 04:41:11 +0000 (04:41 +0000)
includes/Title.php

index 2976078..e0d5514 100644 (file)
@@ -1256,13 +1256,12 @@ class Title {
         *   protection, or false if there's none.
         */
        public function getTitleProtection() {
-               $dbr = wfGetDB( DB_SLAVE );
-
                // Can't protect pages in special namespaces
                if ( $this->getNamespace() < NS_MAIN ) {
                        return false;
                }
 
+               $dbr = wfGetDB( DB_SLAVE );
                $res = $dbr->select( 'protected_titles', '*', 
                        array ('pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBKey()) );