Merge "Revert "RCFilters: Use `display: flex` for better responsiveness on narrow...
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index 6377734..e76426d 100644 (file)
 // 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;
-use Wikimedia\Rdbms\DBReplicationWaitError;
 
 /**
  * @defgroup MaintenanceArchive Maintenance archives
@@ -1393,17 +1392,12 @@ abstract class Maintenance {
         */
        protected function commitTransaction( IDatabase $dbw, $fname ) {
                $dbw->commit( $fname );
-               try {
-                       $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-                       $lbFactory->waitForReplication(
-                               [ 'timeout' => 30, 'ifWritesSince' => $this->lastReplicationWait ]
-                       );
-                       $this->lastReplicationWait = microtime( true );
-
-                       return true;
-               } catch ( DBReplicationWaitError $e ) {
-                       return false;
-               }
+               $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+               $waitSucceeded = $lbFactory->waitForReplication(
+                       [ 'timeout' => 30, 'ifWritesSince' => $this->lastReplicationWait ]
+               );
+               $this->lastReplicationWait = microtime( true );
+               return $waitSucceeded;
        }
 
        /**
@@ -1675,7 +1669,6 @@ class FakeMaintenance extends Maintenance {
        protected $mSelf = "FakeMaintenanceScript";
 
        public function execute() {
-               return;
        }
 }
 
@@ -1706,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;
        }
 
        /**
@@ -1725,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).