当前位置: 首页>>代码示例>>PHP>>正文


PHP install_generate_configphp函数代码示例

本文整理汇总了PHP中install_generate_configphp函数的典型用法代码示例。如果您正苦于以下问题:PHP install_generate_configphp函数的具体用法?PHP install_generate_configphp怎么用?PHP install_generate_configphp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了install_generate_configphp函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stdClass

require_once 'lib/installlib.php';
$CFG = new stdClass();
$CFG->wwwroot = install_guess_wwwroot();
$CFG->dirroot = dirname(__FILE__);
$CFG->dirlang = dirname(__FILE__) . '/lang/';
if (!empty($_POST['submit'])) {
    if (!empty($_POST['dbhost']) && !empty($_POST['dbname']) && !empty($_POST['dbuser'])) {
        $dbconfig = new stdClass();
        $dbconfig->dbhost = trim($_POST['dbhost']);
        $dbconfig->dbname = trim($_POST['dbname']);
        $dbconfig->dbuser = trim($_POST['dbuser']);
        $dbconfig->dbpass = trim($_POST['dbpass']);
        $cfg = new stdClass();
        $cfg->wwwroot = trim($CFG->wwwroot);
        $cfg->dirroot = trim($CFG->dirroot);
        $writeconfigphp = install_generate_configphp($dbconfig, $cfg);
        if ($writeconfigphp) {
            $writeconfigdb = create_dbconfig_table();
            if ($writeconfigdb) {
                header('Location: ' . $cfg->wwwroot);
                die;
            }
        }
    } else {
        $error_msg = 'Tous les champs requis ne sont pas remplis !';
    }
}
?>

<h2><?php 
echo get_string('welcome_install');
开发者ID:Raxine,项目名称:lightning,代码行数:31,代码来源:install.php

示例2: distro_pre_create_db



if ($config->stage == INSTALL_SAVE) {
    $CFG->early_install_lang = false;

    $database = moodle_database::get_driver_instance($config->dbtype, 'native');
    if (!$database->driver_installed()) {
        $config->stage = INSTALL_DATABASETYPE;
    } else {
        if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation
            $distro = distro_pre_create_db($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbport'=>$config->dbport, 'dbsocket'=>$config->dbsocket), $distro);
        }
        $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbport'=>$config->dbport, 'dbsocket'=>$config->dbsocket));

        if ($hint_database === '') {
            $configphp = install_generate_configphp($database, $CFG);

            umask(0137);
            if (($fh = @fopen($configfile, 'w')) !== false) {
                fwrite($fh, $configphp);
                fclose($fh);
            }

            if (file_exists($configfile)) {
                // config created, let's continue!
                redirect("$CFG->wwwroot/$config->admin/index.php?lang=$config->lang");
            }

            install_print_header($config, 'config.php',
                                          get_string('configurationcompletehead', 'install'),
                                          get_string('configurationcompletesub', 'install').get_string('configfilenotwritten', 'install'));
开发者ID:rwijaya,项目名称:moodle,代码行数:29,代码来源:install.php

示例3: distro_pre_create_db

     $config->stage = INSTALL_DATABASETYPE;
 } else {
     if (function_exists('distro_pre_create_db')) {
         // Hook for distros needing to do something before DB creation
         $distro = distro_pre_create_db($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersit' => 0, 'dbsocket' => $config->dbsocket), $distro);
     }
     $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersit' => 0, 'dbsocket' => $config->dbsocket));
     if ($hint_database === '') {
         // extra hackery needed for symbolic link support
         if ($CFG->dirroot !== $config->dirroot) {
             $CFG->dirroot = $config->dirroot;
             $userealpath = true;
         } else {
             $userealpath = false;
         }
         $configphp = install_generate_configphp($database, $CFG, $userealpath);
         umask(0137);
         if (($fh = @fopen($configfile, 'w')) !== false) {
             fwrite($fh, $configphp);
             fclose($fh);
         }
         if (file_exists($configfile)) {
             // config created, let's continue!
             redirect("{$CFG->wwwroot}/{$config->admin}/index.php?lang={$config->lang}");
         }
         install_print_header($config, 'config.php', get_string('configurationcompletehead', 'install'), get_string('configurationcompletesub', 'install') . get_string('configfilenotwritten', 'install'));
         echo '<div class="configphp"><pre>';
         echo p($configphp);
         echo '</pre></div>';
         install_print_footer($config);
         die;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:install.php


注:本文中的install_generate_configphp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。