Restrict <abbr> formatting to where a title attribute is present
[lhc/web/wiklou.git] / includes / WikiPage.php
index be02402..048dd68 100644 (file)
@@ -2347,6 +2347,14 @@ class WikiPage implements Page, IDBAccessObject {
                                }
                        }
 
+                       // Clear out legacy restriction fields
+                       $dbw->update(
+                               'page',
+                               array( 'page_restrictions' => '' ),
+                               array( 'page_id' => $id ),
+                               __METHOD__
+                       );
+
                        wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $nullRevision, $latest, $user ) );
                        wfRunHooks( 'ArticleProtectComplete', array( &$this, &$user, $limit, $reason ) );
                } else { // Protection of non-existing page (also known as "title protection")
@@ -3029,6 +3037,29 @@ class WikiPage implements Page, IDBAccessObject {
 
        /**#@-*/
 
+       /**
+        * Returns a list of categories this page is a member of.
+        * Results will include hidden categories
+        *
+        * @return TitleArray
+        */
+       public function getCategories() {
+               $id = $this->getId();
+               if ( $id == 0 ) {
+                       return TitleArray::newFromResult( new FakeResultWrapper( array() ) );
+               }
+
+               $dbr = wfGetDB( DB_SLAVE );
+               $res = $dbr->select( 'categorylinks',
+                       array( 'cl_to AS page_title, ' . NS_CATEGORY . ' AS page_namespace' ),
+                       // Have to do that since DatabaseBase::fieldNamesWithAlias treats numeric indexes
+                       // as not being aliases, and NS_CATEGORY is numeric
+                       array( 'cl_from' => $id ),
+                       __METHOD__ );
+
+               return TitleArray::newFromResult( $res );
+       }
+
        /**
         * Returns a list of hidden categories this page is a member of.
         * Uses the page_props and categorylinks tables.
@@ -3487,6 +3518,9 @@ class PoolWorkArticleView extends PoolCounterWork {
                        return false;
                }
 
+               // Reduce effects of race conditions for slow parses (bug 46014)
+               $cacheTime = wfTimestampNow();
+
                $time = - microtime( true );
                $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions );
                $time += microtime( true );
@@ -3498,7 +3532,8 @@ class PoolWorkArticleView extends PoolCounterWork {
                }
 
                if ( $this->cacheable && $this->parserOutput->isCacheable() ) {
-                       ParserCache::singleton()->save( $this->parserOutput, $this->page, $this->parserOptions );
+                       ParserCache::singleton()->save(
+                               $this->parserOutput, $this->page, $this->parserOptions, $cacheTime );
                }
 
                // Make sure file cache is not used on uncacheable content.