Merge "Tests for Revision::userCanBitfield"
[lhc/web/wiklou.git] / includes / page / Article.php
index f52cd8d..c9dc273 100644 (file)
@@ -466,7 +466,7 @@ class Article implements Page {
                # Allow frames by default
                $outputPage->allowClickjacking();
 
-               $parserCache = ParserCache::singleton();
+               $parserCache = MediaWikiServices::getInstance()->getParserCache();
 
                $parserOptions = $this->getParserOptions();
                # Render printable version, use printable version cache
@@ -590,7 +590,7 @@ class Article implements Page {
                                                        $outputPage->setRobotPolicy( 'noindex,nofollow' );
 
                                                        $errortext = $error->getWikiText( false, 'view-pool-error' );
-                                                       $outputPage->addWikiText( '<div class="errorbox">' . $errortext . '</div>' );
+                                                       $outputPage->addWikiText( Html::errorBox( $errortext ) );
                                                }
                                                # Connection or timeout error
                                                return;
@@ -1179,7 +1179,8 @@ class Article implements Page {
                $cache = MediaWikiServices::getInstance()->getMainObjectStash();
                $key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
                $loggedIn = $this->getContext()->getUser()->isLoggedIn();
-               if ( $loggedIn || $cache->get( $key ) ) {
+               $sessionExists = $this->getContext()->getRequest()->getSession()->isPersistent();
+               if ( $loggedIn || $cache->get( $key ) || $sessionExists ) {
                        $logTypes = [ 'delete', 'move', 'protect' ];
 
                        $dbr = wfGetDB( DB_REPLICA );
@@ -1196,7 +1197,7 @@ class Article implements Page {
                                        'lim' => 10,
                                        'conds' => $conds,
                                        'showIfEmpty' => false,
-                                       'msgKey' => [ $loggedIn
+                                       'msgKey' => [ $loggedIn || $sessionExists
                                                ? 'moveddeleted-notice'
                                                : 'moveddeleted-notice-recent'
                                        ]
@@ -1695,24 +1696,11 @@ class Article implements Page {
 
                $outputPage->enableOOUI();
 
-               $options = [];
-               $options[] = [
-                       'data' => 'other',
-                       'label' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text(),
-               ];
-               $list = $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text();
-               foreach ( explode( "\n", $list ) as $option ) {
-                       $value = trim( $option );
-                       if ( $value == '' ) {
-                               continue;
-                       } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
-                               $options[] = [ 'optgroup' => trim( substr( $value, 1 ) ) ];
-                       } elseif ( substr( $value, 0, 2 ) == '**' ) {
-                               $options[] = [ 'data' => trim( substr( $value, 2 ) ) ];
-                       } else {
-                               $options[] = [ 'data' => trim( $value ) ];
-                       }
-               }
+               $options = Xml::listDropDownOptions(
+                       $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(),
+                       [ 'other' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text() ]
+               );
+               $options = Xml::listDropDownOptionsOoui( $options );
 
                $fields[] = new OOUI\FieldLayout(
                        new OOUI\DropdownInputWidget( [
@@ -2129,16 +2117,6 @@ class Article implements Page {
                return $this->mPage->doPurge();
        }
 
-       /**
-        * Call to WikiPage function for backwards compatibility.
-        * @see WikiPage::getLastPurgeTimestamp
-        * @deprecated since 1.29
-        */
-       public function getLastPurgeTimestamp() {
-               wfDeprecated( __METHOD__, '1.29' );
-               return $this->mPage->getLastPurgeTimestamp();
-       }
-
        /**
         * Call to WikiPage function for backwards compatibility.
         * @see WikiPage::doViewUpdates
@@ -2661,45 +2639,5 @@ class Article implements Page {
                return $handler->getAutoDeleteReason( $title, $hasHistory );
        }
 
-       /**
-        * @return array
-        *
-        * @deprecated since 1.24, use WikiPage::selectFields() instead
-        */
-       public static function selectFields() {
-               wfDeprecated( __METHOD__, '1.24' );
-               return WikiPage::selectFields();
-       }
-
-       /**
-        * @param Title $title
-        *
-        * @deprecated since 1.24, use WikiPage::onArticleCreate() instead
-        */
-       public static function onArticleCreate( $title ) {
-               wfDeprecated( __METHOD__, '1.24' );
-               WikiPage::onArticleCreate( $title );
-       }
-
-       /**
-        * @param Title $title
-        *
-        * @deprecated since 1.24, use WikiPage::onArticleDelete() instead
-        */
-       public static function onArticleDelete( $title ) {
-               wfDeprecated( __METHOD__, '1.24' );
-               WikiPage::onArticleDelete( $title );
-       }
-
-       /**
-        * @param Title $title
-        *
-        * @deprecated since 1.24, use WikiPage::onArticleEdit() instead
-        */
-       public static function onArticleEdit( $title ) {
-               wfDeprecated( __METHOD__, '1.24' );
-               WikiPage::onArticleEdit( $title );
-       }
-
        // ******
 }