Ejemplo n.º 1
0
/**
 * Generate a cache of classes
 *
 * @return bool
 */
function doBuildCache()
{
    $result = true;
    x_install_log(xtr('Cache building...'));
    ob_start();
    try {
        define('DO_ONE_STEP_ONLY', true);
        \Includes\Decorator\Utils\CacheManager::rebuildCache();
    } catch (\Exception $e) {
        x_install_log('Exception: ' . $e->getMessage());
        $result = false;
    }
    $message = ob_get_contents();
    ob_end_clean();
    if (!$result) {
        x_install_log(xtr('Cache building procedure failed: :message', array(':message' => $e->getMessage())));
    }
    return $result;
}
Ejemplo n.º 2
0
define('LC_DIR_CACHE_IMAGES', LC_DIR_VAR . 'images' . LC_DS);
define('LC_DIR_SERVICE', LC_DIR_FILES . 'service' . LC_DS);
define('LC_OS_WINDOWS', 'WIN' === strtoupper(substr(PHP_OS, 0, 3)));
// Disabled xdebug coverage for Selenium-based tests [DEVELOPMENT PURPOSE]
if (isset($_COOKIE) && !empty($_COOKIE['no_xdebug_coverage']) && function_exists('xdebug_stop_code_coverage')) {
    @xdebug_stop_code_coverage();
}
// Autoloading routines
require_once LC_DIR_INCLUDES . 'Autoloader.php';
\Includes\Autoloader::registerAll();
// Fire the error if LC is not installed
if (!defined('XLITE_INSTALL_MODE')) {
    \Includes\ErrorHandler::checkIsLCInstalled();
}
// So called "developer" mode. Set it to "false" in production mode!
define('LC_DEVELOPER_MODE', (bool) \Includes\Utils\ConfigParser::getOptions(array('performance', 'developer_mode')));
// Correct error handling mode
ini_set('display_errors', LC_DEVELOPER_MODE);
// Fatal error and exception handlers
register_shutdown_function(array('\\Includes\\ErrorHandler', 'shutdown'));
set_exception_handler(array('\\Includes\\ErrorHandler', 'handleException'));
@umask(00);
require_once LC_DIR_INCLUDES . 'prepend.php';
// Safe mode
if (!defined('XLITE_INSTALL_MODE')) {
    \Includes\SafeMode::initialize();
}
// Check and (if needed) rebuild classes cache
if (!defined('LC_DO_NOT_REBUILD_CACHE')) {
    \Includes\Decorator\Utils\CacheManager::rebuildCache();
}