There's a whole lot of shutdown code in doMaintenance.php that is
skipped when you use exit() directly. In HHVM by default, destructors
are not even called.
There are a few cases where maintenance scripts want to do something after
doMaintenance.php returns, so returning null should continue to mean no exit.
Change-Id: I0891e2ee3af7ef2c64c03b70edcf9e281ce1e7ba
/**
* Do the actual work. All child classes will need to implement this
+ *
+ * @return bool|null True for success, false for failure. Not returning
+ * a value, or returning null, is also interpreted as success. Returning
+ * false for failure will cause doMaintenance.php to exit the process
+ * with a non-zero exit status.
*/
abstract public function execute();
$maintenance->setAgentAndTriggers();
// Do the work
-$maintenance->execute();
+$success = $maintenance->execute();
// Potentially debug globals
$maintenance->globals();
$lbFactory->commitMasterChanges( 'doMaintenance' );
$lbFactory->shutdown( $lbFactory::SHUTDOWN_NO_CHRONPROT );
}
+
+// Exit with an error status if execute() returned false
+if ( $success === false ) {
+ exit( 1 );
+}