Remove unused 1.9.x code, migration will be from 1.11.x

pull/3064/head
Julio 6 years ago
parent a3a563ba78
commit 0276f33f9d
  1. BIN
      public/main/install/header-logo.png
  2. 26
      public/main/install/htaccess.dist
  3. 22
      public/main/install/index.php
  4. 85
      public/main/install/install.lib.php
  5. 11
      public/main/install/update-configuration.inc.php
  6. 67
      public/main/install/update-files-1.10.0-1.11.0.inc.php
  7. 250
      public/main/install/update-files-1.9.0-1.10.0.inc.php

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

@ -1,26 +0,0 @@
# Change this file to fit your configuration and save it as .htaccess in the courses folder #
# Chamilo mod rewrite
# Comment lines start with # and are not processed
<IfModule mod_rewrite.c>
RewriteEngine On
# Rewrite base is the dir chamilo is installed in with trailing slash
RewriteBase {CHAMILO_URL_APPEND_PATH}/courses/
# Do not rewrite on the main dir
# Change this path to the path of your main folder
RewriteCond %{REQUEST_URI} !^{CHAMILO_URL_APPEND_PATH}/main/
#replace nasty ampersands by 3 slashes, we change these back in download.php
RewriteRule ([^/]+)/document/(.*)&(.*)$ $1/document/$2///$3 [N]
# Rewrite everything in the scorm folder of a course to the download script
RewriteRule ([^/]+)/scorm/(.*)$ {CHAMILO_URL_APPEND_PATH}/main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
# Rewrite everything in the document folder of a course to the download script
RewriteRule ([^/]+)/document/(.*)$ {CHAMILO_URL_APPEND_PATH}/main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
# Rewrite everything in the work folder
RewriteRule ([^/]+)/work/(.*)$ {CHAMILO_URL_APPEND_PATH}/main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
</IfModule>

@ -123,25 +123,8 @@ $installationGuideLink = '../../documentation/installation_guide.html';
// Setting the error reporting levels.
error_reporting(E_ALL);
// Upgrading from any subversion of 1.9
// Upgrading from any subversion of 1.11.x
$update_from_version_8 = [
'1.9.0',
'1.9.2',
'1.9.4',
'1.9.6',
'1.9.6.1',
'1.9.8',
'1.9.8.1',
'1.9.8.2',
'1.9.10',
'1.9.10.2',
'1.9.10.4',
'1.9.10.6',
'1.10.0',
'1.10.2',
'1.10.4',
'1.10.6',
'1.10.8',
'1.11.0',
'1.11.1',
'1.11.2',
@ -811,7 +794,7 @@ $poweredBy = 'Powered by <a href="http://www.chamilo.org" target="_blank"> Chami
<div class="row">
<div class="col-md-4">
<div class="logo-install">
<img src="header-logo.png" class="img-fluid" alt="Chamilo" />
<img src="../../build/css/themes/chamilo/images/header-logo.png" class="img-fluid" alt="Chamilo" />
</div>
<div class="install-steps">
<ol class="list-group">
@ -851,7 +834,6 @@ $poweredBy = 'Powered by <a href="http://www.chamilo.org" target="_blank"> Chami
</a>
</div>
</div>
<div class="col-md-8">
<form class="form-horizontal" id="install_form" method="post"
action="<?php echo api_get_self(); ?>?running=1&amp;installType=<?php echo $installType; ?>&amp;updateFromConfigFile=<?php echo urlencode($updateFromConfigFile); ?>">

@ -3550,89 +3550,6 @@ function migrateSwitch($fromVersion, $manager, $processFiles = true)
$database->setManager($manager);
switch ($fromVersion) {
case '1.9.0':
case '1.9.2':
case '1.9.4':
case '1.9.6':
case '1.9.6.1':
case '1.9.8':
case '1.9.8.1':
case '1.9.8.2':
case '1.9.10':
case '1.9.10.2':
case '1.9.10.4':
case '1.9.10.6':
$database = new Database();
$database->setManager($manager);
// Fix type "enum" before running the migration with Doctrine
$connection->executeQuery("ALTER TABLE course_category MODIFY COLUMN auth_course_child VARCHAR(40) DEFAULT 'TRUE'");
$connection->executeQuery("ALTER TABLE course_category MODIFY COLUMN auth_cat_child VARCHAR(40) DEFAULT 'TRUE'");
$connection->executeQuery('ALTER TABLE c_quiz_answer MODIFY COLUMN hotspot_type varchar(40) default NULL');
$connection->executeQuery("ALTER TABLE c_tool MODIFY COLUMN target varchar(20) NOT NULL default '_self'");
$connection->executeQuery("ALTER TABLE c_link MODIFY COLUMN on_homepage char(10) NOT NULL default '0'");
$connection->executeQuery("ALTER TABLE c_blog_rating MODIFY COLUMN rating_type char(40) NOT NULL default 'post'");
$connection->executeQuery("ALTER TABLE c_survey MODIFY COLUMN anonymous char(10) NOT NULL default '0'");
$connection->executeQuery("ALTER TABLE c_document MODIFY COLUMN filetype char(10) NOT NULL default 'file'");
$connection->executeQuery("ALTER TABLE c_student_publication MODIFY COLUMN filetype char(10) NOT NULL default 'file'");
// Migrate using the migration files located in:
// src/Chamilo/CoreBundle/Migrations/Schema/V110
$result = migrate(
110,
$manager
);
if ($result) {
error_log('Migrations files were executed ('.date('Y-m-d H:i:s').')');
fixIds($manager);
error_log('fixIds finished ('.date('Y-m-d H:i:s').')');
$connection->executeQuery("UPDATE settings_current SET selected_value = '1.10.0' WHERE variable = 'chamilo_database_version'");
if ($processFiles) {
$fromVersionShort = '1.9';
include __DIR__.'/update-files-1.9.0-1.10.0.inc.php';
// Only updates the configuration.inc.php with the new version
include __DIR__.'/update-configuration.inc.php';
}
error_log('Upgrade 1.10.x process concluded! ('.date('Y-m-d H:i:s').')');
} else {
error_log('There was an error during running migrations. Check error.log');
break;
}
// no break
case '1.10.0':
case '1.10.2':
case '1.10.4':
case '1.10.6':
case '1.10.8':
$database = new Database();
$database->setManager($manager);
// Migrate using the migration files located in:
// src/Chamilo/CoreBundle/Migrations/Schema/V111
$result = migrate(111, $manager);
if ($result) {
error_log('Migrations files were executed ('.date('Y-m-d H:i:s').')');
fixPostGroupIds($connection);
$sql = "UPDATE settings_current SET selected_value = '1.11.0' WHERE variable = 'chamilo_database_version'";
$connection->executeQuery($sql);
if ($processFiles) {
error_log('Update config files');
$fromVersionShort = '1.10';
include __DIR__.'/update-files-1.10.0-1.11.0.inc.php';
// Only updates the configuration.inc.php with the new version
include __DIR__.'/update-configuration.inc.php';
}
error_log('Upgrade 1.11.x process concluded! ('.date('Y-m-d H:i:s').')');
} else {
error_log('There was an error during running migrations. Check error.log');
}
// no break
case '1.11.0':
case '1.11.1':
case '1.11.2':
@ -3640,6 +3557,8 @@ function migrateSwitch($fromVersion, $manager, $processFiles = true)
case '1.11.6':
case '1.11.8':
case '1.11.10':
case '1.11.12':
case '1.11.14':
$database = new Database();
$database->setManager($manager);
// Migrate using the migration files located in:

@ -13,17 +13,6 @@ if (defined('SYSTEM_INSTALLATION')) {
$perm = api_get_permissions_for_new_files();
$newConfFile = api_get_path(CONFIGURATION_PATH).'configuration.php';
// Check $fromVersionShort, defined in install.lib.php, in the switch
// on full version numbers, to know from which version we are upgrading
if ($fromVersionShort == '1.9') {
$oldConfFile = api_get_path(SYS_CODE_PATH).'inc/conf/configuration.php';
if (file_exists($oldConfFile)) {
copy($oldConfFile, $newConfFile);
@chmod($newConfFile, $perm);
@rmdir($oldConfFile);
}
}
// Edit the configuration file.
$file = file($newConfFile);

@ -1,67 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Chamilo LMS.
*
* Updates the Chamilo files from version 1.10.0 to version 1.11.0
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
* current configuration file.
*
* @package chamilo.install
*/
error_log("Starting ".basename(__FILE__));
global $debug;
if (defined('SYSTEM_INSTALLATION')) {
// Changes for 1.11.x
// Delete directories and files that are not necessary anymore
// The main/exercice path was moved to main/exercise, so the code from 1.11
// should just create the new directory, and we should delete the previous
// one to avoid the web server to use the old
$exercisePath = api_get_path(SYS_CODE_PATH).'exercice';
if (is_dir($exercisePath)) {
@rrmdir($exercisePath);
}
// Same with main/newscorm, renamed main/lp
$lpPath = api_get_path(SYS_CODE_PATH).'newscorm';
if (is_dir($lpPath)) {
@rrmdir($lpPath);
}
// The ticket plugin has been moved to core in 1.11
$ticketPluginPath = api_get_path(SYS_PLUGIN_PATH).'ticket';
if (is_dir($ticketPluginPath)) {
@rrmdir($ticketPluginPath);
}
// The Skype plugin has been moved to core in 1.11
$skypePluginPath = api_get_path(SYS_PLUGIN_PATH).'skype';
if (is_dir($skypePluginPath)) {
@rrmdir($skypePluginPath);
}
// Some entities have been removed in 1.11. Delete the corresponding files
$entitiesToRemove = [
api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/Groups.php',
api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelGroup.php',
api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelTag.php',
api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Entity/GroupRelUser.php',
];
foreach ($entitiesToRemove as $entity) {
if (file_exists($entity)) {
$success = unlink($entity);
if (!$success) {
error_log('Could not delete '.$entity.', probably due to permissions. Please delete manually to avoid entities inconsistencies');
}
} else {
error_log('Could not delete. It seems the file '.$entity.' does not exists.');
}
}
if ($debug) {
error_log('Folders cleaned up');
}
} else {
echo 'You are not allowed here !'.__FILE__;
}

@ -1,250 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
/**
* Chamilo LMS.
*
* Updates the Chamilo files from version 1.9.0 to version 1.10.0
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
* current configuration file.
*
* @package chamilo.install
*/
error_log("Starting ".basename(__FILE__));
global $debug;
if (defined('SYSTEM_INSTALLATION')) {
// Changes for 1.10.x
// Delete directories and files that are not necessary anymore
// pChart (1) lib, etc
// Delete the "chat" file in all language directories, as variables have been moved to the trad4all file
$langPath = api_get_path(SYS_CODE_PATH).'lang/';
// Only erase files from Chamilo languages (not sublanguages defined by the users)
$officialLanguages = [
'arabic',
'asturian',
'basque',
'bengali',
'bosnian',
'brazilian',
'bulgarian',
'catalan',
'croatian',
'czech',
'danish',
'dari',
'dutch',
'english',
'esperanto',
'faroese',
'finnish',
'french',
'friulian',
'galician',
'georgian',
'german',
'greek',
'hebrew',
'hindi',
'hungarian',
'indonesian',
'italian',
'japanese',
'korean',
'latvian',
'lithuanian',
'macedonian',
'malay',
'norwegian',
'occitan',
'pashto',
'persian',
'polish',
'portuguese',
'quechua_cusco',
'romanian',
'russian',
'serbian',
'simpl_chinese',
'slovak',
'slovenian',
'somali',
'spanish',
'spanish_latin',
'swahili',
'swedish',
'tagalog',
'thai',
'tibetan',
'trad_chinese',
'turkish',
'ukrainian',
'vietnamese',
'xhosa',
'yoruba',
];
$filesToDelete = [
'accessibility',
'admin',
'agenda',
'announcements',
'blog',
'chat',
'coursebackup',
'course_description',
'course_home',
'course_info',
'courses',
'create_course',
'document',
'dropbox',
'exercice',
'external_module',
'forum',
'glossary',
'gradebook',
'group',
'help',
'import',
'index',
'install',
'learnpath',
'link',
'md_document',
'md_link',
'md_mix',
'md_scorm',
'messages',
'myagenda',
'notebook',
'notification',
'registration',
'reservation',
'pedaSuggest',
'resourcelinker',
'scorm',
'scormbuilder',
'scormdocument',
'slideshow',
'survey',
'tracking',
'userInfo',
'videoconf',
'wiki',
'work',
];
$list = scandir($langPath);
foreach ($list as $entry) {
if (is_dir($langPath.$entry) &&
in_array($entry, $officialLanguages)
) {
foreach ($filesToDelete as $file) {
if (is_file($langPath.$entry.'/'.$file.'.inc.php')) {
unlink($langPath.$entry.'/'.$file.'.inc.php');
}
}
}
}
if ($debug) {
error_log('Cleaning folders');
}
// Remove the "main/conference/" directory that wasn't used since years long
// past - see rrmdir function declared below
@rrmdir(api_get_path(SYS_CODE_PATH).'conference');
// Other files that we renamed
// events.lib.inc.php has been renamed to events.lib.php
if (is_file(api_get_path(LIBRARY_PATH).'events.lib.inc.php')) {
@unlink(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
}
if (is_file(api_get_path(SYS_PATH).'courses/.htaccess')) {
unlink(api_get_path(SYS_PATH).'courses/.htaccess');
}
// Move dirs into new structures.
$movePathList = [
api_get_path(SYS_CODE_PATH).'upload/users/groups' => api_get_path(SYS_UPLOAD_PATH).'groups',
api_get_path(SYS_CODE_PATH).'upload/users' => api_get_path(SYS_UPLOAD_PATH).'users',
api_get_path(SYS_CODE_PATH).'upload/badges' => api_get_path(SYS_UPLOAD_PATH).'badges',
api_get_path(SYS_PATH).'courses' => api_get_path(SYS_APP_PATH).'courses',
api_get_path(SYS_PATH).'searchdb' => api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/',
api_get_path(SYS_PATH).'home' => api_get_path(SYS_APP_PATH).'home',
];
if ($debug) {
error_log('Moving folders');
}
$fs = new Filesystem();
foreach ($movePathList as $origin => $destination) {
if (is_dir($origin)) {
$fs->mirror($origin, $destination);
if ($debug) {
error_log("Renaming: '$origin' to '$destination'");
}
try {
$fs->remove($origin);
} catch (IOException $e) {
// If removing the directory doesn't work, just log an error and continue
error_log('Could not move '.$origin.' to '.$destination.'('.$e->getMessage().'). Please move it manually.');
}
}
}
// Delete all "courses/ABC/index.php" files.
if ($debug) {
error_log('Deleting old courses/ABC/index.php files');
}
$finder = new Finder();
$courseDir = api_get_path(SYS_APP_PATH).'courses';
if (is_dir($courseDir)) {
$dirs = $finder->directories()->in($courseDir);
/** @var Symfony\Component\Finder\SplFileInfo $dir */
foreach ($dirs as $dir) {
$indexFile = $dir->getPath().'/index.php';
if ($debug) {
error_log('Deleting: '.$indexFile);
}
if ($fs->exists($indexFile)) {
$fs->remove($indexFile);
}
}
}
// Remove old "courses" folder if empty
$originalCourseDir = api_get_path(SYS_PATH).'courses';
if (is_dir($originalCourseDir)) {
$dirs = $finder->directories()->in($originalCourseDir);
$files = $finder->directories()->in($originalCourseDir);
$dirCount = $dirs->count();
$fileCount = $dirs->count();
if ($fileCount == 0 && $dirCount == 0) {
@rrmdir(api_get_path(SYS_PATH).'courses');
}
}
if ($debug) {
error_log('Remove archive folder');
}
// Remove archive
@rrmdir(api_get_path(SYS_PATH).'archive');
} else {
echo 'You are not allowed here !'.__FILE__;
}
Loading…
Cancel
Save