Browse Source

APP_URL_APPEND must contain "/" at the beggining if is not empty

Julio Montoya 6 years ago
parent
commit
bdff43374b

+ 1 - 1
.env.dist

@@ -31,7 +31,7 @@ APP_SECRET=141af65f23c7935a37b504c422f113b0
 APP_INSTALLED={{APP_INSTALLED}}
 APP_INSTALLED={{APP_INSTALLED}}
 APP_ENCRYPT_METHOD={{APP_ENCRYPT_METHOD}}
 APP_ENCRYPT_METHOD={{APP_ENCRYPT_METHOD}}
 APP_LOCALE=en
 APP_LOCALE=en
-APP_URL_APPEND='{{APP_URL_APPEND}}'
+APP_URL_APPEND='{{APP_URL_APPEND}}' ## Example: '/chamilo2'
 APP_MULTIPLE_ACCESS_URL=''
 APP_MULTIPLE_ACCESS_URL=''
 
 
 ###< chamilo ###
 ###< chamilo ###

+ 2 - 1
README.md

@@ -20,7 +20,6 @@ not in a sub folder inside a domain.
 git clone https://github.com/chamilo/chamilo-lms.git chamilo2
 git clone https://github.com/chamilo/chamilo-lms.git chamilo2
 cd chamilo2
 cd chamilo2
 composer install (If composer asks to accept recipes, just press enter or "n")
 composer install (If composer asks to accept recipes, just press enter or "n")
-php bin/console assets:install
 php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
 php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
 yarn install
 yarn install
 yarn run encore dev
 yarn run encore dev
@@ -40,6 +39,8 @@ chown -R www-data: public/ var/
 If you have already installed it and just want to update it from Git, do:
 If you have already installed it and just want to update it from Git, do:
 ~~~~
 ~~~~
 git pull origin master
 git pull origin master
+php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
+    
 yarn upgrade
 yarn upgrade
 yarn encore dev
 yarn encore dev
 composer update
 composer update

+ 6 - 6
assets/js/app.js

@@ -8,15 +8,15 @@ require('./vendor');
 require('./main');
 require('./main');
 
 
 // @todo rework url naming
 // @todo rework url naming
-var homePublicUrl = Routing.generate('home') + 'public/';
-var legacyIndex = Routing.generate('legacy_index');
-var mainUrl = Routing.generate('web.main');
-var webAjax = Routing.generate('web.ajax');
+const homePublicUrl = Routing.generate('home') + 'public/';
+const legacyIndex = Routing.generate('legacy_index');
+const mainUrl = Routing.generate('web.main');
+const webAjax = Routing.generate('web.ajax');
 
 
-console.log(homePublicUrl);
+/*console.log(homePublicUrl);
 console.log(legacyIndex);
 console.log(legacyIndex);
 console.log(mainUrl);
 console.log(mainUrl);
-console.log(webAjax);
+console.log(webAjax);*/
 
 
 var ajax_url = webAjax + 'chat.ajax.php';
 var ajax_url = webAjax + 'chat.ajax.php';
 var online_button = '<img src="' + homePublicUrl + 'img/statusonline.png">';
 var online_button = '<img src="' + homePublicUrl + 'img/statusonline.png">';

+ 13 - 14
composer.json

@@ -183,25 +183,24 @@
         "behat/mink-selenium2-driver": "@stable"
         "behat/mink-selenium2-driver": "@stable"
     },
     },
     "scripts": {
     "scripts": {
+        "auto-scripts": {
+            "cache:clear": "symfony-cmd",
+            "assets:install %PUBLIC_DIR%": "symfony-cmd",
+            "security-checker security:check": "script",
+            "requirements-checker": "script"
+        },
+        "post-install-cmd": [
+            "@auto-scripts"
+        ],
+        "post-update-cmd": [
+            "@auto-scripts"
+        ],
         "pre-install-cmd": [
         "pre-install-cmd": [
             "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
             "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
         ],
         ],
         "pre-update-cmd": [
         "pre-update-cmd": [
             "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
             "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
-        ],
-        "post-install-cmd": [
-            "Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles"
-        ],
-        "post-update-cmd": [
-            "Chamilo\\CoreBundle\\Composer\\ScriptHandler::dumpCssFiles"
-        ],
-        "auto-scripts": {
-            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
-            "security-checker security:check": "script",
-            "requirements-checker": "script",
-            "cache:clear": "symfony-cmd",
-            "assets:install %PUBLIC_DIR%": "symfony-cmd"
-        }
+        ]
     },
     },
     "repositories": [
     "repositories": [
         {
         {

+ 1 - 2
config/packages/fos_js_routing.yaml

@@ -1,3 +1,2 @@
 fos_js_routing:
 fos_js_routing:
-    request_context_base_url: '/%url_append%'
-    routes_to_expose: [home]
+    request_context_base_url: '%url_append%'

+ 1 - 1
config/routes/fos_js_routing.yaml

@@ -1,2 +1,2 @@
 fos_js_routing:
 fos_js_routing:
-    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
+    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"

+ 0 - 1
config/services.yaml

@@ -97,6 +97,5 @@ parameters:
     course_info_is_not_editable: false
     course_info_is_not_editable: false
     sonata_media.cdn.host: '/%env(APP_URL_APPEND)%/public/resource'
     sonata_media.cdn.host: '/%env(APP_URL_APPEND)%/public/resource'
     sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
     sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
-#    router.request_context.base_url: '%url_append%'
     router.request_context.base_url: '%url_append%'
     router.request_context.base_url: '%url_append%'
     asset.request_context.base_path: '%url_append%'
     asset.request_context.base_path: '%url_append%'

+ 1 - 0
main/document/create_document.php

@@ -515,6 +515,7 @@ if ($form->validate()) {
         api_get_configuration_value('url_append').api_get_path(REL_COURSE_PATH),
         api_get_configuration_value('url_append').api_get_path(REL_COURSE_PATH),
         $content
         $content
     );
     );
+
     $save_file_path = $dir.$filename.'.'.$extension;
     $save_file_path = $dir.$filename.'.'.$extension;
 
 
     $document = DocumentManager::addDocument(
     $document = DocumentManager::addDocument(

+ 4 - 1
main/inc/global.inc.php

@@ -58,7 +58,10 @@ try {
     $request->setBaseUrl($request->getRequestUri());
     $request->setBaseUrl($request->getRequestUri());
     $kernel->boot();
     $kernel->boot();
     if (!empty($append)) {
     if (!empty($append)) {
-        $append = "/$append/";
+        if (substr($append, 0, 1) !== '/') {
+            throw new Exception('APP_URL_APPEND must start with "/"');
+        }
+        $append = "$append/";
     }
     }
 
 
     $container = $kernel->getContainer();
     $container = $kernel->getContainer();

+ 1 - 1
src/CoreBundle/Controller/IndexController.php

@@ -23,7 +23,7 @@ class IndexController extends BaseController
      *
      *
      * @return Response
      * @return Response
      */
      */
-    public function indexAction(Request $request): Response
+    public function indexAction(): Response
     {
     {
         return $this->render(
         return $this->render(
             '@ChamiloTheme/Index/index.html.twig',
             '@ChamiloTheme/Index/index.html.twig',

File diff suppressed because it is too large
+ 844 - 78
yarn.lock


Some files were not shown because too many files changed in this diff