From e2ecc72ddd3fd23068b535301aca29446bdd5cf7 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 22 Jul 2015 12:57:45 +0200 Subject: [PATCH] Fixing installation process. Moving migrations folder inside app --- .../Migrations/Schema/V110/Version110.php | 4 +- .../Schema/V110/Version20150423093100.php | 4 +- .../Schema/V110/Version20150504182600.php | 4 +- .../Schema/V110/Version20150505132304.php | 2 +- .../Schema/V110/Version20150505142900.php | 4 +- .../Schema/V110/Version20150507152600.php | 4 +- .../Schema/V110/Version20150511133949.php | 2 +- .../Schema/V110/Version20150521113600.php | 2 +- .../Schema/V110/Version20150522112023.php | 2 +- .../Schema/V110/Version20150522222222.php | 4 +- .../Schema/V110/Version20150527101600.php | 5 +- .../Schema/V110/Version20150527114220.php | 4 +- .../Schema/V110/Version20150527120703.php | 4 +- .../Schema/V110/Version20150528103216.php | 2 +- .../Schema/V110/Version20150603142550.php | 2 +- .../Schema/V110/Version20150603181728.php | 2 +- .../Schema/V110/Version20150604145047.php | 2 +- .../Schema/V110/Version20150608104600.php | 2 +- .../Schema/V110/Version20150609113500.php | 2 +- .../Schema/V110/Version20150610143426.php | 2 +- .../Schema/V110/Version20150615171900.php | 3 +- .../Schema/V110/Version20150616093200.php | 2 +- .../Schema/V110/Version20150624164100.php | 2 +- .../Schema/V110/Version20150625155000.php | 2 +- .../Schema/V110/Version20150706135000.php | 2 +- .../Schema/V110/Version20150709083710.php | 2 +- .../Schema/V110/Version20150713132630.php | 4 +- .../Migrations/Schema/V111/Version111.php | 3 +- app/config/migrations.yml | 4 +- main/admin/special_exports.php | 1 + main/install/install.lib.php | 4 +- .../CoreBundle/Composer/ScriptHandler.php | 53 ++++++++++++++++++- 32 files changed, 97 insertions(+), 44 deletions(-) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version110.php (99%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150423093100.php (97%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150504182600.php (96%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150505132304.php (99%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150505142900.php (94%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150507152600.php (98%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150511133949.php (97%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150521113600.php (95%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150522112023.php (99%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150522222222.php (99%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150527101600.php (89%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150527114220.php (89%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150527120703.php (86%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150528103216.php (98%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150603142550.php (99%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150603181728.php (98%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150604145047.php (94%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150608104600.php (97%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150609113500.php (93%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150610143426.php (92%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150615171900.php (93%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150616093200.php (93%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150624164100.php (93%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150625155000.php (94%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150706135000.php (94%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150709083710.php (91%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V110/Version20150713132630.php (90%) rename {src/Chamilo/CoreBundle => app}/Migrations/Schema/V111/Version111.php (86%) diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php b/app/Migrations/Schema/V110/Version110.php similarity index 99% rename from src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php rename to app/Migrations/Schema/V110/Version110.php index d0a5bbce09..70ffde157b 100644 --- a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php +++ b/app/Migrations/Schema/V110/Version110.php @@ -1,7 +1,7 @@ autolaunch - * @package Chamilo\CoreBundle\Migrations\Schema\V110 + * @package Application\Migrations\Schema\V11010 */ class Version20150527101600 extends AbstractMigrationChamilo { diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527114220.php b/app/Migrations/Schema/V110/Version20150527114220.php similarity index 89% rename from src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527114220.php rename to app/Migrations/Schema/V110/Version20150527114220.php index 2330dd8f9b..d275420ba6 100644 --- a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527114220.php +++ b/app/Migrations/Schema/V110/Version20150527114220.php @@ -1,7 +1,7 @@ autolaunch - * @package Chamilo\CoreBundle\Migrations\Schema\V110 + * @package Application\Migrations\Schema\V11010 */ class Version20150527120703 extends AbstractMigrationChamilo { diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150528103216.php b/app/Migrations/Schema/V110/Version20150528103216.php similarity index 98% rename from src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150528103216.php rename to app/Migrations/Schema/V110/Version20150528103216.php index a112002b30..0524336cbd 100644 --- a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150528103216.php +++ b/app/Migrations/Schema/V110/Version20150528103216.php @@ -1,7 +1,7 @@ 'index.php', "name" => get_lang('PlatformAd // Access restrictions api_protect_admin_script(true); $nameTools = get_lang('SpecialExports'); +$export = ''; // include additional libraries require_once '../coursecopy/classes/CourseBuilder.class.php'; diff --git a/main/install/install.lib.php b/main/install/install.lib.php index b5c92a3311..9dfbbaaa80 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -1901,9 +1901,9 @@ function migrate($chamiloVersion, EntityManager $manager) // default name is: doctrine_migration_versions) $config->setMigrationsTableName('version'); // Namespace of your migration classes, do not forget escape slashes, do not add last slash - $config->setMigrationsNamespace('Chamilo\CoreBundle\Migrations\Schema\V'.$chamiloVersion); + $config->setMigrationsNamespace('Application\Migrations\Schema\V'.$chamiloVersion); // Directory where your migrations are located - $config->setMigrationsDirectory(api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Migrations/Schema/V'.$chamiloVersion); + $config->setMigrationsDirectory(api_get_path(SYS_PATH).'app/Migrations/Schema/V'.$chamiloVersion); // Load your migrations $config->registerMigrationsFromDirectory($config->getMigrationsDirectory()); diff --git a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php index 97b4e57a95..ea17e99aa1 100644 --- a/src/Chamilo/CoreBundle/Composer/ScriptHandler.php +++ b/src/Chamilo/CoreBundle/Composer/ScriptHandler.php @@ -28,7 +28,58 @@ class ScriptHandler { $path = __DIR__.'/../../../../main/inc/lib/symfony/'; if (is_dir($path) && is_writable($path)) { - rmdir($path); + self::rmdirr($path); } } + + private static function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) + { + $res = true; + + // A sanity check. + if (!file_exists($dirname)) { + return false; + } + // Simple delete for a file. + if (is_file($dirname) || is_link($dirname)) { + $res = unlink($dirname); + + return $res; + } + + // Loop through the folder. + $dir = dir($dirname); + // A sanity check. + $is_object_dir = is_object($dir); + if ($is_object_dir) { + while (false !== $entry = $dir->read()) { + // Skip pointers. + if ($entry == '.' || $entry == '..') { + continue; + } + + // Recurse. + if ($strict) { + $result = self::rmdirr("$dirname/$entry"); + if ($result == false) { + $res = false; + break; + } + } else { + self::rmdirr("$dirname/$entry"); + } + } + } + + // Clean up. + if ($is_object_dir) { + $dir->close(); + } + + if ($delete_only_content_in_folder == false) { + $res = rmdir($dirname); + } + + return $res; + } }