X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBrokenRedirects.php;h=9ea18daa87a40ca91d6f28fa9752d778edb78eb2;hb=323a2909ba1f43407ccba8bc1fadf2d25f2de488;hp=1bbdbeab9318b02ba18b37461b1747d7f6e568f2;hpb=05b8af8b91dac965c67571668187d1dc2511ae03;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBrokenRedirects.php b/includes/specials/SpecialBrokenRedirects.php index 1bbdbeab93..9ea18daa87 100644 --- a/includes/specials/SpecialBrokenRedirects.php +++ b/includes/specials/SpecialBrokenRedirects.php @@ -32,7 +32,7 @@ class BrokenRedirectsPage extends QueryPage { parent::__construct( $name ); } - function isExpensive() { + public function isExpensive() { return true; } @@ -48,7 +48,7 @@ class BrokenRedirectsPage extends QueryPage { return $this->msg( 'brokenredirectstext' )->parseAsBlock(); } - function getQueryInfo() { + public function getQueryInfo() { $dbr = wfGetDB( DB_SLAVE ); return array( @@ -121,12 +121,20 @@ class BrokenRedirectsPage extends QueryPage { array( 'redirect' => 'no' ) ); $links = array(); - $links[] = Linker::linkKnown( - $fromObj, - $this->msg( 'brokenredirects-edit' )->escaped(), - array(), - array( 'action' => 'edit' ) - ); + // if the page is editable, add an edit link + if ( + // check user permissions + $this->getUser()->isAllowed( 'edit' ) && + // check, if the content model is editable through action=edit + ContentHandler::getForTitle( $fromObj )->supportsDirectEditing() + ) { + $links[] = Linker::linkKnown( + $fromObj, + $this->msg( 'brokenredirects-edit' )->escaped(), + array(), + array( 'action' => 'edit' ) + ); + } $to = Linker::link( $toObj, null, @@ -147,13 +155,37 @@ class BrokenRedirectsPage extends QueryPage { ); } - $out .= $this->msg( 'parentheses' )->rawParams( $this->getLanguage() - ->pipeList( $links ) )->escaped(); + if ( $links ) { + $out .= $this->msg( 'parentheses' )->rawParams( $this->getLanguage() + ->pipeList( $links ) )->escaped(); + } $out .= " {$arr} {$to}"; return $out; } + + /** + * Cache page content model for performance + * + * @param IDatabase $db + * @param ResultWrapper $res + */ + function preprocessResults( $db, $res ) { + if ( !$res->numRows() ) { + return; + } + + $batch = new LinkBatch; + foreach ( $res as $row ) { + $batch->add( $row->namespace, $row->title ); + } + $batch->execute(); + + // Back to start for display + $res->seek( 0 ); + } + protected function getGroupName() { return 'maintenance'; }