function phpRequirementsMet()
{
    $result = FALSE;
    if (isset($_SESSION['php_version_check']) && $_SESSION['php_version_check'] === TRUE) {
        $result = TRUE;
        foreach ($_SESSION['module_list']['required'] as $module => $enabled) {
            if (!$enabled) {
                $result = FALSE;
                userMessage('error', "Please check your configured php modules.");
                break;
            }
        }
    } else {
        userMessage('error', "Please update your php installation.");
    }
    return $result;
}
Example #2
0
function transitionNextStep()
{
    if (installerStep() === STEP_PHP_REQUIREMENTS) {
        if (phpRequirementsMet()) {
            installerStepSet(nextStep(STEP_PHP_REQUIREMENTS));
        }
    } else {
        if (installerStep() === STEP_DB_CONFIG) {
            if (dbConfigValid()) {
                installerStepSet(nextStep(STEP_DB_CONFIG));
            }
        } else {
            if (installerStep() === STEP_DB_REQUIREMENTS) {
                if (dbRequirementsMet()) {
                    installerStepSet(nextStep(STEP_DB_REQUIREMENTS));
                }
            } else {
                if (installerStep() === STEP_CONFIG) {
                    if (configCheck()) {
                        installerStepSet(nextStep(STEP_CONFIG));
                    }
                } else {
                    if (installerStep() === STEP_PERMISSION) {
                        if (permissionCheck()) {
                            if (!is_writable(dirname(INSTALL_LOCK_FILE))) {
                                userMessage('error', "Insufficient permission for lockfile " . INSTALL_LOCK_FILE);
                            } else {
                                installerStepSet(nextStep(STEP_PERMISSION));
                            }
                        }
                    } else {
                        if (installerStep() === STEP_WRITE) {
                            installerStepSet(nextStep(STEP_WRITE));
                            setLock();
                        }
                    }
                }
            }
        }
    }
}
Example #3
0
function dbWrite()
{
    if (!dbEnabled()) {
        return TRUE;
    }
    global $dbSchemas, $dbFixtures;
    $db = dbHandle();
    if (!dbSelect($db)) {
        return FALSE;
    }
    dbDoMigration($db);
    foreach ($dbFixtures as $fixture) {
        $result = mysqli_multi_query($db, file_get_contents($fixture));
        if ($result === FALSE || mysqli_errno($db) != 0) {
            userMessage("error", "Problem loading fixture {$fixture} - " . mysqli_error($db));
            return FALSE;
        }
        dbFlush($db);
    }
    mysqli_close($db);
    return TRUE;
}
function configWrite()
{
    global $configOptions;
    $config_files = configFileList();
    foreach ($config_files as $config_file) {
        $these_configs = getFileConfigs($config_file);
        $file_scratch = file_get_contents("{$config_file}.tpl");
        foreach ($these_configs as $key => $config) {
            if (strstr($key, "db_") === FALSE) {
                $value = configGetValue($key);
            } else {
                $value = configGetDBValue($key);
            }
            $new_scratch = str_replace($config['string'], $value, $file_scratch);
            $file_scratch = $new_scratch;
        }
        #TODO - error handling !
        $handle = fopen($config_file, "w");
        if ($handle === FALSE) {
            userMessage("error", "Unable to open {$config_file}");
            return FALSE;
        } else {
            $write_result = fwrite($handle, $file_scratch);
            if ($write_result === FALSE || $write_result < strlen($file_scratch)) {
                userMessage("error", "Problem writing " . getcwd() . "/{$config_file}");
                return FALSE;
            } else {
                fclose($handle);
            }
        }
    }
    return TRUE;
}