コード例 #1
0
/**
 * @deprecated not used anywhere
 * wrapper function for reseting install to default one
 * all data will be lost
 */
function cos_reset_install()
{
    cos_rm_files();
    drop_db_default();
    create_db();
    load_db_default();
    cos_create_files();
    cos_chmod_files();
    cos_install();
}
コード例 #2
0
/**
 * function for doing a prompt install from shell mode
 * is a wrapper around other shell functions.
 */
function prompt_install()
{
    common::echoMessage('Pick a version to install:', 'y');
    $tags = git::getTagsInstallLatest() . PHP_EOL;
    $tags .= "master";
    common::echoMessage($tags);
    $tag = common::readSingleline("Enter tag (version) to use:");
    common::execCommand("git checkout {$tag}");
    // Which profile to install
    $profiles = file::getFileList('profiles', array('dir_only' => true));
    if (count($profiles) == 1) {
        $profile = array_pop($profiles);
    } else {
        common::echoMessage("List of profiles: ");
        foreach ($profiles as $val) {
            common::echoMessage("\t" . $val);
        }
        // select profile and load it
        $profile = common::readSingleline('Enter profile, and hit return: ');
    }
    common::echoMessage("Loading the profile '{$profile}'", 'y');
    load_profile(array('profile' => $profile, 'config_only' => true));
    common::echoMessage("Main configuration (placed in config/config.ini) for '{$profile}' is loaded", 'y');
    // Keep base path. Ortherwise we will lose it when loading profile
    $base_path = conf::pathBase();
    // Load the default config.ini settings as a skeleton
    conf::$vars['coscms_main'] = conf::getIniFileArray($base_path . '/config/config.ini', true);
    // Reset base path
    conf::setMainIni('base_path', $base_path);
    conf::defineCommon();
    common::echoMessage("Enter MySQL credentials", 'y');
    // Get configuration info
    $host = common::readSingleline('Enter your MySQL host: ');
    $database = common::readSingleline('Enter database name: ');
    $username = common::readSingleline('Enter database user: '******'Enter database users password: '******'Enter server host name: ');
    common::echoMessage("Writing database connection info to main configuration");
    // Assemble configuration info
    conf::$vars['coscms_main']['url'] = "mysql:dbname={$database};host={$host};charset=utf8";
    conf::$vars['coscms_main']['username'] = $username;
    conf::$vars['coscms_main']['password'] = $password;
    conf::$vars['coscms_main']['server_name'] = $server_name;
    // Write it to ini file
    $content = conf::arrayToIniFile(conf::$vars['coscms_main'], false);
    $path = conf::pathBase() . "/config/config.ini";
    file_put_contents($path, $content);
    common::echoMessage("Your can also always change the config/config.ini file manually");
    $options = array();
    $options['profile'] = $profile;
    if ($tag == 'master') {
        $options['master'] = true;
    }
    common::echoMessage("Will now clone and install all modules", 'y');
    cos_install($options);
    common::echoMessage("Create a super user", 'y');
    useradd_add();
    $login = "******";
    common::echoMessage("If there was no errors you will be able to login at {$login}");
    common::echoMessage("Remember to change file permissions. This will require super user");
    common::echoMessage("E.g. like this:");
    common::echoMessage("sudo ./coscli.sh file --chmod-files");
}