From: Aaron Schulz Date: Fri, 26 Oct 2018 22:42:26 +0000 (-0700) Subject: Avoid using return value of IDatabase::insert() X-Git-Tag: 1.34.0-rc.0~3628^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=7ac86091e86a19761b2e859150eb282b02331410;p=lhc%2Fweb%2Fwiklou.git Avoid using return value of IDatabase::insert() Change-Id: I5992e4f03cd522b25607947291795d1da60d0291 --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 6219476282..c786ce827b 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -1699,13 +1699,9 @@ abstract class LoggedUpdateMaintenance extends Maintenance { return false; } - if ( $db->insert( 'updatelog', [ 'ul_key' => $key ], __METHOD__, 'IGNORE' ) ) { - return true; - } else { - $this->output( $this->updatelogFailedMessage() . "\n" ); + $db->insert( 'updatelog', [ 'ul_key' => $key ], __METHOD__, 'IGNORE' ); - return false; - } + return true; } /** @@ -1718,16 +1714,6 @@ abstract class LoggedUpdateMaintenance extends Maintenance { return "Update '{$key}' already logged as completed."; } - /** - * Message to show that the update log was unable to log the completion of this update - * @return string - */ - protected function updatelogFailedMessage() { - $key = $this->getUpdateKey(); - - return "Unable to log update '{$key}' as completed."; - } - /** * Do the actual work. All child classes will need to implement this. * Return true to log the update as done or false (usually on failure). diff --git a/maintenance/populateCategory.php b/maintenance/populateCategory.php index f2a00078e8..f07bc5526f 100644 --- a/maintenance/populateCategory.php +++ b/maintenance/populateCategory.php @@ -133,20 +133,14 @@ TEXT usleep( $throttle * 1000 ); } - if ( $dbw->insert( + $dbw->insert( 'updatelog', [ 'ul_key' => 'populate category' ], __METHOD__, 'IGNORE' - ) ) { - $this->output( "Category population complete.\n" ); - - return true; - } else { - $this->output( "Could not insert category population row.\n" ); + ); - return false; - } + return true; } }