Revised design of Special:Userlogin
[lhc/web/wiklou.git] / includes / Title.php
index 5ce742c..aa8fb93 100644 (file)
@@ -575,10 +575,12 @@ class Title {
         */
        public function isLocal() {
                if ( $this->mInterwiki != '' ) {
-                       return Interwiki::fetch( $this->mInterwiki )->isLocal();
-               } else {
-                       return true;
+                       $iw = Interwiki::fetch( $this->mInterwiki );
+                       if ( $iw ) {
+                               return $iw->isLocal();
+                       }
                }
+               return true;
        }
 
        /**
@@ -1325,8 +1327,8 @@ class Title {
        }
 
        /**
-        * Helper to fix up the get{Local,Full,Link,Canonical}URL args
-        * get{Canonical,Full,Link,Local}URL methods accepted an optional
+        * Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args
+        * get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional
         * second argument named variant. This was deprecated in favor
         * of passing an array of option with a "variant" key
         * Once $query2 is removed for good, this helper can be dropped
@@ -1339,7 +1341,9 @@ class Title {
         */
        private static function fixUrlQueryArgs( $query, $query2 = false ) {
                if( $query2 !== false ) {
-                       wfDeprecated( "Title::get{Canonical,Full,Link,Local} method called with a second parameter is deprecated. Add your parameter to an array passed as the first parameter.", "1.19" );
+                       wfDeprecated( "Title::get{Canonical,Full,Link,Local,Internal}URL " .
+                               "method called with a second parameter is deprecated. Add your " .
+                               "parameter to an array passed as the first parameter.", "1.19" );
                }
                if ( is_array( $query ) ) {
                        $query = wfArrayToCgi( $query );
@@ -1397,7 +1401,6 @@ class Title {
         * Get a URL with no fragment or server name.  If this page is generated
         * with action=render, $wgServer is prepended.
         *
-
         * @param string|array $query an optional query string,
         *   not used for interwiki links. Can be specified as an associative array as well,
         *   e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped).
@@ -4501,23 +4504,30 @@ class Title {
         */
        public function invalidateCache() {
                global $wgMemc;
+
                if ( wfReadOnly() ) {
                        return false;
                }
+
                $dbw = wfGetDB( DB_MASTER );
-               $success = $dbw->update(
-                       'page',
-                       array( 'page_touched' => $dbw->timestamp() ),
-                       $this->pageCond(),
-                       __METHOD__
-               );
+               $conds = $this->pageCond();
+               $dbw->onTransactionIdle( function() use ( $dbw, $conds ) {
+                       $dbw->update(
+                               'page',
+                               array( 'page_touched' => $dbw->timestamp() ),
+                               $conds,
+                               __METHOD__
+                       );
+               } );
                HTMLFileCache::clearFileCache( $this );
 
                // Clear page info.
                $revision = WikiPage::factory( $this )->getRevision();
-               if( $revision !== null ) {
+               if ( $revision !== null ) {
                        $memcKey = wfMemcKey( 'infoaction', $this->getPrefixedText(), $revision->getId() );
-                       $success = $success && $wgMemc->delete( $memcKey );
+                       $success = $wgMemc->delete( $memcKey );
+               } else {
+                       $success = true;
                }
 
                return $success;