X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBrokenRedirects.php;h=9ea18daa87a40ca91d6f28fa9752d778edb78eb2;hb=323a2909ba1f43407ccba8bc1fadf2d25f2de488;hp=701f75f047334b76c1b10942d048ec41e2562130;hpb=8baba70fb49175baa2c21a7f6ab6d2107aed029d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBrokenRedirects.php b/includes/specials/SpecialBrokenRedirects.php index 701f75f047..9ea18daa87 100644 --- a/includes/specials/SpecialBrokenRedirects.php +++ b/includes/specials/SpecialBrokenRedirects.php @@ -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'; }