modifs.mineures sans commentaires
This commit is contained in:
parent
57759c2d51
commit
a257eeb478
|
@ -454,4 +454,8 @@ EOT);
|
|||
}
|
||||
|
||||
abstract function main();
|
||||
|
||||
static function runfile(): RunFile {
|
||||
return app::with(static::class)->getRunfile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ launcher="$MYTRUEDIR/$LAUNCHERPATH"
|
|||
class="$MYTRUEDIR${WRAPPEDPATH:+/$WRAPPEDPATH}/${MYNAME%.php}.phpc"
|
||||
script="$MYTRUEDIR${WRAPPEDPATH:+/$WRAPPEDPATH}/${MYNAME%.php}.php"
|
||||
|
||||
[ -f /g/init.env ] && source /g/init.env
|
||||
|
||||
www_data="${DEVUSER_USERENT%%:*}"
|
||||
[ -n "$www_data" ] || www_data=www-data
|
||||
|
||||
|
|
|
@ -30,25 +30,41 @@ class SqliteStorage extends CapacitorStorage {
|
|||
|
||||
protected function _afterCreate(CapacitorChannel $channel): void {
|
||||
$db = $this->db;
|
||||
$db->exec([
|
||||
"create table if not exists",
|
||||
"table" => "_channels",
|
||||
"cols" => [
|
||||
"name" => "varchar primary key",
|
||||
"table_name" => "varchar",
|
||||
"class" => "varchar",
|
||||
],
|
||||
$name = $this->db->get([
|
||||
"select name from sqlite_schema",
|
||||
"where" => ["name" => "_channels"],
|
||||
]);
|
||||
$db->exec([
|
||||
"insert",
|
||||
"into" => "_channels",
|
||||
"values" => [
|
||||
"name" => $channel->getName(),
|
||||
"table_name" => $channel->getTableName(),
|
||||
"class" => get_class($channel),
|
||||
],
|
||||
"suffix" => "on conflict do nothing",
|
||||
if ($name === null) {
|
||||
# ne pas créer si la table existe déjà, pour éviter d'avoir besoin d'un
|
||||
# verrou en écriture
|
||||
$db->exec([
|
||||
"create table if not exists",
|
||||
"table" => "_channels",
|
||||
"cols" => [
|
||||
"name" => "varchar primary key",
|
||||
"table_name" => "varchar",
|
||||
"class" => "varchar",
|
||||
],
|
||||
]);
|
||||
}
|
||||
$name = $this->db->get([
|
||||
"select name from _channels",
|
||||
"where" => ["name" => $channel->getName()],
|
||||
]);
|
||||
if ($name === null) {
|
||||
# ne pas insérer si la ligne existe déjà, pour éviter d'avoir besoin d'un
|
||||
# verrou en écriture
|
||||
$db->exec([
|
||||
"insert",
|
||||
"into" => "_channels",
|
||||
"values" => [
|
||||
"name" => $channel->getName(),
|
||||
"table_name" => $channel->getTableName(),
|
||||
"class" => get_class($channel),
|
||||
],
|
||||
"suffix" => "on conflict do nothing",
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function _beforeReset(CapacitorChannel $channel): void {
|
||||
|
|
|
@ -61,7 +61,8 @@ class BgLauncherApp extends Application {
|
|||
$runfile = app::with($appClass)->getRunfile();
|
||||
switch ($this->action) {
|
||||
case self::ACTION_START:
|
||||
$appClass::_manage_runfile(count($args), $args, $runfile);
|
||||
$argc = count($args);
|
||||
$appClass::_manage_runfile($argc, $args, $runfile);
|
||||
if ($runfile->warnIfLocked()) self::exit(app::EC_LOCKED);
|
||||
array_splice($args, 0, 0, [
|
||||
PHP_BINARY,
|
||||
|
|
|
@ -23,6 +23,9 @@ EOT,
|
|||
["-c", "--count", "args" => 1,
|
||||
"help" => "spécifier le nombre d'étapes",
|
||||
],
|
||||
["-f", "--force-enabled", "value" => true,
|
||||
"help" => "lancer la commande même si les tâches planifiées sont désactivées",
|
||||
],
|
||||
["-n", "--no-install-signal-handler", "value" => false,
|
||||
"help" => "ne pas installer le gestionnaire de signaux",
|
||||
],
|
||||
|
@ -30,9 +33,12 @@ EOT,
|
|||
|
||||
protected $count = 100;
|
||||
|
||||
protected bool $forceEnabled = false;
|
||||
|
||||
protected bool $installSignalHandler = true;
|
||||
|
||||
function main() {
|
||||
app::check_bgapplication_enabled($this->forceEnabled);
|
||||
if ($this->installSignalHandler) app::install_signal_handler();
|
||||
$count = intval($this->count);
|
||||
msg::info("Starting train for ".words::q($count, "step#s"));
|
||||
|
|
|
@ -374,4 +374,8 @@ EOT);
|
|||
}
|
||||
|
||||
abstract function main();
|
||||
|
||||
static function runfile(): RunFile {
|
||||
return app::with(static::class)->getRunfile();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue