setup(); $maintenance->finalSetup(); $maintenance->validateParamsAndArgs(); // Do the work try { $success = $maintenance->execute(); } catch ( Exception $ex ) { $success = false; while ( $ex ) { $cls = get_class( $ex ); print "$cls from line {$ex->getLine()} of {$ex->getFile()}: {$ex->getMessage()}\n"; print $ex->getTraceAsString() . "\n"; $ex = $ex->getPrevious(); } } // Exit with an error status if execute() returned false if ( $success === false ) { exit( 1 ); }