Merge "Add canonical id to header on action=info"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 2adc5fb..3ba2d2e 100644 (file)
@@ -1055,6 +1055,13 @@ class WikiPage implements Page, IDBAccessObject {
        ) {
                $useParserCache =
                        ( !$forceParse ) && $this->shouldCheckParserCache( $parserOptions, $oldid );
+
+               if ( $useParserCache && !$parserOptions->isSafeToCache() ) {
+                       throw new InvalidArgumentException(
+                               'The supplied ParserOptions are not safe to cache. Fix the options or set $forceParse = true.'
+                       );
+               }
+
                wfDebug( __METHOD__ .
                        ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $parserOptions->getStubThreshold() ) {
@@ -1307,7 +1314,6 @@ class WikiPage implements Page, IDBAccessObject {
         * @return bool
         */
        public function updateIfNewerOn( $dbw, $revision ) {
-
                $row = $dbw->selectRow(
                        [ 'revision', 'page' ],
                        [ 'rev_id', 'rev_timestamp', 'page_is_redirect' ],
@@ -1379,7 +1385,6 @@ class WikiPage implements Page, IDBAccessObject {
        public function replaceSectionContent(
                $sectionId, Content $sectionContent, $sectionTitle = '', $edittime = null
        ) {
-
                $baseRevId = null;
                if ( $edittime && $sectionId !== 'new' ) {
                        $dbr = wfGetDB( DB_REPLICA );
@@ -1418,7 +1423,6 @@ class WikiPage implements Page, IDBAccessObject {
        public function replaceSectionAtRev( $sectionId, Content $sectionContent,
                $sectionTitle = '', $baseRevId = null
        ) {
-
                if ( strval( $sectionId ) === '' ) {
                        // Whole-page edit; let the whole text through
                        $newContent = $sectionContent;
@@ -3327,7 +3331,7 @@ class WikiPage implements Page, IDBAccessObject {
                HTMLFileCache::clearFileCache( $title );
 
                $revid = $revision ? $revision->getId() : null;
-               DeferredUpdates::addCallableUpdate( function() use ( $title, $revid ) {
+               DeferredUpdates::addCallableUpdate( function () use ( $title, $revid ) {
                        InfoAction::invalidateCache( $title, $revid );
                } );
        }