From 7ac86091e86a19761b2e859150eb282b02331410 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 26 Oct 2018 15:42:26 -0700 Subject: [PATCH] Avoid using return value of IDatabase::insert() Change-Id: I5992e4f03cd522b25607947291795d1da60d0291 --- maintenance/Maintenance.php | 18 ++---------------- maintenance/populateCategory.php | 12 +++--------- 2 files changed, 5 insertions(+), 25 deletions(-) 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; } } -- 2.20.1