Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/application.php
Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Line(s) | |||||
$vars = $system_config->getData(); | $vars = $system_config->getData(); | ||||
$db_class = isset($vars['Databases']) ? 'kDBLoadBalancer' : ($this->isDebugMode() ? 'kDBConnectionDebug' : 'kDBConnection'); | $db_class = isset($vars['Databases']) ? 'kDBLoadBalancer' : ($this->isDebugMode() ? 'kDBConnectionDebug' : 'kDBConnection'); | ||||
$this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array ($this->_logger, 'handleSQLError'))); | $this->Conn = $this->Factory->makeClass($db_class, Array (SQL_TYPE, Array ($this->_logger, 'handleSQLError'))); | ||||
$this->Conn->setup($vars); | $this->Conn->setup($vars); | ||||
$this->cacheManager = $this->makeClass('kCacheManager'); | $this->cacheManager = $this->makeClass('kCacheManager'); | ||||
$this->cacheManager->InitCache(); | $this->cacheManager->InitCache(); | ||||
define('MAX_UPLOAD_SIZE', $this->getMaxUploadSize()); | |||||
if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | if ( defined('DEBUG_MODE') && $this->isDebugMode() ) { | ||||
$this->Debugger->appendTimestamp('Before UnitConfigReader'); | $this->Debugger->appendTimestamp('Before UnitConfigReader'); | ||||
} | } | ||||
// init config reader and all managers | // init config reader and all managers | ||||
$this->UnitConfigReader = $this->makeClass('kUnitConfigReader'); | $this->UnitConfigReader = $this->makeClass('kUnitConfigReader'); | ||||
$this->UnitConfigReader->scanModules(MODULES_PATH); // will also set RewriteListeners when existing cache is read | $this->UnitConfigReader->scanModules(MODULES_PATH); // will also set RewriteListeners when existing cache is read | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
// User can't edit anything in Admin Console or in CLI mode. | // User can't edit anything in Admin Console or in CLI mode. | ||||
kUtil::safeDefine('EDITING_MODE', ''); | kUtil::safeDefine('EDITING_MODE', ''); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Calculates maximal upload file size | |||||
* | |||||
* @return integer | |||||
*/ | |||||
protected function getMaxUploadSize() | |||||
{ | |||||
$cache_key = 'max_upload_size'; | |||||
$max_upload_size = $this->getCache($cache_key); | |||||
if ( $max_upload_size === false ) { | |||||
$max_upload_size = kUtil::parseIniSize(ini_get('upload_max_filesize')); | |||||
$post_max_size = ini_get('post_max_size'); | |||||
if ( $post_max_size !== '0' ) { | |||||
$max_upload_size = min($max_upload_size, kUtil::parseIniSize($post_max_size)); | |||||
} | |||||
$memory_limit = ini_get('memory_limit'); | |||||
if ( $memory_limit !== '-1' ) { | |||||
$max_upload_size = min($max_upload_size, kUtil::parseIniSize($memory_limit)); | |||||
} | |||||
$this->setCache($cache_key, $max_upload_size); | |||||
} | |||||
return $max_upload_size; | |||||
} | |||||
/** | |||||
* Performs initialization of manager classes, that can be overridden from unit configs | * Performs initialization of manager classes, that can be overridden from unit configs | ||||
* | * | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
* @throws Exception | * @throws Exception | ||||
*/ | */ | ||||
public function InitManagers() | public function InitManagers() | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 2702 Lines • Show Last 20 Lines |