X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialLog.php;h=4a04482d6def592931269f0e0250096c5cedb7bb;hb=8f0f91659d5db006f61ff8c3332f83928e546f5d;hp=5eb8711c5dbad2e0c72ff916781bf70e6ace7e8e;hpb=5b7d2e0d366b219ce32a68b1fa8f8b84cf21bba6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 5eb8711c5d..4a04482d6d 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -146,7 +146,7 @@ class LogReader { $sql = "SELECT log_type, log_action, log_timestamp, log_user, user_name, log_namespace, log_title, page_id, - log_comment FROM $user, $logging "; + log_comment, log_params FROM $user, $logging "; if( !empty( $this->joinClauses ) ) { $sql .= implode( ',', $this->joinClauses ); } @@ -231,12 +231,33 @@ class LogViewer { * @param OutputPage $out where to send output */ function showList( &$out ) { - $html = ""; + global $wgLinkCache; $result = $this->reader->getRows(); + + // Fetch results and form a batch link existence query + $batch = new LinkBatch; + while ( $s = $result->fetchObject() ) { + // User link + $title = Title::makeTitleSafe( NS_USER, $s->user_name ); + $batch->addObj( $title ); + + // Move destination link + if ( $s->log_type == 'move' ) { + $paramArray = LogPage::extractParams( $s->log_params ); + $title = Title::newFromText( $paramArray[0] ); + $batch->addObj( $title ); + } + } + $batch->execute( $wgLinkCache ); + + // Rewind result pointer and go through it again, making the HTML + $result->seek( 0 ); + $html = "\n\n"; $out->addHTML( $html ); } @@ -246,24 +267,37 @@ class LogViewer { * @private */ function logLine( $s ) { - global $wgLang; + global $wgLang, $wgLinkCache; $title = Title::makeTitle( $s->log_namespace, $s->log_title ); $user = Title::makeTitleSafe( NS_USER, $s->user_name ); - $time = $wgLang->timeanddate( $s->log_timestamp ); + $time = $wgLang->timeanddate( $s->log_timestamp, true ); + + // Enter the existence or non-existence of this page into the link cache, + // for faster makeLinkObj() in LogPage::actionText() if( $s->page_id ) { - $titleLink = $this->skin->makeKnownLinkObj( $title ); + $wgLinkCache->addGoodLink( $s->page_id, $title->getPrefixedText() ); } else { - $titleLink = $this->skin->makeBrokenLinkObj( $title ); + $wgLinkCache->addBadLink( $title->getPrefixedText() ); } + $userLink = $this->skin->makeLinkObj( $user, htmlspecialchars( $s->user_name ) ); - if( '' === $s->log_comment ) { - $comment = ''; - } else { - $comment = '(' . $this->skin->formatComment( $s->log_comment ) . ')'; + $comment = $this->skin->commentBlock( $s->log_comment ); + $paramArray = LogPage::extractParams( $s->log_params ); + $revert = ''; + if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) { + $specialTitle = Title::makeTitle( NS_SPECIAL, 'Movepage' ); + $destTitle = Title::newFromText( $paramArray[0] ); + if ( $destTitle ) { + $revert = '(' . $this->skin->makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ), + 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) . + '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) . + '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) . + '&wpMovetalk=0' ) . ')'; + } } - - $action = LogPage::actionText( $s->log_type, $s->log_action, $titleLink ); - $out = "
  • $time $userLink $action $comment
  • \n"; + + $action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true ); + $out = "
  • $time $userLink $action $comment $revert
  • \n"; return $out; } @@ -293,7 +327,7 @@ class LogViewer { $this->getTypeMenu() . $this->getUserInput() . $this->getTitleInput() . - "" . + "" . "" ); } @@ -335,13 +369,13 @@ class LogViewer { * @private */ function showPrevNext( &$out ) { - global $wgContLang; + global $wgContLang,$wgRequest; $pieces = array(); $pieces[] = 'type=' . htmlspecialchars( $this->reader->queryType() ); $pieces[] = 'user=' . htmlspecialchars( $this->reader->queryUser() ); $pieces[] = 'page=' . htmlspecialchars( $this->reader->queryTitle() ); $bits = implode( '&', $pieces ); - $offset = 0; $limit = 50; + list( $limit, $offset ) = $wgRequest->getLimitOffset(); # TODO: use timestamps instead of offsets to make it more natural # to go huge distances in time