Make mediawiki.special.pageLanguage work again
[lhc/web/wiklou.git] / includes / Title.php
index 3f880f5..e549037 100644 (file)
@@ -3020,20 +3020,22 @@ class Title {
                        return;
                }
 
-               $method = __METHOD__;
-               $dbw = wfGetDB( DB_MASTER );
-               $dbw->onTransactionIdle( function () use ( $dbw, $method ) {
-                       $dbw->delete(
-                               'page_restrictions',
-                               array( 'pr_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
-                               $method
-                       );
-                       $dbw->delete(
-                               'protected_titles',
-                               array( 'pt_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
-                               $method
-                       );
-               } );
+               DeferredUpdates::addUpdate( new AtomicSectionUpdate(
+                       wfGetDB( DB_MASTER ),
+                       __METHOD__,
+                       function ( IDatabase $dbw, $fname ) {
+                               $dbw->delete(
+                                       'page_restrictions',
+                                       array( 'pr_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
+                                       $fname
+                               );
+                               $dbw->delete(
+                                       'protected_titles',
+                                       array( 'pt_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ),
+                                       $fname
+                               );
+                       }
+               ) );
        }
 
        /**
@@ -3547,7 +3549,7 @@ class Title {
                if ( $pageLang->hasVariants() ) {
                        $variants = $pageLang->getVariants();
                        foreach ( $variants as $vCode ) {
-                               $urls[] = $this->getInternalURL( '', $vCode );
+                               $urls[] = $this->getInternalURL( $vCode );
                        }
                }
 
@@ -4629,7 +4631,7 @@ class Title {
                        // Checking $wgLanguageCode hasn't changed for the benefit of unit
                        // tests.
                        $contentHandler = ContentHandler::getForTitle( $this );
-                       $langObj = wfGetLangObj( $contentHandler->getPageLanguage( $this ) );
+                       $langObj = $contentHandler->getPageLanguage( $this );
                        $this->mPageLanguage = array( $langObj->getCode(), $wgLanguageCode );
                } else {
                        $langObj = wfGetLangObj( $this->mPageLanguage[0] );