30 parent::__construct();
31 $this->
addOption(
'force',
'Run the update even if it was completed already' );
38 $queryBuilder = $db->newSelectQueryBuilder()
41 ->where( [
'ul_key' => $key ] );
44 && $queryBuilder->caller( __METHOD__ )->fetchRow()
55 $db->newInsertQueryBuilder()
56 ->insertInto(
'updatelog' )
58 ->row( [
'ul_key' => $key ] )
59 ->caller( __METHOD__ )->execute();
79 return "Update '{$key}' already logged as completed. Use --force to run it again.";
97class_alias( LoggedUpdateMaintenance::class,
'LoggedUpdateMaintenance' );
Class for scripts that perform database maintenance and want to log the update in updatelog so we can...
__construct()
Default constructor.
execute()
Do the actual work.
setForce( $forced=true)
Sets whether a run of this maintenance script has the force parameter set.
updateSkippedMessage()
Message to show that the update was done already and was just skipped.
getUpdateKey()
Get the update key name to go in the update log table.
doDBUpdates()
Do the actual work.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
hasOption( $name)
Checks to see if a particular option was set.
setOption(string $name, $value)
Programmatically set the value of the given option.