Ver Fonte

Merge remote-tracking branch 'origin/1.11.x' into 1.11.x

Yannick Warnier há 8 anos atrás
pai
commit
0227115855
1 ficheiros alterados com 32 adições e 0 exclusões
  1. 32 0
      main/install/install.lib.php

+ 32 - 0
main/install/install.lib.php

@@ -122,6 +122,22 @@ function checkPhpSettingExists($phpSetting)
     return false;
 }
 
+/**
+ * Check if the current url is the same root_web when the multiple_access_url is enabled
+ * @return bool
+ */
+function checkAccessUrl()
+{
+    if (api_get_configuration_value('multiple_access_urls') !== true) {
+        return true;
+    }
+
+    $currentWebPath = api_get_path(WEB_PATH);
+    $rootWeb = api_get_configuration_value('root_web');
+
+    return $currentWebPath === $rootWeb;
+}
+
 /**
  * Returns a textual value ('ON' or 'OFF') based on a requester 2-state ini- configuration setting.
  *
@@ -689,6 +705,18 @@ function display_requirements(
     }
     echo '</div>';
 
+    $properlyAccessUrl =  checkAccessUrl();
+
+    if (!$properlyAccessUrl) {
+        echo '
+            <div class="alert alert-danger">
+                ' . Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_MEDIUM) .
+            ' ' .
+            get_lang('InstallMultiURLDetectedNotMainURL') . '
+            </div>
+        ';
+    }
+
     //  SERVER REQUIREMENTS
     echo '<div class="RequirementHeading"><h4>'.get_lang('ServerRequirements').'</h4>';
 
@@ -1092,6 +1120,10 @@ function display_requirements(
             <?php
         }
 
+        if (!$properlyAccessUrl) {
+            $error = true;
+        }
+
         // And now display the choice buttons (go back or install)
         ?>
         <p align="center" style="padding-top:15px">