seeddms-code/utils/console
2025-11-16 15:50:49 +01:00

74 lines
3.3 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
ini_set('include_path', __DIR__.'/../' . PATH_SEPARATOR . ini_get('include_path'));
ini_set('include_path', __DIR__.'/../../' . PATH_SEPARATOR . ini_get('include_path'));
require 'vendor/autoload.php';
require_once('Log.php');
require_once('inc/inc.Utils.php');
use Symfony\Component\Console\Application;
use Seeddms\Console\Commands\StatsCommand;
use Seeddms\Console\Commands\AddfolderCommand;
use Seeddms\Console\Commands\AdddocumentCommand;
use Seeddms\Console\Commands\DeleteCommand;
use Seeddms\Console\Commands\ClearcacheCommand;
use Seeddms\Console\Commands\ListcacheCommand;
use Seeddms\Console\Commands\ListextensionCommand;
use Seeddms\Console\Commands\ConfigureextensionCommand;
use Seeddms\Console\Commands\UploadextensionCommand;
use Seeddms\Console\Commands\PackageextensionCommand;
use Seeddms\Console\Commands\ReloadextensionCommand;
use Seeddms\Console\Commands\CheckextensionCommand;
use Seeddms\Console\Commands\RepositoryextensionCommand;
use Seeddms\Console\Commands\UpdateextensionCommand;
use Seeddms\Console\Commands\DownloadextensionCommand;
use Seeddms\Seeddms\Settings;
use Seeddms\Seeddms\Translator;
/* Check if configuration is at regular place. Otherwise set
* SEEDDMS_CONFIG_FILE in your shell.
*/
if (file_exists(__DIR__.'/../../conf/settings.xml'))
$settings = new Settings(__DIR__.'/../../conf/settings.xml');
else
$settings = new Settings();
/* For now includce inc.Language.php, because it defines the old
* translation functions (e.g. getMLText()), which are still used
* by many extensions.
*/
require_once('inc/inc.Language.php');
//$translator = new Translator($settings);
//$translator->init();
$logger = getLogger($settings, 'console-');
require_once('inc/inc.Extension.php');
$application = new Application();
$application->add(new StatsCommand($settings, $logger, $translator));
$application->add(new AddfolderCommand($settings, $logger, $translator));
$application->add(new AdddocumentCommand($settings, $logger, $translator, $extmgr));
$application->add(new DeleteCommand($settings, $logger, $translator));
$application->add(new ClearcacheCommand($settings, $logger, $translator));
$application->add(new ListcacheCommand($settings, $logger, $translator));
$application->add(new ListextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new ConfigureextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new UploadextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new PackageextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new ReloadextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new CheckextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new RepositoryextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new UpdateextensionCommand($settings, $logger, $translator, $extmgr));
$application->add(new DownloadextensionCommand($settings, $logger, $translator, $extmgr));
if(isset($GLOBALS['SEEDDMS_HOOKS']['console'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['console'] as $hookObj) {
if (method_exists($hookObj, 'addCommand')) {
$hookObj->addCommand($application, ['settings'=>$settings, 'logger'=>$logger, 'translator'=>$translator, 'extmgr'=>$extmgr]);
}
}
}
$application->run();