#!/usr/bin/env php * @license https://files.froxlor.org/misc/COPYING.txt GPLv2 */ use Froxlor\Froxlor; use Symfony\Component\Console\Application; // validate correct php version if (version_compare("7.4.0", PHP_VERSION, ">=")) { die('Froxlor requires at least php-7.4. Please validate that your php-cli version is suitable.'); } // ensure that default timezone is set if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) { @date_default_timezone_set(@date_default_timezone_get()); } require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/lib/tables.inc.php'; $application = new Application('froxlor-cli', Froxlor::getFullVersion()); // files that are no commands $fileIgnoreList = ['CliCommand.php', 'index.html', 'install.functions.php']; // directory of commands to include $cmd_files = glob(Froxlor::getInstallDir() . '/lib/Froxlor/Cli/*.php'); // include and add commands foreach ($cmd_files as $cmdFile) { // check ignore-list if (!in_array(basename($cmdFile), $fileIgnoreList)) { // include class-file require $cmdFile; // create class-name including namespace $cmdClass = "\\Froxlor\\Cli\\" . substr(basename($cmdFile), 0, -4); // check whether it exists if (class_exists($cmdClass)) { // add to cli application $application->add(new $cmdClass()); } } } $application->run();