Example #1
0
function build_runtime()
{
    // 加载常量定义文件
    require CORE_PATH . '/sociax/defines.php';
    // 加载路径定义文件
    require CORE_PATH . '/sociax/paths.php';
    // 定义核心编译的文件
    $runtime[] = CORE_PATH . '/sociax/functions.php';
    // 系统函数
    $runtime[] = CORE_PATH . '/sociax/extend.php';
    // 扩展函数库
    if (version_compare(PHP_VERSION, '5.2.0', '<')) {
        // 加载兼容函数
        $runtime[] = THINK_PATH . '/Common/compat.php';
    }
    // 核心基类必须加载
    $runtime[] = THINK_PATH . '/Core/Think.class.php';
    // 读取核心编译文件列表
    if (is_file(CONFIG_PATH . 'core.php')) {
        // 加载项目自定义的核心编译文件列表
        $list = (include CONFIG_PATH . 'core.php');
    } else {
        // 加载核心编译文件
        $list = (include CORE_PATH . '/sociax/core.php');
    }
    $runtime = array_merge($runtime, $list);
    // 加载核心编译文件列表
    foreach ($runtime as $key => $file) {
        if (is_file($file)) {
            require $file;
        }
    }
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(RUNTIME_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } else {
        // 检查缓存目录
        check_runtime();
    }
    // 生成核心编译缓存 去掉文件空白以减少大小
    // ALL_IN_ONE模式时, NO_CACHE_RUNTIME无效
    if (!defined('NO_CACHE_RUNTIME')) {
        define('NO_CACHE_RUNTIME', false);
    }
    if (RUNTIME_ALLINONE || !NO_CACHE_RUNTIME) {
        $compile = RUNTIME_ALLINONE;
        $content = compile(CORE_PATH . '/sociax/defines.php', $compile);
        $content .= compile(CORE_PATH . '/sociax/paths.php', $compile);
        foreach ($runtime as $file) {
            $content .= compile($file, $compile);
        }
        if (defined('STRIP_RUNTIME_SPACE') && STRIP_RUNTIME_SPACE == false) {
            file_put_contents(RUNTIME_PATH . '/~runtime.php', '<?php' . $content);
        } else {
            file_put_contents(RUNTIME_PATH . '/~runtime.php', strip_whitespace('<?php' . $content));
        }
        unset($content);
    }
}
Example #2
0
function build_runtime()
{
    // 加载常量定义文件
    require THINK_PATH . '/Common/defines.php';
    // 加载路径定义文件
    require defined('PATH_DEFINE_FILE') ? PATH_DEFINE_FILE : THINK_PATH . '/Common/paths.php';
    // 定义核心编译的文件
    $runtime[] = THINK_PATH . '/Common/functions.php';
    // 系统函数
    if (version_compare(PHP_VERSION, '5.2.0', '<')) {
        // 加载兼容函数
        $runtime[] = THINK_PATH . '/Common/compat.php';
    }
    // 核心基类必须加载
    $runtime[] = THINK_PATH . '/Lib/Think/Core/Think.class.php';
    // 读取核心编译文件列表
    if (is_file(CONFIG_PATH . 'core.php')) {
        // 加载项目自定义的核心编译文件列表
        $list = (include CONFIG_PATH . 'core.php');
    } else {
        if (defined('THINK_MODE')) {
            // 根据设置的运行模式加载不同的核心编译文件
            $list = (include THINK_PATH . '/Mode/' . strtolower(THINK_MODE) . '.php');
        } else {
            // 默认核心
            $list = (include THINK_PATH . '/Common/core.php');
        }
    }
    $runtime = array_merge($runtime, $list);
    // 加载核心编译文件列表
    foreach ($runtime as $key => $file) {
        if (is_file($file)) {
            require $file;
        }
    }
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(RUNTIME_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } else {
        // 检查缓存目录
        check_runtime();
    }
    // 生成核心编译缓存 去掉文件空白以减少大小
    if (!defined('NO_CACHE_RUNTIME')) {
        echo "gggggg";
        $compile = defined('RUNTIME_ALLINONE');
        $content = compile(THINK_PATH . '/Common/defines.php', $compile);
        $content .= compile(defined('PATH_DEFINE_FILE') ? PATH_DEFINE_FILE : THINK_PATH . '/Common/paths.php', $compile);
        foreach ($runtime as $file) {
            $content .= compile($file, $compile);
        }
        if (defined('STRIP_RUNTIME_SPACE') && STRIP_RUNTIME_SPACE == false) {
            file_put_contents(RUNTIME_PATH . '~runtime.php', '<?php' . $content);
        } else {
            file_put_contents(RUNTIME_PATH . '~runtime.php', strip_whitespace('<?php' . $content));
        }
        unset($content);
    }
}
Example #3
0
function load_think_mode()
{
    // 加载常量定义文件
    require THINK_PATH . '/Common/defines.php';
    // 加载路径定义文件
    require defined('PATH_DEFINE_FILE') ? PATH_DEFINE_FILE : THINK_PATH . '/Common/paths.php';
    // 读取核心编译文件列表
    if (is_file(CONFIG_PATH . 'core.php')) {
        // 加载项目自定义的核心编译文件列表
        $list = (include CONFIG_PATH . 'core.php');
    } elseif (defined('THINK_MODE')) {
        // 根据设置的运行模式加载不同的核心编译文件
        $list = (include THINK_PATH . '/Mode/' . strtolower(THINK_MODE) . '.php');
    } else {
        // 默认核心
        $list = (include THINK_PATH . '/Common/core.php');
    }
    // 加载兼容函数
    if (version_compare(PHP_VERSION, '5.2.0', '<')) {
        $list[] = THINK_PATH . '/Common/compat.php';
    }
    // 加载模式文件列表
    foreach ($list as $key => $file) {
        if (is_file($file)) {
            require $file;
        }
    }
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(RUNTIME_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } else {
        // 检查缓存目录
        check_runtime();
    }
}
Example #4
0
function load_runtime_file()
{
    // 加载系统基础函数库
    require THINK_PATH . 'Common/common.php';
    // 读取核心编译文件列表
    $list = array(CORE_PATH . 'Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    // 加载模式文件列表
    foreach ($list as $key => $file) {
        if (is_file($file)) {
            require_cache($file);
        }
    }
    // 加载系统类库别名定义
    alias_import(include THINK_PATH . 'Conf/alias.php');
    // 检查项目目录结构 如果不存在则自动创建
    if (!is_dir(LIB_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } elseif (!is_dir(CACHE_PATH)) {
        // 检查缓存目录
        check_runtime();
    } elseif (APP_DEBUG) {
        // 调试模式切换删除编译缓存
        if (is_file(RUNTIME_FILE)) {
            unlink(RUNTIME_FILE);
        }
    }
}
Example #5
0
function load_runtime_file()
{
    //[sae] 加载系统基础函数库
    require SAE_PATH . 'Common/common.php';
    //[sae] 读取核心编译文件列表
    $list = array(SAE_PATH . 'Lib/Extend/Tool/SaeCacheBuilder/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    // 加载模式文件列表
    foreach ($list as $key => $file) {
        if (is_file($file)) {
            require_cache($file);
        }
    }
    //[sae] 加载系统类库别名定义
    alias_import(include SAE_PATH . 'Conf/alias.php');
    if (!is_dir(LIB_PATH)) {
        // 创建项目目录结构
        build_app_dir();
    } elseif (!is_dir(CACHE_PATH)) {
        // 检查缓存目录
        check_runtime();
    }
    //[saebuilder] 去掉了删除缓存的操作
}
Example #6
0
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <*****@*****.**>
// +----------------------------------------------------------------------
/**
 * ThinkPHP 目录创建和初始化
 */
defined('THINK_PATH') or exit;
// 检查项目目录结构 如果不存在则自动创建
if (!is_dir(COMMON_PATH)) {
    // 创建项目目录结构
    build_app_dir();
} elseif (!is_dir(LOG_PATH)) {
    // 检查缓存目录
    check_runtime();
}
// 检查缓存目录(Runtime) 如果不存在则自动创建
function check_runtime()
{
    if (!is_dir(RUNTIME_PATH)) {
        mkdir(RUNTIME_PATH);
    } elseif (!is_writeable(RUNTIME_PATH)) {
        header('Content-Type:text/html; charset=utf-8');
        exit('目录 [ ' . RUNTIME_PATH . ' ] 不可写!');
    }
    mkdir(CACHE_PATH);
    // 模板缓存目录
    if (!is_dir(LOG_PATH)) {
        mkdir(LOG_PATH);
    }
function load_runtime_file()
{
    // Loading SystemBasic function library
    require SEN_PATH . 'Common/common.php';
    // Read the core file list
    $list = array(CORE_PATH . 'Core/Sen.class.php', CORE_PATH . 'Core/SenException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    // Loading Mode file list
    foreach ($list as $key => $file) {
        if (is_file($file)) {
            require_cache($file);
        }
    }
    // System class library is loaded the alias definition
    alias_import(include SEN_PATH . 'Conf/alias.php');
    // Check the project directory structure If it does not exist it is created automatically
    if (!is_dir(LIB_PATH)) {
        // To create the project directory structure
        build_app_dir();
    } elseif (!is_dir(CACHE_PATH)) {
        // Checking cache directory
        check_runtime();
    } elseif (APP_DEBUG) {
        // Toggle Debugging Mode delete the compiler cache
        if (is_file(RUNTIME_FILE)) {
            unlink(RUNTIME_FILE);
        }
    }
}