Remove log debugging code, not needed anymore

This commit is contained in:
Aaron Schulz 2008-04-27 23:45:31 +00:00
parent 9fb54c79cc
commit b52a75d33e
3 changed files with 15 additions and 26 deletions

View file

@ -2318,7 +2318,7 @@ class Article {
# Now that it's safely backed up, delete it # Now that it's safely backed up, delete it
$dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__); $dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__);
$ok = ( $dbw->affectedRows() != 0 ); // getArticleId() uses slave, could be laggy $ok = ( $dbw->affectedRows() > 0 ); // getArticleId() uses slave, could be laggy
if( !$ok ) { if( !$ok ) {
$dbw->rollback(); $dbw->rollback();
return false; return false;
@ -2349,6 +2349,7 @@ class Article {
array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ), array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ),
__METHOD__ ); __METHOD__ );
} }
$dbw->commit();
# Clear caches # Clear caches
Article::onArticleDelete( $this->mTitle ); Article::onArticleDelete( $this->mTitle );
@ -2360,13 +2361,9 @@ class Article {
# Log the deletion, if the page was suppressed, log it at Oversight instead # Log the deletion, if the page was suppressed, log it at Oversight instead
$logtype = $suppress ? 'suppress' : 'delete'; $logtype = $suppress ? 'suppress' : 'delete';
$log = new LogPage( $logtype ); $log = new LogPage( $logtype );
# Make sure logging got through # Make sure logging got through
$ok = $log->addEntry( 'delete', $this->mTitle, $reason, array() ); $log->addEntry( 'delete', $this->mTitle, $reason, array() );
if( !$ok ) {
$dbw->rollback();
return false;
}
$dbw->commit();
return true; return true;
} }

View file

@ -73,9 +73,8 @@ class LogPage {
$dbw->insert( 'logging', $data, $fname ); $dbw->insert( 'logging', $data, $fname );
$newId = $dbw->insertId(); $newId = $dbw->insertId();
$ok = ($dbw->affectedRows() > 0);
# And update recentchanges # And update recentchanges
if( $ok && $this->updateRecentChanges ) { if( $this->updateRecentChanges ) {
# Don't add private logs to RC! # Don't add private logs to RC!
if( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) { if( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
$titleObj = SpecialPage::getTitleFor( 'Log', $this->type ); $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
@ -83,10 +82,8 @@ class LogPage {
RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '', RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
$this->type, $this->action, $this->target, $this->comment, $this->params, $newId ); $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
} }
} else {
wfDebug( "LogPage::saveContent failed to insert row - Error {$dbw->lastErrno()}: {$dbw->lastError()}" );
} }
return $ok; return true;
} }
public function getRcComment() { public function getRcComment() {

View file

@ -349,14 +349,14 @@ class IPBlockForm {
$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName, $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
$this->BlockEmail); $this->BlockEmail);
if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) { if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
$dbw = wfGetDB( DB_MASTER );
$dbw->begin();
if ( !$block->insert() ) { if ( !$block->insert() ) {
$dbw->rollback(); // this could be commit as well; zero rows either way
return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress)); return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
} }
wfRunHooks('BlockIpComplete', array($block, $wgUser));
# Prepare log parameters # Prepare log parameters
$logParams = array(); $logParams = array();
$logParams[] = $expirestr; $logParams[] = $expirestr;
@ -365,19 +365,14 @@ class IPBlockForm {
# Make log entry, if the name is hidden, put it in the oversight log # Make log entry, if the name is hidden, put it in the oversight log
$log_type = ($this->BlockHideName) ? 'suppress' : 'block'; $log_type = ($this->BlockHideName) ? 'suppress' : 'block';
$log = new LogPage( $log_type ); $log = new LogPage( $log_type );
$ok = $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), $reasonstr, $logParams ); $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
# Make sure logging got through $reasonstr, $logParams );
if( !$ok ) {
$dbw->rollback();
return array('databaseerror');
}
$dbw->commit();
wfRunHooks('BlockIpComplete', array($block, $wgUser));
# Report to the user # Report to the user
return array(); return array();
} else {
return array('hookaborted');
} }
else
return array('hookaborted');
} }
/** /**