diff --git a/setuptsugi/index.php b/setuptsugi/index.php index c8bde3787..27bb27787 100644 --- a/setuptsugi/index.php +++ b/setuptsugi/index.php @@ -294,6 +294,8 @@ function require_auth() { function preflightchecks($mode) { + global $branch; + echo "
Running pre-flight checks
\n"; flush(); // Check OS @@ -307,12 +309,27 @@ function preflightchecks($mode) // Check PHP version $phpversion = phpversion(); - if ($phpversion < "7.2.0" || $phpversion >= "8.1.0") + if ($phpversion < "7.2.0") { - echo "Your PHP version (". $phpversion . ") is not supported by TSUGI. Please update to a PHP version 7.4 or higher but lower than PHP 8.1.
\n"; + echo "Your PHP version (". $phpversion . ") is not supported by TSUGI. Please update to a PHP version 7.2 or higher.
\n"; echo "Aborting!"; exit(-1); } + else if ($phpversion < "8.0") + { + echo "Your PHP version is ". $phpversion . ". Using branch php-72-x.
"; + $branch = "php-72-x"; + } + else if ($phpversion < "8.1") + { + echo "Your PHP version is ". $phpversion . ". Using branch php-80-x.
"; + $branch = "php-80-x"; + } + else + { + $branch = "master"; + } + flush(); // Check zip extension $zipextension = phpversion("zip"); if ($zipextension === false) @@ -331,6 +348,7 @@ function preflightchecks($mode) exit(-1); } echo "All pre-flight checks are Ok!
\n"; + flush(); } function backup() @@ -385,18 +403,20 @@ function backup() { echo "Existing TSUGI folder has been removed
\n"; } + flush(); } function install() { - global $xerte_toolkits_site; + global $xerte_toolkits_site, $branch; // Download Tsugi bestanden echo "
Download the TSUGI installer package
\n"; - flush(); + flush(); + global $xerte_toolkits_site; //$url = "https://github.com/$u/$repo/archive/master.zip"; - $url = "https://github.com/tsugiproject/tsugi/archive/refs/heads/master.zip"; - $tsugizip = __DIR__.'/../import/tsugi-master.zip'; + $url = "https://github.com/tsugiproject/tsugi/archive/refs/heads/{$branch}.zip"; + $tsugizip = __DIR__."/../import/tsugi-{$branch}.zip"; $ch = curl_init(); $f = fopen($tsugizip, 'w+'); $opt = [ @@ -434,15 +454,17 @@ function install() } $res = $zip->close(); echo "TSUGI package successfully extracted
\n"; + flush(); } else { echo "Couldn't open $tsugizip!
\n"; echo "Aborting!"; exit(-1); } - rename($xerte_toolkits_site->root_file_path . "tsugi-master", $xerte_toolkits_site->root_file_path . "tsugi"); + rename($xerte_toolkits_site->root_file_path . "tsugi-{$branch}", $xerte_toolkits_site->root_file_path . "tsugi"); echo "TSUGI package successfully installed
\n"; + flush(); } @@ -471,6 +493,7 @@ function install_config_file($config_file) { echo "config.php has been copied!
\n"; } + flush(); } function copy_config_template() @@ -498,6 +521,7 @@ function upgrade_database() } $upgrade_log .= ""; echo $upgrade_log; + flush(); } }