pohja/RunTask.php

17 lines
431 B
PHP
Raw Permalink Normal View History

2024-02-03 14:08:03 +01:00
<?php
require_once("Settings.php");
if (!isset($argv[1]) || empty($argv[1])) {
Logger::log("No task specified", Logger::ERROR, "RunTask");
exit(1);
}
$task = $argv[1] . "Task";
if (!file_exists(LIB_DIR . "/tasks/" . $task . ".php")) {
Logger::log("Task " . $task . " does not exist", Logger::ERROR, "RunTask");
exit(1);
}
require_once(LIB_DIR . "/tasks/" . $task . ".php");
$task = new $task();
$task->run();