* @private
*/
function setupQuery( $request ) {
- $cur = $this->db->tableName( 'cur' );
+ $page = $this->db->tableName( 'page' );
$user = $this->db->tableName( 'user' );
- $this->joinClauses = array( "LEFT OUTER JOIN $cur ON log_namespace=cur_namespace AND log_title=cur_title" );
+ $this->joinClauses = array( "LEFT OUTER JOIN $page ON log_namespace=page_namespace AND log_title=page_title" );
$this->whereClauses = array( 'user_id=log_user' );
$this->limitType( $request->getVal( 'type' ) );
$user = $this->db->tableName( 'user' );
$sql = "SELECT log_type, log_action, log_timestamp,
log_user, user_name,
- log_namespace, log_title, cur_id,
- log_comment FROM $user, $logging ";
+ log_namespace, log_title, page_id,
+ log_comment, log_params FROM $user, $logging ";
if( !empty( $this->joinClauses ) ) {
$sql .= implode( ',', $this->joinClauses );
}
* @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<ul>\n";
while( $s = $result->fetchObject() ) {
$html .= $this->logLine( $s );
}
$result->free();
+ $html .= "\n</ul>\n";
$out->addHTML( $html );
}
* @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 );
- if( $s->cur_id ) {
- $titleLink = $this->skin->makeKnownLinkObj( $title );
+ $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 ) {
+ $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 = '(<em>' . $this->skin->formatComment( $s->log_comment ) . '</em>)';
+ $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 = "<li>$time $userLink $action $comment</li>\n";
+
+ $action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true );
+ $out = "<li>$time $userLink $action $comment $revert</li>\n";
return $out;
}
$this->getTypeMenu() .
$this->getUserInput() .
$this->getTitleInput() .
- "<input type='submit' />" .
+ "<input type='submit' value=\"" . wfMsg( 'querybtn' ) . "\" />" .
"</form>" );
}
*/
function getUserInput() {
$user = htmlspecialchars( $this->reader->queryUser() );
- return "User: <input type='text' name='user' size='12' value=\"$user\" />\n";
+ return wfMsg('specialloguserlabel') . "<input type='text' name='user' size='12' value=\"$user\" />\n";
}
/**
*/
function getTitleInput() {
$title = htmlspecialchars( $this->reader->queryTitle() );
- return "Title: <input type='text' name='page' size='20' value=\"$title\" />\n";
+ return wfMsg('speciallogtitlelabel') . "<input type='text' name='page' size='20' value=\"$title\" />\n";
}
/**
* @private
*/
function showPrevNext( &$out ) {
- global $wgLang;
+ 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
$html = wfViewPrevNext( $offset, $limit,
- $wgLang->specialpage( 'Log' ),
+ $wgContLang->specialpage( 'Log' ),
$bits,
false);
$out->addHTML( '<p>' . $html . '</p>' );