| #0 | Phalcon\Assets\Manager->__construct /var/www/html/johngold.net/src/app/Lib/Factory.php (126) <?php
namespace CLSystems\PhalCMS\Lib;
use Phalcon\Support\Debug;
use Phalcon\Mvc\Url;
use Phalcon\Config\Adapter\Ini;
use Phalcon\Di\FactoryDefault;
use Phalcon\Session\Manager;
use Phalcon\Session\Adapter\Stream;
use Phalcon\Session\Bag;
use Phalcon\Db\Adapter\Pdo\Mysql;
use CLSystems\PhalCMS\Lib\Helper\Asset;
use CLSystems\PhalCMS\Lib\Helper\Config;
use CLSystems\PhalCMS\Lib\Helper\Event;
use CLSystems\PhalCMS\Lib\Helper\Language;
use CLSystems\PhalCMS\Lib\Mvc\View\ViewBase;
use CLSystems\Php\Registry;
use Exception;
if (!function_exists('debugVar'))
{
function debugVar($var)
{
(new Debug)
->debugVar($var)
->listen(true, true)
->halt();
}
}
class Factory
{
/** @var Registry $config */
protected static $config;
/** @var CmsApplication $application */
protected static $application;
protected static function loadConfig()
{
if (!is_file(BASE_PATH . '/src/config.ini')) {
if (is_file(BASE_PATH . '/public/install.php')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
$protocol .= 's';
}
header('location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . '/install.php');
} else {
die('The config INI file not found at ' . BASE_PATH . '/src/config.ini');
}
}
require_once BASE_PATH . '/src/app/Config/Define.php';
require_once BASE_PATH . '/src/app/Config/Loader.php';
require_once BASE_PATH . '/vendor/autoload.php';
return new Ini(BASE_PATH . '/src/config.ini', INI_SCANNER_NORMAL);
}
public static function getApplication()
{
if (!isset(self::$application)) {
$config = self::loadConfig();
$dbPrefix = $config->path('DB.PREFIX');
try {
$db = new Mysql(
[
'host' => $config->path('DB.HOST'),
'username' => $config->path('DB.USER'),
'password' => $config->path('DB.PASS'),
'dbname' => $config->path('DB.NAME'),
'charset' => 'utf8mb4',
]
);
} catch (Exception $e) {
die($e->getMessage());
}
$registry = new Registry(
[
'siteTemplate' => $config->path('APP.TEMPLATE') ?? 'PhalCMS',
'core' => [
'plugins' => [
'CLSystems\\PhalCMS\\Plugin\\System\\Cms\\Cms',
],
'widgets' => [
'CLSystems\\PhalCMS\\Widget\\Code\\Code',
'CLSystems\\PhalCMS\\Widget\\Content\\Content',
'CLSystems\\PhalCMS\\Widget\\FlashNews\\FlashNews',
'CLSystems\\PhalCMS\\Widget\\LanguageSwitcher\\LanguageSwitcher',
'CLSystems\\PhalCMS\\Widget\\Login\\Login',
'CLSystems\\PhalCMS\\Widget\\Menu\\Menu',
],
],
]
);
if ($extraConfig = $db->fetchColumn('SELECT data FROM ' . $dbPrefix . 'config_data WHERE context = \'cms.config\'')) {
$registry->merge($extraConfig);
}
define('ADMIN_URI_PREFIX', $registry->get('adminPrefix', 'admin'));
define('DEVELOPMENT_MODE', $registry->get('development', 'Y') === 'Y');
Config::setDataContext('cms.config', $registry);
if (true === DEVELOPMENT_MODE) {
ini_set('display_errors', true);
error_reporting(E_ALL);
if (!defined('TEST_PHPUNIT_MODE')) {
(new Debug())->listen(true, false);
}
}
// Create DI Factory Default
$di = new FactoryDefault;
// Set URL service before to use debug
$di->setShared('url', new Url);
$di->setShared('config', $config);
$di->setShared('assets', new Asset);
$di->getShared('modelsManager')->setModelPrefix($dbPrefix);
$di->setShared('db', $db);
$di->getShared('flashSession')
->setAutoescape(false)
->setCssClasses(
[
'error' => 'uk-alert uk-alert-danger',
'success' => 'uk-alert uk-alert-success',
'notice' => 'uk-alert uk-alert-warning',
'warning' => 'uk-alert uk-alert-warning',
]
);
$di->setShared('session', function () {
$session = new Manager;
$session->setAdapter(new Stream);
$session->start();
return $session;
});
$di->setShared('sessionBag', function () {
return new Bag('controller.persistent');
});
$di->setShared('router', function () {
$router = include CONFIG_PATH . '/Router.php';
Event::trigger('onBeforeServiceSetRouter', [$router], ['System', 'Cms']);
return $router;
});
// API services
$di->setShared('apiKeyGuard', function () {
return new \CLSystems\PhalCMS\Lib\Api\Middleware\ApiKeyGuard();
});
$di->getShared('crypt')
->setCipher('aes-256-ctr')
->setKey($config->path('SECRET.CRYPT_KEY'));
$di->getShared('dispatcher')
->setEventsManager($di->getShared('eventsManager'));
$di->setShared('view', ViewBase::getInstance($di));
// Initialise config data
self::$config = new Registry($config->toArray());
// Initialise application
self::$application = new CmsApplication($di);
// Initialise languages
Language::initialise();
}
return self::$application;
}
public static function getConfig()
{
return self::$config;
}
public static function getService($name, $parameters = null)
{
$di = self::getApplication()->getDI();
switch ($name) {
case 'url':
case 'view':
case 'db':
case 'modelsMetadata':
case 'modelsManager':
case 'session':
case 'flashSession':
case 'cookies':
case 'security':
case 'dispatcher':
case 'router':
case 'filter':
case 'crypt':
case 'request':
case 'response':
return $di->getShared($name, $parameters);
}
return $di->get($name, $parameters);
}
}
|
| #1 | CLSystems\PhalCMS\Lib\Factory::getApplication /var/www/html/johngold.net/public/index.php (14) <?php
declare(strict_types=1);
error_reporting(E_ALL);
ini_set('display_errors', 'true');
use CLSystems\PhalCMS\Lib\Factory;
define('BASE_PATH', dirname(__DIR__));
require_once BASE_PATH . '/src/app/Lib/Factory.php';
// Execute application
Factory::getApplication()->execute(); |
| Key | Value |
|---|---|
| _url | /sitemap/1 |
| Key | Value |
|---|---|
| PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| TEMP | /var/www/clients/client1/web19/tmp |
| TMPDIR | /var/www/clients/client1/web19/tmp |
| TMP | /var/www/clients/client1/web19/tmp |
| HOSTNAME | |
| USER | web19 |
| HOME | /var/www/clients/client1/web19 |
| SCRIPT_NAME | /index.php |
| REQUEST_URI | /sitemap/1 |
| QUERY_STRING | _url=/sitemap/1 |
| REQUEST_METHOD | GET |
| SERVER_PROTOCOL | HTTP/1.1 |
| GATEWAY_INTERFACE | CGI/1.1 |
| REDIRECT_QUERY_STRING | _url=/sitemap/1 |
| REDIRECT_URL | /sitemap/1 |
| REMOTE_PORT | 64780 |
| SCRIPT_FILENAME | /var/www/clients/client1/web19/web/index.php |
| SERVER_ADMIN | webmaster@johngold.net |
| CONTEXT_DOCUMENT_ROOT | /var/www/clients/client1/web19/web |
| CONTEXT_PREFIX | |
| REQUEST_SCHEME | https |
| DOCUMENT_ROOT | /var/www/clients/client1/web19/web |
| REMOTE_ADDR | 216.73.216.84 |
| SERVER_PORT | 443 |
| SERVER_ADDR | 178.18.244.9 |
| SERVER_NAME | johngold.net |
| SERVER_SOFTWARE | Apache |
| SERVER_SIGNATURE | |
| HTTP_HOST | johngold.net |
| HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
| HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
| HTTP_ACCEPT | */* |
| proxy-nokeepalive | 1 |
| SSL_TLS_SNI | johngold.net |
| HTTPS | on |
| REDIRECT_STATUS | 200 |
| REDIRECT_SSL_TLS_SNI | johngold.net |
| REDIRECT_HTTPS | on |
| FCGI_ROLE | RESPONDER |
| PHP_SELF | /index.php |
| REQUEST_TIME_FLOAT | 1763846808.2928 |
| REQUEST_TIME | 1763846808 |
| # | Path |
|---|---|
| 0 | /var/www/html/johngold.net/public/index.php |
| 1 | /var/www/html/johngold.net/src/app/Lib/Factory.php |
| 2 | /var/www/html/johngold.net/src/app/Config/Define.php |
| 3 | /var/www/html/johngold.net/src/app/Config/Loader.php |
| 4 | /var/www/html/johngold.net/vendor/autoload.php |
| 5 | /var/www/html/johngold.net/vendor/composer/autoload_real.php |
| 6 | /var/www/html/johngold.net/vendor/composer/platform_check.php |
| 7 | /var/www/html/johngold.net/vendor/composer/ClassLoader.php |
| 8 | /var/www/html/johngold.net/vendor/composer/autoload_static.php |
| 9 | /var/www/html/johngold.net/vendor/ralouphie/getallheaders/src/getallheaders.php |
| 10 | /var/www/html/johngold.net/vendor/symfony/deprecation-contracts/function.php |
| 11 | /var/www/html/johngold.net/vendor/guzzlehttp/guzzle/src/functions_include.php |
| 12 | /var/www/html/johngold.net/vendor/guzzlehttp/guzzle/src/functions.php |
| 13 | /var/www/html/johngold.net/vendor/symfony/polyfill-ctype/bootstrap.php |
| 14 | /var/www/html/johngold.net/vendor/symfony/polyfill-ctype/bootstrap80.php |
| 15 | /var/www/html/johngold.net/vendor/google/apiclient-services/autoload.php |
| 16 | /var/www/html/johngold.net/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php |
| 17 | /var/www/html/johngold.net/vendor/symfony/polyfill-iconv/bootstrap.php |
| 18 | /var/www/html/johngold.net/vendor/symfony/polyfill-intl-grapheme/bootstrap.php |
| 19 | /var/www/html/johngold.net/vendor/symfony/polyfill-intl-grapheme/bootstrap80.php |
| 20 | /var/www/html/johngold.net/vendor/symfony/polyfill-intl-normalizer/bootstrap.php |
| 21 | /var/www/html/johngold.net/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php |
| 22 | /var/www/html/johngold.net/vendor/symfony/polyfill-mbstring/bootstrap.php |
| 23 | /var/www/html/johngold.net/vendor/symfony/polyfill-mbstring/bootstrap80.php |
| 24 | /var/www/html/johngold.net/vendor/google/apiclient/src/aliases.php |
| 25 | /var/www/html/johngold.net/vendor/google/apiclient/src/Client.php |
| 26 | /var/www/html/johngold.net/vendor/google/apiclient/src/Service.php |
| 27 | /var/www/html/johngold.net/vendor/google/apiclient/src/AccessToken/Revoke.php |
| 28 | /var/www/html/johngold.net/vendor/google/apiclient/src/AccessToken/Verify.php |
| 29 | /var/www/html/johngold.net/vendor/google/apiclient/src/Model.php |
| 30 | /var/www/html/johngold.net/vendor/google/apiclient/src/Utils/UriTemplate.php |
| 31 | /var/www/html/johngold.net/vendor/google/apiclient/src/AuthHandler/Guzzle6AuthHandler.php |
| 32 | /var/www/html/johngold.net/vendor/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php |
| 33 | /var/www/html/johngold.net/vendor/google/apiclient/src/AuthHandler/AuthHandlerFactory.php |
| 34 | /var/www/html/johngold.net/vendor/google/apiclient/src/Http/Batch.php |
| 35 | /var/www/html/johngold.net/vendor/google/apiclient/src/Http/MediaFileUpload.php |
| 36 | /var/www/html/johngold.net/vendor/google/apiclient/src/Http/REST.php |
| 37 | /var/www/html/johngold.net/vendor/google/apiclient/src/Task/Retryable.php |
| 38 | /var/www/html/johngold.net/vendor/google/apiclient/src/Task/Exception.php |
| 39 | /var/www/html/johngold.net/vendor/google/apiclient/src/Exception.php |
| 40 | /var/www/html/johngold.net/vendor/google/apiclient/src/Task/Runner.php |
| 41 | /var/www/html/johngold.net/vendor/google/apiclient/src/Collection.php |
| 42 | /var/www/html/johngold.net/vendor/google/apiclient/src/Service/Exception.php |
| 43 | /var/www/html/johngold.net/vendor/google/apiclient/src/Service/Resource.php |
| 44 | /var/www/html/johngold.net/vendor/google/apiclient/src/Task/Composer.php |
| 45 | /var/www/html/johngold.net/vendor/voku/portable-utf8/bootstrap.php |
| 46 | /var/www/html/johngold.net/vendor/voku/portable-utf8/src/voku/helper/Bootup.php |
| 47 | /var/www/html/johngold.net/vendor/voku/portable-utf8/src/voku/helper/UTF8.php |
| 48 | /var/www/html/johngold.net/vendor/clsystems/php-registry/src/Registry.php |
| 49 | /var/www/html/johngold.net/src/app/Lib/Helper/Config.php |
| 50 | /var/www/html/johngold.net/src/app/Lib/Helper/Asset.php |
| Memory | |
|---|---|
| Usage | 2097152 |