Exemplo n.º 1
0
function build_app_dir()
{
    // 没有创建项目目录的话自动创建
    if (!is_dir(APP_PATH)) {
        mkdir(APP_PATH, 0755, true);
    }
    if (is_writeable(APP_PATH)) {
        $dirs = array(COMMON_PATH, COMMON_PATH . 'Common/', COMMON_PATH . 'Conf/', APP_PATH . C('DEFAULT_MODULE') . '/', APP_PATH . C('DEFAULT_MODULE') . '/Common/', APP_PATH . C('DEFAULT_MODULE') . '/Controller/', APP_PATH . C('DEFAULT_MODULE') . '/Model/', APP_PATH . C('DEFAULT_MODULE') . '/Conf/', APP_PATH . C('DEFAULT_MODULE') . '/View/', RUNTIME_PATH, CACHE_PATH, LOG_PATH, TEMP_PATH, DATA_PATH);
        foreach ($dirs as $dir) {
            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        // 写入目录安全文件
        build_dir_secure($dirs);
        // 写入初始配置文件
        if (!is_file(COMMON_PATH . 'Conf/config.php')) {
            file_put_contents(COMMON_PATH . 'Conf/config.php', "<?php\nreturn array(\n\t//'配置项'=>'配置值'\n);");
        }
        // 写入测试Action
        build_first_action();
    } else {
        header('Content-Type:text/html; charset=utf-8');
        exit('项目目录不可写,目录无法自动生成!<BR>请使用项目生成器或者手动生成项目目录~');
    }
}
Exemplo n.º 2
0
function build_app_dir()
{
    // 没有创建项目目录的话自动创建
    if (!is_dir(APP_PATH)) {
        mkdir(APP_PATH, 0777, true);
    }
    if (is_writeable(APP_PATH)) {
        $dirs = array(LIB_PATH, RUNTIME_PATH, CONF_PATH, COMMON_PATH, LANG_PATH, CACHE_PATH, TMPL_PATH, TMPL_PATH . C('DEFAULT_THEME') . '/', LOG_PATH, TEMP_PATH, DATA_PATH, LIB_PATH . 'Model/', LIB_PATH . 'Action/', LIB_PATH . 'Behavior/', LIB_PATH . 'Widget/');
        foreach ($dirs as $dir) {
            if (!is_dir($dir)) {
                mkdir($dir, 0777, true);
            }
        }
        // 写入目录安全文件
        build_dir_secure($dirs);
        // 写入初始配置文件
        if (!is_file(CONF_PATH . 'config.php')) {
            file_put_contents(CONF_PATH . 'config.php', "<?php\nreturn array(\n\t//'配置项'=>'配置值'\n);\n?>");
        }
        // 写入测试Action
        if (!is_file(LIB_PATH . 'Action/IndexAction.class.php')) {
            build_first_action();
        }
    } else {
        exit('APP_PATH  not  writeable');
    }
}
Exemplo n.º 3
0
function build_app_dir()
{
    // 没有创建项目目录的话自动创建
    if (!is_dir(APP_PATH)) {
        mkdir(APP_PATH, 0755, true);
    }
    if (is_writeable(APP_PATH)) {
        $dirs = array(LIB_PATH, RUNTIME_PATH, CONF_PATH, COMMON_PATH, LANG_PATH, CACHE_PATH, TMPL_PATH, TMPL_PATH . C('DEFAULT_THEME') . '/', LOG_PATH, TEMP_PATH, DATA_PATH, LIB_PATH . 'Model/', LIB_PATH . 'Action/', LIB_PATH . 'Behavior/', LIB_PATH . 'Widget/');
        foreach ($dirs as $dir) {
            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        // 写入目录安全文件
        build_dir_secure($dirs);
        // 写入初始配置文件
        if (!is_file(CONF_PATH . 'config.php')) {
            file_put_contents(CONF_PATH . 'config.php', "<?php\nreturn array(\n\t//'配置项'=>'配置值'\n);\n?>");
        }
        // 写入测试Action
        if (!is_file(LIB_PATH . 'Action/IndexAction.class.php')) {
            build_first_action();
        }
    } else {
        header('Content-Type:text/html; charset=utf-8');
        exit('项目目录不可写,目录无法自动生成!<BR>请使用项目生成器或者手动生成项目目录~');
    }
}
Exemplo n.º 4
0
function build_app_dir()
{
    // Failed to create project directory is created automatically
    if (!is_dir(APP_PATH)) {
        mkdir(APP_PATH, 0755, true);
    }
    if (is_writeable(APP_PATH)) {
        $dirs = array(LIB_PATH, RUNTIME_PATH, CONF_PATH, COMMON_PATH, LANG_PATH, CACHE_PATH, TMPL_PATH, TMPL_PATH . C('DEFAULT_THEME') . '/', LOG_PATH, TEMP_PATH, DATA_PATH, LIB_PATH . 'Model/', LIB_PATH . 'Action/', LIB_PATH . 'Behavior/', LIB_PATH . 'Widget/');
        foreach ($dirs as $dir) {
            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        // Write to directory security file
        build_dir_secure($dirs);
        // Write the initial configuration file
        if (!is_file(CONF_PATH . 'config.php')) {
            file_put_contents(CONF_PATH . 'config.php', "<?php\nreturn array(\n\t//'Configuration item'=>'Configuration values'\n);\n?>");
        }
        // Written test Action
        if (!is_file(LIB_PATH . 'Action/IndexAction.class.php')) {
            build_first_action();
        }
    } else {
        header('Content-Type:text/html; charset=utf-8');
        exit('The project directory is not writable directory cannot be automatically generated!<BR>Please use the project Builder or manually generated list of projects~');
    }
}