Browse Source

Fixing install bug.

Julio Montoya 11 years ago
parent
commit
5e580383c3
2 changed files with 14 additions and 33 deletions
  1. 11 7
      main/install/index.php
  2. 3 26
      main/install/install.lib.php

+ 11 - 7
main/install/index.php

@@ -41,7 +41,15 @@ class BufferedOutput extends Output
 
 $app = new Silex\Application();
 
+// Setting Chamilo paths
 $app['root_sys'] = dirname(dirname(__DIR__)).'/';
+$app['sys_root'] = $app['root_sys'];
+$app['sys_data_path'] = isset($_configuration['sys_data_path']) ? $_configuration['sys_data_path'] : $app['root_sys'].'data/';
+$app['sys_config_path'] = isset($_configuration['sys_config_path']) ? $_configuration['sys_config_path'] : $app['root_sys'].'config/';
+$app['sys_course_path'] = isset($_configuration['sys_course_path']) ? $_configuration['sys_course_path'] : $app['sys_data_path'].'/course';
+$app['sys_log_path'] = isset($_configuration['sys_log_path']) ? $_configuration['sys_log_path'] : $app['root_sys'].'logs/';
+$app['sys_temp_path'] = isset($_configuration['sys_temp_path']) ? $_configuration['sys_temp_path'] : $app['sys_data_path'].'temp/';
+
 
 // Registering services
 
@@ -56,7 +64,6 @@ $app['translator'] = $app->share($app->extend('translator', function($translator
     $translator->addResource('yaml', __DIR__.'/lang/fr.yml', 'fr');
     $translator->addResource('yaml', __DIR__.'/lang/en.yml', 'en');
     $translator->addResource('yaml', __DIR__.'/lang/es.yml', 'es');*/
-
     return $translator;
 }));
 
@@ -131,7 +138,9 @@ foreach ($helpers as $name => $helper) {
 }
 
 $blockInstallation = function() use($app) {
-    if (file_exists($app['root_sys'].'config/configuration.php') || file_exists($app['root_sys'].'config/configuration.yml')) {
+    if (file_exists($app['root_sys'].'config/configuration.php') ||
+        file_exists($app['root_sys'].'config/configuration.yml')
+    ) {
         return $app->abort(500, "A Chamilo installation was found. You can't reinstall.");
     }
 };
@@ -250,11 +259,6 @@ $app->match('/check-database', function() use($app) {
             } catch (Exception $e) {
                 $app['session']->getFlashBag()->add('success', 'Connection error !'.$e->getMessage());
             }
-
-            // do something with the data
-
-            // redirect somewhere
-            //return $app->redirect('...');
         }
     }
 

+ 3 - 26
main/install/install.lib.php

@@ -1008,6 +1008,7 @@ function display_requirements($app, $installType)
     } else {
         $html .= '<strong><font color="green">'.translate('PHPVersionOK').' '.phpversion().'</font></strong>';
     }
+
     $html .= '</td>
             </tr>
             <tr>
@@ -1071,20 +1072,14 @@ function display_requirements($app, $installType)
         translate('ExtensionGDNotAvailable')
     ).'</td>
             </tr>
-
-
              <tr>
                 <td class="requirements-item"><a href="http://php.net/manual/fr/book.imagick.php" target="_blank">ImageMagick</a> '.translate(
         'support'
     ).' ('.translate('Optional').')</td>
                 <td class="requirements-value">'.check_extension('imagick', translate('Yes'), translate('No'), true).'</td>
             </tr>
-
-
             <tr>
-                <td class="requirements-item"><a href="http://php.net/manual/en/book.json.php" target="_blank">JSON</a> '.translate(
-        'support'
-    ).'</td>
+                <td class="requirements-item"><a href="http://php.net/manual/en/book.json.php" target="_blank">JSON</a> '.translate('support').'</td>
                 <td class="requirements-value">'.check_extension('json', translate('Yes'), translate('No')).'</td>
             </tr>
             <tr>
@@ -1111,12 +1106,6 @@ function display_requirements($app, $installType)
     ).' ('.translate('Optional').')</td>
                 <td class="requirements-value">'.check_extension('curl', translate('Yes'), translate('No'), true).'</td>
             </tr>
-
-
-
-
-
-
           </table>';
     $html .= '  </div>';
     $html .= '</div>';
@@ -1280,18 +1269,6 @@ function display_requirements($app, $installType)
                 <td class="requirements-item">[chamilo]/logs</td>
                 <td class="requirements-value">'.check_writable_root_path('logs').'</td>
             </tr>
-            <tr>
-                <td class="requirements-item">[chamilo]/temp</td>
-                <td class="requirements-value">'.check_writable_root_path('temp').'</td>
-            </tr>
-            <tr>
-                <td class="requirements-item">[chamilo]/temp/twig</td>
-                <td class="requirements-value">'.check_writable_root_path('temp').'</td>
-            </tr>
-            <tr>
-                <td class="requirements-item">[chamilo]/main/default_course_document/images/</td>
-                <td class="requirements-value">'.check_writable('default_course_document/images/').'</td>
-            </tr>
             <tr>
                 <td class="requirements-item">'.translate('CourseTestWasCreated').'</td>
                 <td class="requirements-value">'.$course_test_was_created.' </td>
@@ -1328,7 +1305,7 @@ function display_requirements($app, $installType)
         @chmod($checked_writable, $perm);
     }
 
-    $checked_writable = api_get_path(SYS_CODE_PATH).'default_course_document/images/';
+    $checked_writable = api_get_path(SYS_DEFAULT_COURSE_DOCUMENT_PATH).'images/';
     if (!is_writable($checked_writable)) {
         $notwritable[] = $checked_writable;
         @chmod($checked_writable, $perm);