Install::step1 PHP Method

step1() public method

public step1 ( )
    function step1()
    {
        $Errors = array();
        $directories = $this->_scandir('cache');
        $this->file_is_writable(array('cache'), '', $Errors);
        $this->file_is_writable($directories, 'cache/', $Errors);
        $this->file_is_writable(array('settings'), '', $Errors);
        $var_directories = array('var/storage', 'var/storageform', 'var/storagetheme', 'var/storageadmintheme', 'var/tmpfiles', 'var/userphoto');
        $this->file_is_writable(array('var'), '', $Errors);
        $this->file_is_writable($var_directories, '', $Errors);
        if (!extension_loaded('pdo_mysql')) {
            $Errors[] = "php-pdo extension not detected. Please install php extension";
        }
        if (!extension_loaded('curl')) {
            $Errors[] = "php_curl extension not detected. Please install php extension";
        }
        if (!extension_loaded('mbstring')) {
            $Errors[] = "mbstring extension not detected. Please install php extension";
        }
        if (!extension_loaded('gd')) {
            $Errors[] = "gd extension not detected. Please install php extension";
        }
        if (!function_exists('json_encode')) {
            $Errors[] = "json support not detected. Please install php extension";
        }
        if (version_compare(PHP_VERSION, '5.4.0', '<')) {
            $Errors[] = "Minimum 5.4.0 PHP version is required";
        }
        if (count($Errors) == 0) {
            return true;
        } else {
            return $Errors;
        }
    }

Usage Example

示例#1
0
function main($ini_file)
{
    $install = new Install($ini_file);
    $response = $install->step1();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step2();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step3();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    $response = $install->step4();
    if (is_array($response)) {
        $install->print_errors($response);
    }
    exit(1);
}