X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FMaintenance.php;h=b638b42dff5679720bb44c2a296c1231726c340b;hb=44eecdda93a4b4a719d3780e1007790f7fc6c58a;hp=6219476282405b6d7e4be7a3b9c2daad9421bd62;hpb=7c4b637cca308651cb98d40b2bd7dca187160e81;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 6219476282..b638b42dff 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -23,7 +23,7 @@ // Bail on old versions of PHP, or if composer has not been run yet to install // dependencies. require_once __DIR__ . '/../includes/PHPVersionCheck.php'; -wfEntryPointCheck( 'cli' ); +wfEntryPointCheck( 'text' ); use MediaWiki\Shell\Shell; @@ -1251,7 +1251,7 @@ abstract class Maintenance { $settingsFile = "$IP/LocalSettings.php"; } if ( isset( $this->mOptions['wiki'] ) ) { - $bits = explode( '-', $this->mOptions['wiki'] ); + $bits = explode( '-', $this->mOptions['wiki'], 2 ); if ( count( $bits ) == 1 ) { $bits[] = ''; } @@ -1326,7 +1326,6 @@ abstract class Maintenance { $this->output( "done.\n" ); } - # Done $this->commitTransaction( $dbw, __METHOD__ ); } @@ -1349,11 +1348,10 @@ abstract class Maintenance { * @return IMaintainableDatabase */ protected function getDB( $db, $groups = [], $wiki = false ) { - if ( is_null( $this->mDb ) ) { + if ( $this->mDb === null ) { return wfGetDB( $db, $groups, $wiki ); - } else { - return $this->mDb; } + return $this->mDb; } /** @@ -1699,13 +1697,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 +1712,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).