* @param string $type One of '', 'block', 'protect', 'rights', 'delete',
* 'upload', 'move'
* @param bool $rc Whether to update recent changes as well as the logging table
- * @param bool $udp Whether to send to the UDP feed
+ * @param bool $udp Whether to send to the UDP feed if NOT sent to RC
*/
- function __construct( $type, $rc = true, $udp = true ) {
+ public function __construct( $type, $rc = true, $udp = 'skipUDP' ) {
$this->type = $type;
$this->updateRecentChanges = $rc;
- $this->sendToUDP = $udp;
+ $this->sendToUDP = ($udp == 'UDP');
}
protected function saveContent() {
- global $wgUser, $wgLogRestrictions;
- $fname = 'LogPage::saveContent';
+ global $wgLogRestrictions;
$dbw = wfGetDB( DB_MASTER );
$log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
'log_comment' => $this->comment,
'log_params' => $this->params
);
- $dbw->insert( 'logging', $data, $fname );
+ $dbw->insert( 'logging', $data, __METHOD__ );
$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 ) {
$titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
- $rcComment = $this->getRcComment();
- RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '', $this->type,
+ RecentChange::notifyLog( $now, $titleObj, $this->doer, $this->getRcComment(), '', $this->type,
$this->action, $this->target, $this->comment, $this->params, $newId );
} else if( $this->sendToUDP ) {
+ # Don't send private logs to UDP
+ if( isset($wgLogRestrictions[$this->type]) && $wgLogRestrictions[$this->type] !='*' ) {
+ return true;
+ }
# Notify external application via UDP.
# We send this to IRC but do not want to add it the RC table.
- global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
$titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
- $rcComment = $this->getRcComment();
- $rc = RecentChange::newLogEntry( $now, $titleObj, $this->doer, $rcComment, '',
+ $rc = RecentChange::newLogEntry( $now, $titleObj, $this->doer, $this->getRcComment(), '',
$this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
- if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) {
- RecentChange::sendToUDP( $rc->getIRCLine() );
- }
+ $rc->notifyRC2UDP();
}
return true;
}
* @param string $type logtype
* @return string Headertext of this logtype
*/
- static function logHeader( $type ) {
+ public static function logHeader( $type ) {
global $wgLogHeaders, $wgMessageCache;
$wgMessageCache->loadAllMessages();
return wfMsgExt($wgLogHeaders[$type],array('parseinline'));
* @static
* @return HTML string
*/
- static function actionText( $type, $action, $title = NULL, $skin = NULL,
+ public static function actionText( $type, $action, $title = NULL, $skin = NULL,
$params = array(), $filterWikilinks = false )
{
global $wgLang, $wgContLang, $wgLogActions, $wgMessageCache;
} else if ( $type == 'protect' && count($params) == 3 ) {
$details .= " {$params[1]}"; // restrictions and expiries
if( $params[2] ) {
- $details .= ' ['.wfMsg('protect-summary-cascade').']';
+ if ( $skin ) {
+ $details .= ' ['.wfMsg('protect-summary-cascade').']';
+ } else {
+ $details .= ' ['.wfMsgForContent('protect-summary-cascade').']';
+ }
}
} else if ( $type == 'move' && count( $params ) == 3 ) {
if( $params[2] ) {
- $details .= ' [' . wfMsg( 'move-redirect-suppressed' ) . ']';
+ if ( $skin ) {
+ $details .= ' [' . wfMsg( 'move-redirect-suppressed' ) . ']';
+ } else {
+ $details .= ' [' . wfMsgForContent( 'move-redirect-suppressed' ) . ']';
+ }
}
}
$rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin ) . $details;
* @param array $params Parameters passed later to wfMsg.* functions
* @param User $doer The user doing the action
*/
- function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
+ public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
if ( !is_array( $params ) ) {
$params = array( $params );
}
* Create a blob from a parameter array
* @static
*/
- static function makeParamBlob( $params ) {
+ public static function makeParamBlob( $params ) {
return implode( "\n", $params );
}
* Extract a parameter array from a blob
* @static
*/
- static function extractParams( $blob ) {
+ public static function extractParams( $blob ) {
if ( $blob === '' ) {
return array();
} else {