Переглянути джерело

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

Julio Montoya 6 роки тому
батько
коміт
bdff43374b

+ 1 - 1
.env.dist

@@ -31,7 +31,7 @@ APP_SECRET=141af65f23c7935a37b504c422f113b0
 APP_INSTALLED={{APP_INSTALLED}}
 APP_ENCRYPT_METHOD={{APP_ENCRYPT_METHOD}}
 APP_LOCALE=en
-APP_URL_APPEND='{{APP_URL_APPEND}}'
+APP_URL_APPEND='{{APP_URL_APPEND}}' ## Example: '/chamilo2'
 APP_MULTIPLE_ACCESS_URL=''
 
 ###< 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
 cd chamilo2
 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
 yarn install
 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:
 ~~~~
 git pull origin master
+php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
+    
 yarn upgrade
 yarn encore dev
 composer update

+ 6 - 6
assets/js/app.js

@@ -8,15 +8,15 @@ require('./vendor');
 require('./main');
 
 // @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(mainUrl);
-console.log(webAjax);
+console.log(webAjax);*/
 
 var ajax_url = webAjax + 'chat.ajax.php';
 var online_button = '<img src="' + homePublicUrl + 'img/statusonline.png">';

+ 13 - 14
composer.json

@@ -183,25 +183,24 @@
         "behat/mink-selenium2-driver": "@stable"
     },
     "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": [
             "Chamilo\\CoreBundle\\Composer\\ScriptHandler::deleteOldFilesFrom19x"
         ],
         "pre-update-cmd": [
             "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": [
         {

+ 1 - 2
config/packages/fos_js_routing.yaml

@@ -1,3 +1,2 @@
 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:
-    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
     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;'
-#    router.request_context.base_url: '%url_append%'
     router.request_context.base_url: '%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),
         $content
     );
+
     $save_file_path = $dir.$filename.'.'.$extension;
 
     $document = DocumentManager::addDocument(

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

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

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

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

Різницю між файлами не показано, бо вона завелика
+ 844 - 78
yarn.lock


Деякі файли не було показано, через те що забагато файлів було змінено