Remove log debugging code, not needed anymore
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 27 Apr 2008 23:45:31 +0000 (23:45 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 27 Apr 2008 23:45:31 +0000 (23:45 +0000)
includes/Article.php
includes/LogPage.php
includes/SpecialBlockip.php

index 59d86d8..18be4da 100644 (file)
@@ -2318,7 +2318,7 @@ class Article {
 
                # 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;
@@ -2349,6 +2349,7 @@ class Article {
                                array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ),
                                __METHOD__ );
                }
+               $dbw->commit();
 
                # Clear caches
                Article::onArticleDelete( $this->mTitle );
@@ -2360,13 +2361,9 @@ class Article {
                # 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;
        }
index fe96845..66cb348 100644 (file)
@@ -73,9 +73,8 @@ class LogPage {
                $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 );
@@ -83,10 +82,8 @@ class LogPage {
                                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() {
index 4127579..61a2910 100644 (file)
@@ -349,14 +349,14 @@ class IPBlockForm {
                        $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;
@@ -365,19 +365,14 @@ class IPBlockForm {
                        # 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');
        }
 
        /**