Add link to protect log to action=info
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index 11b8bad..1cc4288 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
@@ -504,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;