Remove UtfNormal class
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index dc661aa..d014503 100644 (file)
@@ -132,13 +132,18 @@ class InfoAction extends FormlessAction {
                                "mw-pageinfo-${header}"
                        ) . "\n";
                        $table = "\n";
+                       $below = "";
                        foreach ( $infoTable as $infoRow ) {
+                               if ( $infoRow[0] == "below" ) {
+                                       $below = $infoRow[1] . "\n";
+                                       continue;
+                               }
                                $name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0];
                                $value = ( $infoRow[1] instanceof Message ) ? $infoRow[1]->escaped() : $infoRow[1];
                                $id = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->getKey() : null;
                                $table = $this->addRow( $table, $name, $value, $id ) . "\n";
                        }
-                       $content = $this->addTable( $content, $table ) . "\n";
+                       $content = $this->addTable( $content, $table ) . "\n" . $below;
                }
 
                // Page footer
@@ -233,13 +238,14 @@ class InfoAction extends FormlessAction {
                ];
 
                // Is it a redirect? If so, where to?
-               if ( $title->isRedirect() ) {
+               $redirectTarget = $this->page->getRedirectTarget();
+               if ( $redirectTarget !== null ) {
                        $pageInfo['header-basic'][] = [
                                $this->msg( 'pageinfo-redirectsto' ),
-                               $linkRenderer->makeLink( $this->page->getRedirectTarget() ) .
+                               $linkRenderer->makeLink( $redirectTarget ) .
                                $this->msg( 'word-separator' )->escaped() .
                                $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink(
-                                       $this->page->getRedirectTarget(),
+                                       $redirectTarget,
                                        $this->msg( 'pageinfo-redirectsto-info' )->text(),
                                        [],
                                        [ 'action' => 'info' ]
@@ -503,6 +509,16 @@ class InfoAction extends FormlessAction {
                                $this->msg( "restriction-$restrictionType" ), $message
                        ];
                }
+               $protectLog = SpecialPage::getTitleFor( 'Log' );
+               $pageInfo['header-restrictions'][] = [
+                       'below',
+                       $linkRenderer->makeKnownLink(
+                               $protectLog,
+                               $this->msg( 'pageinfo-view-protect-log' )->text(),
+                               [],
+                               [ 'type' => 'protect', 'page' => $title->getPrefixedText() ]
+                       ),
+               ];
 
                if ( !$this->page->exists() ) {
                        return $pageInfo;
@@ -723,27 +739,18 @@ class InfoAction extends FormlessAction {
                                $dbrWatchlist = wfGetDB( DB_REPLICA, 'watchlist' );
                                $setOpts += Database::getCacheSetOptions( $dbr, $dbrWatchlist );
 
-                               if ( $wgActorTableSchemaMigrationStage === MIGRATION_NEW ) {
+                               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
                                        $tables = [ 'revision_actor_temp' ];
                                        $field = 'revactor_actor';
                                        $pageField = 'revactor_page';
                                        $tsField = 'revactor_timestamp';
                                        $joins = [];
-                               } elseif ( $wgActorTableSchemaMigrationStage === MIGRATION_OLD ) {
+                               } else {
                                        $tables = [ 'revision' ];
                                        $field = 'rev_user_text';
                                        $pageField = 'rev_page';
                                        $tsField = 'rev_timestamp';
                                        $joins = [];
-                               } else {
-                                       $tables = [ 'revision', 'revision_actor_temp', 'actor' ];
-                                       $field = 'COALESCE( actor_name, rev_user_text)';
-                                       $pageField = 'rev_page';
-                                       $tsField = 'rev_timestamp';
-                                       $joins = [
-                                               'revision_actor_temp' => [ 'LEFT JOIN', 'revactor_rev = rev_id' ],
-                                               'actor' => [ 'LEFT JOIN', 'revactor_actor = actor_id' ],
-                                       ];
                                }
 
                                $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();