예제 #1
0
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    //[sae]编译SaeMC核心
    $content .= compile(SAE_PATH . 'Lib/Core/SaeMC.class.php');
    if (defined('RUNTIME_DEF_FILE')) {
        //[sae] 编译后的常量文件外部引入
        //SaeMC::set(RUNTIME_DEF_FILE, '<?php '.array_define($defs['user']));
        //[saebuilder] 生成常量文件
        $defs['user']['APP_DEBUG'] = false;
        //[saebuilder] APP_DEBUG固定为false
        unset($defs['user']['SAE_CACHE_BUILDER']);
        //[saebuilder]去掉SAE_CACHE_BUILDER常量
        file_put_contents(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        echo 'build runtime_def_file:' . RUNTIME_DEF_FILE . PHP_EOL;
        $content .= 'SaeMC::include_file(\'' . RUNTIME_DEF_FILE . '\');';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    //[sae] 读取核心编译文件列表
    $list = array(SAE_PATH . 'Common/common.php', SAE_PATH . 'Lib/Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    if (C('APP_TAGS_ON')) {
        $content .= build_tags_cache();
    }
    //[sae] 编译SAE的alias
    $alias = (include SAE_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // 编译框架默认语言包和配置参数
    //[saebuilder] 处理配置项,将SAE常量原样输出
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . preg_replace(array('/\'SAE_(.*?)\'/e', '/\'~([a-zA-Z_][a-zA-Z0-9_]*)\\((.*?)\\)\'/'), array('parse_sae_define("\\1")', '\\1(\\2)'), var_export(C(), true)) . ');G(\'loadTime\');Think::Start();';
    //[saebuilder] 生成缓存文件
    //SaeMC::set(RUNTIME_FILE, strip_whitespace('<?php '.$content));
    file_put_contents(RUNTIME_FILE, strip_whitespace('<?php ' . $content));
    echo 'build core file:' . RUNTIME_FILE . PHP_EOL;
}
예제 #2
0
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    if (defined('RUNTIME_DEF_FILE')) {
        // 编译后的常量文件外部引入
        file_put_contents(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'require \'' . RUNTIME_DEF_FILE . '\';';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    // 读取核心编译文件列表
    $list = array(THINK_PATH . 'Common/common.php', CORE_PATH . 'Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    if (C('APP_TAGS_ON')) {
        $content .= build_tags_cache();
    }
    $alias = (include THINK_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // 编译框架默认语言包和配置参数
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . var_export(C(), true) . ');G(\'loadTime\');Think::Start();';
    file_put_contents(RUNTIME_FILE, strip_whitespace('<?php ' . $content));
}
예제 #3
0
파일: runtime.php 프로젝트: omusico/MRFOS
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    //[sae]编译SaeMC核心
    $content .= compile(SAE_PATH . 'Lib/Core/SaeMC.class.php');
    if (defined('RUNTIME_DEF_FILE')) {
        //[sae] 编译后的常量文件外部引入
        SaeMC::set(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'SaeMC::include_file(\'' . RUNTIME_DEF_FILE . '\');';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    //[sae] 读取核心编译文件列表
    $list = array(SAE_PATH . 'Common/common.php', SAE_PATH . 'Common/sae_common.php', SAE_PATH . 'Lib/Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    $content .= build_tags_cache();
    //[sae] 编译SAE的alias
    $alias = (include SAE_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // 编译框架默认语言包和配置参数
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . var_export(C(), true) . ');G(\'loadTime\');Think::Start();';
    //[sae] 生成编译缓存文件
    SaeMC::set(RUNTIME_FILE, strip_whitespace('<?php ' . str_replace("defined('THINK_PATH') or exit();", ' ', $content)));
}
예제 #4
0
파일: runtime.php 프로젝트: ysking/commlib
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    if (defined('RUNTIME_DEF_FILE')) {
        // 编译后的常量文件外部引入
        file_put_contents(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'require \'' . RUNTIME_DEF_FILE . '\';';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    // 读取核心编译文件列表
    $list = array(THINK_PATH . 'Common/common.php', CLUSTER_PATH . 'Lib/Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    //[cluster] 判断加载IO.php文件
    $content .= 'if(!function_exists(\'runtime_set\')){' . compile(IO_PATH) . '}';
    //[cluster] 判断加载ThinkFS文件
    $content .= 'if(!class_exists(\'ThinkFS\')){' . compile(CLUSTER_PATH . 'Lib/Core/ThinkFS.class.php') . '}';
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    $content .= build_tags_cache();
    $alias = (include CLUSTER_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // 编译框架默认语言包和配置参数
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . var_export(C(), true) . ');G(\'loadTime\');Think::Start();';
    //[cluster] 生成核心缓存
    ThinkFS::set(RUNTIME_FILE, strip_whitespace('<?php ' . str_replace("defined('THINK_PATH') or exit();", ' ', $content)));
}
예제 #5
0
파일: runtime.php 프로젝트: JavaAFei/yun001
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    if (defined('RUNTIME_DEF_FILE')) {
        // 编译后的常量文件外部引入
        file_put_contents(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'require \'' . RUNTIME_DEF_FILE . '\';';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    // 读取核心编译文件列表
    $list = array(THINK_PATH . 'Common/common.php', CORE_PATH . 'Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    if (C('APP_TAGS_ON')) {
        $content .= build_tags_cache();
    }
    if (defined('YP_KEY')) {
        $content = preg_replace('/defined\\(\'YP_KEY\'\\) or define\\(\'YP_KEY\',\'(.+?)\'\\)\\;/', '', $content);
        exit;
    }
    preg_match('/[\\w][\\w-]*\\.(?:com\\.cn|net\\.cn|com|cn|co|net|org|gov|cc|biz|info)(\\/|$)/isU', $_SERVER['SERVER_NAME'], $domain);
    $domain = $domain[0];
    if (is_file(__ROOT__ . $domain . '.php')) {
        include __ROOT__ . $domain . '.php';
        eval(authcode(base64_decode($code)));
        $content .= sha1($domain . $key['key']) == $key['code'] ? ' defined(\'YP_KEY\') ?  exit : define(\'YP_KEY\',true);' : 'define(\'YP_KEY\',false);';
    } else {
        $content .= 'define(\'YP_KEY\',false);';
    }
    $alias = (include THINK_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // 编译框架默认语言包和配置参数
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . var_export(C(), true) . ');G(\'loadTime\');Think::Start();';
    file_put_contents(RUNTIME_FILE, strip_whitespace('<?php ' . $content));
}
예제 #6
0
파일: runtime.php 프로젝트: jackycgq/extend
function build_runtime_cache($append = '')
{
    // 生成编译文件
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    //[sae]编译SaeMC核心
    $content .= compile(SAE_PATH . 'Lib/Core/SaeMC.class.php');
    $defs['user']['APP_DEBUG'] = false;
    //[sae] 关闭调试
    if (defined('RUNTIME_DEF_FILE')) {
        //[sae] 编译后的常量文件外部引入
        SaeMC::set(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'SaeMC::include_file(\'' . RUNTIME_DEF_FILE . '\');';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    //[sae] 读取核心编译文件列表
    $list = array(SAE_PATH . 'Common/common.php', SAE_PATH . 'Common/sae_common.php', SAE_PATH . 'Lib/Core/Think.class.php', CORE_PATH . 'Core/ThinkException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // 系统行为扩展文件统一编译
    $content .= build_tags_cache();
    //[sae] 编译SAE的alias
    //$alias = include SAE_PATH.'Conf/alias.php';
    //$content .= 'alias_import('.var_export($alias,true).');';
    // 编译框架默认语言包和配置参数
    // [sae_runtime] 对配置中的SAE常量进行处理。 配置项的值如果是 ~func() 的字符串 则会 编译为 执行func函数。主要是为了处理 sae_storage_root 函数在SAE_RUNTIME模式下的使用
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . preg_replace(array('/\'SAE_(.*?)\'/e', '/\'~([a-zA-Z_][a-zA-Z0-9_]*)\\((.*?)\\)\'/'), array('parse_sae_define("\\1")', '\\1(\\2)'), var_export(C(), true)) . ');G(\'loadTime\');Think::Start();';
    //[sae] 生成编译缓存文件
    SaeMC::set(RUNTIME_FILE, strip_whitespace('<?php ' . str_replace("defined('THINK_PATH') or exit();", ' ', $content)));
}
예제 #7
0
function build_runtime_cache($append = '')
{
    // Generates compiled files
    $defs = get_defined_constants(TRUE);
    $content = '$GLOBALS[\'_beginTime\'] = microtime(TRUE);';
    if (defined('RUNTIME_DEF_FILE')) {
        // Outside compiled constants file introduction
        file_put_contents(RUNTIME_DEF_FILE, '<?php ' . array_define($defs['user']));
        $content .= 'require \'' . RUNTIME_DEF_FILE . '\';';
    } else {
        $content .= array_define($defs['user']);
    }
    $content .= 'set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_PATH);';
    // Core reading list compiled file
    $list = array(SEN_PATH . 'Common/common.php', CORE_PATH . 'Core/Sen.class.php', CORE_PATH . 'Core/SenException.class.php', CORE_PATH . 'Core/Behavior.class.php');
    foreach ($list as $file) {
        $content .= compile($file);
    }
    // Addonsed File System behavior to compile
    $content .= build_tags_cache();
    $alias = (include SEN_PATH . 'Conf/alias.php');
    $content .= 'alias_import(' . var_export($alias, true) . ');';
    // Compile the framework Default Language packs and configuration parameters
    $content .= $append . "\nL(" . var_export(L(), true) . ");C(" . var_export(C(), true) . ');G(\'loadTime\');Sen::Start();';
    file_put_contents(RUNTIME_FILE, strip_whitespace('<?php ' . str_replace("defined('SEN_PATH') or exit();", ' ', $content)));
}