$dbw = wfGetDB( DB_MASTER );
$uid = $wgUser->getID();
+ $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
$this->timestamp = $now = wfTimestampNow();
- $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
);
+ # 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 ) {
$titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
- $rcComment = $this->actionText;
- if( '' != $this->comment ) {
- if ($rcComment == '')
- $rcComment = $this->comment;
- else
- $rcComment .= ': ' . $this->comment;
- }
-
+ $rcComment = $this->getRcComment();
RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
$this->type, $this->action, $this->target, $this->comment, $this->params );
}
return true;
}
+ public function getRcComment() {
+ $rcComment = $this->actionText;
+ if( '' != $this->comment ) {
+ if ($rcComment == '')
+ $rcComment = $this->comment;
+ else
+ $rcComment .= ': ' . $this->comment;
+ }
+ return $rcComment;
+ }
+
/**
* @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 wfMsg( $wgLogHeaders[$type] );
}
/**
* @static
*/
- function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
+ static function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
global $wgLang, $wgContLang, $wgLogActions;
$key = "$type/$action";
* 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 {