Merge "mediawiki.mixins.rotation: Remove unnecessary @-o-keyframes"
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index 4459047..e6d5274 100644 (file)
@@ -802,6 +802,10 @@ class ParserOptions {
 
                $confstr .= $wgRenderHashAppend;
 
+               // @note: as of Feb 2015, core never sets the editsection flag, since it uses
+               // <mw:editsection> tags to inject editsections on the fly. However, extensions
+               // may be using it by calling ParserOption::optionUsed resp. ParserOutput::registerOption
+               // directly. At least Wikibase does at this point in time.
                if ( !in_array( 'editsection', $forOptions ) ) {
                        $confstr .= '!*';
                } elseif ( !$this->mEditSection ) {
@@ -827,8 +831,8 @@ class ParserOptions {
        }
 
        /**
-        * Sets a hook to force that a page exists, and sets a current revision callback to return a
-        * revision with custom content when the current revision of the page is requested.
+        * Sets a hook to force that a page exists, and sets a current revision callback to return
+        * revision with custom content when the current revision of the page is requested.
         *
         * @since 1.25
         * @param Title $title
@@ -837,20 +841,25 @@ class ParserOptions {
         * @return ScopedCallback to unset the hook
         */
        public function setupFakeRevision( $title, $content, $user ) {
-               $oldCallback = $this->setCurrentRevisionCallback( function ( $titleToCheck, $parser = false ) use ( $title, $content, $user, &$oldCallback ) {
-                       if ( $titleToCheck->equals( $title ) ) {
-                               return new Revision( array(
-                                       'page' => $title->getArticleID(),
-                                       'user_text' => $user->getName(),
-                                       'user' => $user->getId(),
-                                       'parent_id' => $title->getLatestRevId(),
-                                       'title' => $title,
-                                       'content' => $content
-                               ) );
-                       } else {
-                               return call_user_func( $oldCallback, $titleToCheck, $parser );
+               $oldCallback = $this->setCurrentRevisionCallback(
+                       function (
+                               $titleToCheck, $parser = false ) use ( $title, $content, $user, &$oldCallback
+                       ) {
+                               if ( $titleToCheck->equals( $title ) ) {
+                                       return new Revision( array(
+                                               'page' => $title->getArticleID(),
+                                               'user_text' => $user->getName(),
+                                               'user' => $user->getId(),
+                                               'parent_id' => $title->getLatestRevId(),
+                                               'title' => $title,
+                                               'content' => $content
+                                       ) );
+                               } else {
+                                       return call_user_func( $oldCallback, $titleToCheck, $parser );
+                               }
                        }
-               } );
+               );
+
                global $wgHooks;
                $wgHooks['TitleExists'][] =
                        function ( $titleToCheck, &$exists ) use ( $title ) {