/**
* Contain log classes
- *
+ * @file
*/
/**
$this->updateRecentChanges = $rc;
}
- function saveContent() {
- if( wfReadOnly() ) return false;
-
+ protected function saveContent() {
global $wgUser, $wgLogRestrictions;
$fname = 'LogPage::saveContent';
$dbw = wfGetDB( DB_MASTER );
- $uid = $wgUser->getID();
+ $uid = $wgUser->getId();
$log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
$this->timestamp = $now = wfTimestampNow();
$data = array(
+ 'log_id' => $log_id,
'log_type' => $this->type,
'log_action' => $this->action,
'log_timestamp' => $dbw->timestamp( $now ),
'log_params' => $this->params
);
$dbw->insert( 'logging', $data, $fname );
- $newId = $dbw->insertId();
+ $newId = !is_null($log_id) ? $log_id : $dbw->insertId();
+ if( !($dbw->affectedRows() > 0) ) {
+ wfDebugLog( "logging", "LogPage::saveContent failed to insert row - Error {$dbw->lastErrno()}: {$dbw->lastError()}" );
+ }
# And update recentchanges
if( $this->updateRecentChanges ) {
# Don't add private logs to RC!
$this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
}
}
- return ($dbw->affectedRows() > 0);
+ return true;
}
public function getRcComment() {
}
}
} else {
- wfDebug( "LogPage::actionText - unknown action $key\n" );
- $rv = "$action";
+ global $wgLogActionsHandlers;
+ if( isset( $wgLogActionsHandlers[$key] ) ) {
+ $args = func_get_args();
+ $rv = call_user_func_array( $wgLogActionsHandlers[$key], $args );
+ } else {
+ wfDebug( "LogPage::actionText - unknown action $key\n" );
+ $rv = "$action";
+ }
}
if( $filterWikilinks ) {
$rv = str_replace( "[[", "", $rv );