Merge "[FileBackend] Fixed bug where "false" could be included in getDirectoryList()."
[lhc/web/wiklou.git] / includes / Title.php
index 896218b..442bc22 100644 (file)
@@ -689,7 +689,7 @@ class Title {
                }
 
                if( !$this->mContentModel ) {
-                       throw new MWException( "failed to determin content model!" );
+                       throw new MWException( 'Failed to determine content model!' );
                }
 
                return $this->mContentModel;
@@ -1838,10 +1838,9 @@ class Title {
         * @return Array list of errors
         */
        private function checkSpecialsAndNSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
-               # Only 'createaccount' and 'execute' can be performed on
-               # special pages, which don't actually exist in the DB.
-               $specialOKActions = array( 'createaccount', 'execute', 'read' );
-               if ( NS_SPECIAL == $this->mNamespace && !in_array( $action, $specialOKActions ) ) {
+               # Only 'createaccount' can be performed on special pages,
+               # which don't actually exist in the DB.
+               if ( NS_SPECIAL == $this->mNamespace && $action !== 'createaccount' ) {
                        $errors[] = array( 'ns-specialprotected' );
                }
 
@@ -2361,7 +2360,8 @@ class Title {
                $expiry = array( 'create' => $expiry );
 
                $page = WikiPage::factory( $this );
-               $status = $page->doUpdateRestrictions( $limit, $expiry, false, $reason, $wgUser );
+               $cascade = false;
+               $status = $page->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $wgUser );
 
                return $status->isOK();
        }
@@ -2985,6 +2985,7 @@ class Title {
                        return $this->mLatestID = 0;
                }
                $linkCache = LinkCache::singleton();
+               $linkCache->addLinkObj( $this );
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
                if ( $cached === null ) { # check the assumption that the cache actually knows about this title
                        # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
@@ -3502,9 +3503,11 @@ class Title {
                if ( !$wgContentHandlerUseDB &&
                                $this->getContentModel() !== $nt->getContentModel() ) {
                        // can't move a page if that would change the page's content model
-                       $errors[] = array( 'bad-target-model',
-                                                       ContentHandler::getLocalizedName( $this->getContentModel() ),
-                                                       ContentHandler::getLocalizedName( $nt->getContentModel() ) );
+                       $errors[] = array(
+                               'bad-target-model',
+                               ContentHandler::getLocalizedName( $this->getContentModel() ),
+                               ContentHandler::getLocalizedName( $nt->getContentModel() )
+                       );
                }
 
                // Image-specific checks
@@ -4029,7 +4032,7 @@ class Title {
                        array()
                );
 
-               if ( $dbr->numRows( $res ) > 0 ) {
+               if ( $res->numRows() > 0 ) {
                        foreach ( $res as $row ) {
                                // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to);
                                $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText();
@@ -4461,6 +4464,7 @@ class Title {
         * @return Bool true if the update succeded
         */
        public function invalidateCache() {
+               global $wgMemc;
                if ( wfReadOnly() ) {
                        return false;
                }
@@ -4472,6 +4476,14 @@ class Title {
                        __METHOD__
                );
                HTMLFileCache::clearFileCache( $this );
+
+               // Clear page info.
+               $revision = WikiPage::factory( $this )->getRevision();
+               if( $revision !== null ) {
+                       $memcKey = wfMemcKey( 'infoaction', $this->getPrefixedText(), $revision->getId() );
+                       $success = $success && $wgMemc->delete( $memcKey );
+               }
+
                return $success;
        }