Merge "Fixed typo"
[lhc/web/wiklou.git] / includes / Title.php
index 48791f0..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' );
-               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' );
                }
 
@@ -2986,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
@@ -3503,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
@@ -4030,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();