# Now that it's safely backed up, delete it
$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 ) {
$dbw->rollback();
return false;
array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ),
__METHOD__ );
}
+ $dbw->commit();
# Clear caches
Article::onArticleDelete( $this->mTitle );
# Log the deletion, if the page was suppressed, log it at Oversight instead
$logtype = $suppress ? 'suppress' : 'delete';
$log = new LogPage( $logtype );
+
# Make sure logging got through
- $ok = $log->addEntry( 'delete', $this->mTitle, $reason, array() );
- if( !$ok ) {
- $dbw->rollback();
- return false;
- }
- $dbw->commit();
+ $log->addEntry( 'delete', $this->mTitle, $reason, array() );
return true;
}
$dbw->insert( 'logging', $data, $fname );
$newId = $dbw->insertId();
- $ok = ($dbw->affectedRows() > 0);
# And update recentchanges
- if( $ok && $this->updateRecentChanges ) {
+ if( $this->updateRecentChanges ) {
# Don't add private logs to RC!
if( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
$titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
$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() {
$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
$this->BlockEmail);
- if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
+ if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
+
if ( !$block->insert() ) {
- $dbw->rollback(); // this could be commit as well; zero rows either way
return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
}
+ wfRunHooks('BlockIpComplete', array($block, $wgUser));
+
# Prepare log parameters
$logParams = array();
$logParams[] = $expirestr;
# Make log entry, if the name is hidden, put it in the oversight log
$log_type = ($this->BlockHideName) ? 'suppress' : 'block';
$log = new LogPage( $log_type );
- $ok = $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), $reasonstr, $logParams );
- # Make sure logging got through
- if( !$ok ) {
- $dbw->rollback();
- return array('databaseerror');
- }
- $dbw->commit();
- wfRunHooks('BlockIpComplete', array($block, $wgUser));
+ $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
+ $reasonstr, $logParams );
+
# Report to the user
return array();
- } else {
- return array('hookaborted');
}
+ else
+ return array('hookaborted');
}
/**