Explorar o código

better php extention recognizion

1Day %!s(int64=3) %!d(string=hai) anos
pai
achega
4a51c20fcc
Modificáronse 3 ficheiros con 4 adicións e 10 borrados
  1. 1 7
      public/install/functions.php
  2. 3 2
      public/install/index.php
  3. 0 1
      public/install/install.lock

+ 1 - 7
public/install/functions.php

@@ -6,8 +6,6 @@ $required_extentions = array("openssl", "gd", "mysql", "PDO", "mbstring", "token
 $requirements = [
     "php" => "7.4",
     "mysql" => "5.7.22",
-
-
 ];
 
 function checkPhpVersion()
@@ -33,7 +31,6 @@ function getMySQLVersion()
 
 function getZipVersion()
 {
-    global $requirements;
 
     $output = shell_exec('zip  -v');
     preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
@@ -45,7 +42,6 @@ function getZipVersion()
 
 function getGitVersion()
 {
-    global $requirements;
 
     $output = shell_exec('git  --version');
     preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
@@ -57,7 +53,6 @@ function getGitVersion()
 
 function getTarVersion()
 {
-    global $requirements;
 
     $output = shell_exec('tar  --version');
     preg_match('@[0-9]+\.[0-9]+@', $output, $version);
@@ -75,9 +70,8 @@ function checkExtensions()
     $extentions = get_loaded_extensions();
 
     foreach ($required_extentions as $ext) {
-        if (!in_array($ext, $extentions)) {
+        if(!preg_grep("/^(?=.*".$ext.").*$/", $extentions))
             array_push($not_ok, $ext);
-        }
     }
     return $not_ok;
 

+ 3 - 2
public/install/index.php

@@ -66,10 +66,11 @@ if (!isset($_GET['step'])) {
         version: <?php echo getMySQLVersion(); ?> (minimum required <?php echo $requirements["mysql"]; ?>)</p>
 
     <p class="<?php print(sizeof(checkExtensions()) == 0 ? "ok" : "notok"); ?>"> Missing
-        extentions: <?php print(sizeof(checkExtensions()) == 0 ? "None" : "");
+        php-extentions: <?php print(sizeof(checkExtensions()) == 0 ? "none" : "");
         foreach (checkExtensions() as $ext) {
             echo $ext . ", ";
-        } ?> (try to install anyway)</p>
+        }
+        print(sizeof(checkExtensions()) == 0 ? "" : "(Proceed anyway)");?></p>
 
     <!-- <p class="<?php print(getZipVersion() === "OK" ? "ok" : "notok"); ?>"> Zip
                 version: <?php echo getZipVersion(); ?> </p> -->

+ 0 - 1
public/install/install.lock

@@ -1 +0,0 @@
-locked