function saveContent() {
if( wfReadOnly() ) return false;
- global $wgUser, $wgLogRestrictions;
+ global $wgUser;
$fname = 'LogPage::saveContent';
$dbw = wfGetDB( DB_MASTER );
$uid = $wgUser->getID();
+ $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
$this->timestamp = $now = wfTimestampNow();
-
- $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
- $dbw->insert( 'logging',
- array(
- 'log_type' => $this->type,
- 'log_action' => $this->action,
- 'log_timestamp' => $dbw->timestamp( $now ),
- 'log_user' => $uid,
- 'log_namespace' => $this->target->getNamespace(),
- 'log_title' => $this->target->getDBkey(),
- 'log_comment' => $this->comment,
- 'log_params' => $this->params
- ), $fname
+ $data = array(
+ 'log_type' => $this->type,
+ 'log_action' => $this->action,
+ 'log_timestamp' => $dbw->timestamp( $now ),
+ 'log_user' => $uid,
+ 'log_namespace' => $this->target->getNamespace(),
+ 'log_title' => $this->target->getDBkey(),
+ 'log_comment' => $this->comment,
+ 'log_params' => $this->params
);
- $newId = $dbw->insertId();
+
+ # log_id doesn't exist on Wikimedia servers yet, and it's a tricky
+ # schema update to do. Hack it for now to ignore the field on MySQL.
+ if ( !is_null( $log_id ) ) {
+ $data['log_id'] = $log_id;
+ }
+ $dbw->insert( 'logging', $data, $fname );
# And update recentchanges
if ( $this->updateRecentChanges ) {
- # Don't add private logs to RC!!!
- if ( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
- RecentChange::notifyLog( $now, $this->target, $wgUser, $this->actionText, '',
- $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
+ $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
+ $rcComment = $this->actionText;
+ if( '' != $this->comment ) {
+ if ($rcComment == '')
+ $rcComment = $this->comment;
+ else
+ $rcComment .= ': ' . $this->comment;
}
+
+ RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
+ $this->type, $this->action, $this->target, $this->comment, $this->params );
}
return true;
}
/**
* @static
*/
- function validTypes() {
+ public static function validTypes() {
global $wgLogTypes;
return $wgLogTypes;
}
/**
* @static
*/
- function isLogType( $type ) {
+ public static function isLogType( $type ) {
return in_array( $type, LogPage::validTypes() );
}
}
/**
- * @fixme: handle missing log types
+ * @todo handle missing log types
* @static
*/
- function logHeader( $type ) {
+ static function logHeader( $type ) {
global $wgLogHeaders;
- return wfMsgHtml( $wgLogHeaders[$type] );
+ return wfMsg( $wgLogHeaders[$type] );
}
/**
* @static
*/
- function actionText( $type, $action, $title=NULL, $skin=NULL, $params = array(), $filterWikilinks=false, $translate=false, $forRC=false ) {
+ static function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
global $wgLang, $wgContLang, $wgLogActions;
$key = "$type/$action";
}
} else {
array_unshift( $params, $titleLink );
- // Oversighted blocks show as normal
- if ( $translate && ($key == 'block/block' || $key == 'oversight/block') ) {
- $params[1] = $wgLang->translateBlockExpiry( $params[1] );
+ if ( $key == 'block/block' ) {
+ if ( $translate ) {
+ $params[1] = $wgLang->translateBlockExpiry( $params[1] );
+ }
$params[2] = isset( $params[2] )
? self::formatBlockFlags( $params[2] )
: '';
}
- if ( $forRC ) {
- $params[1] = $wgLang->translateBlockExpiry( $params[1], true );
- $params[2] = isset( $params[2] ) ? str_replace( ",", ", ", self::formatBlockFlags( $params[2] ) ) : '';
- }
$rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin );
}
}
$this->comment = $comment;
$this->params = LogPage::makeParamBlob( $params );
- $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params, false, false, true );
+ $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params );
return $this->saveContent();
}
* Create a blob from a parameter array
* @static
*/
- function makeParamBlob( $params ) {
+ static function makeParamBlob( $params ) {
return implode( "\n", $params );
}
* Extract a parameter array from a blob
* @static
*/
- function extractParams( $blob ) {
+ static function extractParams( $blob ) {
if ( $blob === '' ) {
return array();
} else {