/var/www/html/controller/class/controller/controller.php
if (file_exists('tmp/cache/config.php')) {
$ret = true;
}
}
return $ret;
}
}
private function _loadConfigFromCache() {
if ($this->getMemcached()) {
$memcacheD = new \Memcached();
if ($memcacheD->addServer($this->getMemcached()->host, $this->getMemcached()->port)) {
if ($memcacheD->get('controller_config_1') !== false and $memcacheD->get('controller_config_2') !== false) {
CONTROLLER\CONFIG::setClasses($memcacheD->get('controller_config_1'));
$this->_config = $memcacheD->get('controller_config_2');
return false;
}
}
} else {
$config = file('tmp/cache/config.php');
if (!is_array($config) or !isset($config[1])) {
if (file_exists('/tmp/cache/config.php')) {
unlink('/tmp/cache/config.php');
}
return false;
}
$decoded = urldecode($config[1]);
try {
$unserialized = unserialize($decoded);
CONTROLLER\CONFIG::setClasses($unserialized);
} catch (\Exception $e) {
if (file_exists('/tmp/cache/config.php')) {
unlink('/tmp/cache/config.php');
}
return false;
// \CO\SYSTEM\HTTP\HEADER::redirect('/');
}
try {
$this->_config = unserialize(urldecode($config[2]));
/var/www/html/controller/class/controller/controller.php
if (file_exists('tmp/cache/config.php')) {
$ret = true;
}
}
return $ret;
}
}
private function _loadConfigFromCache() {
if ($this->getMemcached()) {
$memcacheD = new \Memcached();
if ($memcacheD->addServer($this->getMemcached()->host, $this->getMemcached()->port)) {
if ($memcacheD->get('controller_config_1') !== false and $memcacheD->get('controller_config_2') !== false) {
CONTROLLER\CONFIG::setClasses($memcacheD->get('controller_config_1'));
$this->_config = $memcacheD->get('controller_config_2');
return false;
}
}
} else {
$config = file('tmp/cache/config.php');
if (!is_array($config) or !isset($config[1])) {
if (file_exists('/tmp/cache/config.php')) {
unlink('/tmp/cache/config.php');
}
return false;
}
$decoded = urldecode($config[1]);
try {
$unserialized = unserialize($decoded);
CONTROLLER\CONFIG::setClasses($unserialized);
} catch (\Exception $e) {
if (file_exists('/tmp/cache/config.php')) {
unlink('/tmp/cache/config.php');
}
return false;
// \CO\SYSTEM\HTTP\HEADER::redirect('/');
}
try {
$this->_config = unserialize(urldecode($config[2]));
/var/www/html/controller/class/controller/controller.php
spl_autoload_register(array($this, '_autoload'));
$this->_timer = new TIMER();
$this->_timer->add('CONTROLLER::init start');
// var_dump($this->_configLoadedFromCache());
if (php_sapi_name() !== 'cli') {
ERROR::init();
}
// if ($this->_useConfigCache()) {
// $this->_loadConfigFromCache();
// if (CONTROLLER::getInstance()
// ->getConfig() == NULL) {
// die("A rendszer nincs konfigurálva.");
// }
// } else {
// $this->_generateConfigFromConfigFile();
// $this->_storeConfigToCache();
// }
$sapi = php_sapi_name();
if ($this->_useConfigCache() and $sapi != 'cli') {
if ($this->_loadConfigFromCache() == false) {
$this->_generateConfigFromConfigFile();
$this->_storeConfigToCache();
}
// if (CONTROLLER::getInstance()
// ->getConfig() == NULL) {
// die("A rendszer nincs konfigurálva.");
// }
} else {
$this->_generateConfigFromConfigFile();
if ($sapi !== 'cli') {
$this->_storeConfigToCache();
}
}
RESPONSE::init();
REQUEST_HANDLER::init();
$this->_timer->add('CONTROLLER::init end');
$this->handleControllerOrModuleRedirects();
\CO\HELPER\POST::initByRawRequestBody();
}
/var/www/html/index.php
<?php
if (php_sapi_name() === 'cli') {
define('ARGV1', isset($argv[1]) ? $argv[1] : '');
}
define('TIMEZONE', 'Europe/Budapest');
require_once(__DIR__ .'/functions.php');
require_once(__DIR__ .'/controller/class/controller/controller.php');
$controller = new CO\SYSTEM\CONTROLLER();
//$controller->useMemcached('127.0.0.1', 11211);
$controller->init();
$controller->execute();
//ctodo angol / német