Feature #272 - Preparations for change in the installation script: Removing the obsolete file language_data.csv and related to it code.

skala
Ivan Tcholakov 15 years ago
parent 2987a1ccae
commit 4704b8a83a
  1. 18
      main/install/install_upgrade.lib.php
  2. 35
      main/install/language_data.csv
  3. 1
      main/install/update_db.inc.php
  4. 29
      tests/main/install/install_upgrade.lib.test.php

@ -20,7 +20,6 @@
==============================================================================
*/
define("DOKEOS_MAIN_DATABASE_FILE", "dokeos_main.sql");
define("LANGUAGE_DATA_FILENAME", "language_data.csv");
define("COUNTRY_DATA_FILENAME", "country_data.csv");
define("SETTING_OPTION_DATA_FILENAME", "setting_option_data.csv");
define("SETTING_CURRENT_DATA_FILENAME", "setting_current_data.csv");
@ -44,22 +43,11 @@ function set_file_folder_permissions()
{
@chmod('.',0755); //set permissions on install dir
@chmod('..',0755); //set permissions on parent dir of install dir
@chmod('language_data.csv',0755);
@chmod('setting_current_data.csv',0755);
@chmod('setting_option_data.csv',0755);
@chmod('country_data.csv.csv',0755);
}
/**
* Fills the language table with all available languages.
*/
function fill_language_table($language_table)
{
$file_path = dirname(__FILE__).'/'.LANGUAGE_DATA_FILENAME;
$add_language_sql = "LOAD DATA INFILE '".mysql_real_escape_string($file_path)."' INTO TABLE $language_table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\'';";
@ mysql_query($add_language_sql);
}
/**
* Fills the current settings table with the Dokeos default settings.
* After using the LOAD DATA INFILE instruction, the database stores some
@ -226,13 +214,13 @@ function write_dokeos_config_file($path)
* @return void
*/
function load_main_database($installation_settings,$db_script='')
{
{
if (!empty($db_script)) {
$dokeos_main_sql_file_string = file_get_contents($db_script);
} else {
$dokeos_main_sql_file_string = file_get_contents(DOKEOS_MAIN_DATABASE_FILE);
$dokeos_main_sql_file_string = file_get_contents(DOKEOS_MAIN_DATABASE_FILE);
}
//replace symbolic parameters with user-specified values
foreach ($installation_settings as $key => $value)
{

@ -1,35 +0,0 @@
18,'Melayu (Bahasa M.)','malay','ms','malay',0,
17,'Nihongo','japanese','ja','japanese',0,
16,'Italiano','italian','it','italian',1,
14,'Magyar','hungarian','hu','hungarian',1,
13,'Ellinika','greek','el','greek',0,
12,'Deutsch','german','de','german',1,
11,'Galego','galician','gl','galician',1,
15,'Indonesia (Bahasa I.)','indonesian','id','indonesian',1,
10,'Français','french','fr','french',1,
9,'Suomi','finnish','fi','finnish',1,
8,'English','english','en','english',1,
7,'Nederlands','dutch','nl','dutch',1,
6,'Dansk','danish','da','danish',1,
5,'Hrvatski','croatian','hr','croatian',0,
4,'Català','catalan','ca','catalan',0,
3,'Balgarski','bulgarian','bg','bulgarian',1,
2,'Português (Brazil)','brazilian','pt-BR','brazilian',1,
1,'Arabija (el)','arabic','ar','arabic',0,
19,'Polski','polish','pl','polish',1,
20,'Português (Portugal)','portuguese','pt','portuguese',1,
21,'Russkij','russian','ru','russian',1,
22,'Chinese (simplified)','simpl_chinese','zh','simpl_chinese',1,
23,'Slovenscina','slovenian','sl','slovenian',1,
24,'Español','spanish','es','spanish',1,
25,'Svenska','swedish','sv','swedish',1,
26,'Thai','thai','th','thai',1,
27,'Türkçe','turkce','tr','turkce',0,
28,'Viêt (Tiêng V.)','vietnamese','vi','vietnamese',0,
29,'Norsk','norwegian','no','norwegian',1,
30,'Farsi','persian','fa','persian',1,
31,'Srpski','serbian','sr','serbian',1,
32,'Bosanski','bosnian',NULL,'bosnian',1,
33,'Swahili (kiSw.)','swahili','sw','swahili',0,
34,'Esperanto','esperanto','eo','esperanto',1,
35,'Ukrainian','ukrainian','uk','ukrainian',0,
1 18 'Melayu (Bahasa M.)' 'malay' 'ms' 'malay' 0
2 17 'Nihongo' 'japanese' 'ja' 'japanese' 0
3 16 'Italiano' 'italian' 'it' 'italian' 1
4 14 'Magyar' 'hungarian' 'hu' 'hungarian' 1
5 13 'Ellinika' 'greek' 'el' 'greek' 0
6 12 'Deutsch' 'german' 'de' 'german' 1
7 11 'Galego' 'galician' 'gl' 'galician' 1
8 15 'Indonesia (Bahasa I.)' 'indonesian' 'id' 'indonesian' 1
9 10 'Français' 'french' 'fr' 'french' 1
10 9 'Suomi' 'finnish' 'fi' 'finnish' 1
11 8 'English' 'english' 'en' 'english' 1
12 7 'Nederlands' 'dutch' 'nl' 'dutch' 1
13 6 'Dansk' 'danish' 'da' 'danish' 1
14 5 'Hrvatski' 'croatian' 'hr' 'croatian' 0
15 4 'Català' 'catalan' 'ca' 'catalan' 0
16 3 'Balgarski' 'bulgarian' 'bg' 'bulgarian' 1
17 2 'Português (Brazil)' 'brazilian' 'pt-BR' 'brazilian' 1
18 1 'Arabija (el)' 'arabic' 'ar' 'arabic' 0
19 19 'Polski' 'polish' 'pl' 'polish' 1
20 20 'Português (Portugal)' 'portuguese' 'pt' 'portuguese' 1
21 21 'Russkij' 'russian' 'ru' 'russian' 1
22 22 'Chinese (simplified)' 'simpl_chinese' 'zh' 'simpl_chinese' 1
23 23 'Slovenscina' 'slovenian' 'sl' 'slovenian' 1
24 24 'Español' 'spanish' 'es' 'spanish' 1
25 25 'Svenska' 'swedish' 'sv' 'swedish' 1
26 26 'Thai' 'thai' 'th' 'thai' 1
27 27 'Türkçe' 'turkce' 'tr' 'turkce' 0
28 28 'Viêt (Tiêng V.)' 'vietnamese' 'vi' 'vietnamese' 0
29 29 'Norsk' 'norwegian' 'no' 'norwegian' 1
30 30 'Farsi' 'persian' 'fa' 'persian' 1
31 31 'Srpski' 'serbian' 'sr' 'serbian' 1
32 32 'Bosanski' 'bosnian' NULL 'bosnian' 1
33 33 'Swahili (kiSw.)' 'swahili' 'sw' 'swahili' 0
34 34 'Esperanto' 'esperanto' 'eo' 'esperanto' 1
35 35 'Ukrainian' 'ukrainian' 'uk' 'ukrainian' 0

@ -194,7 +194,6 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
//TODO only update this table
/*
$language_table = "`$dbNameForm`.`language`";
fill_language_table($language_table);
//set the settings from the form or the old config into config settings.
//These settings are considered "safe" because they are entered by the admin

@ -15,13 +15,6 @@ class TestInstallUpgrade extends UnitTestCase{
//var_dump($res);
}
public function testFillLanguageTable() {
$language_table='spanish';
$res = fill_language_table($language_table);
$this->assertTrue(is_null($res));
//var_dump($res);
}
public function testFillSettingsTable() {
$settings_options_table='';
$res = fill_settings_options_table($settings_options_table);
@ -49,8 +42,8 @@ class TestInstallUpgrade extends UnitTestCase{
}
//This function is ok but the problem is than create course with other code
/*
public function testLoadMainDatabase() {
$chamilo_path_folder= api_get_path(SYS_CODE_PATH);
public function testLoadMainDatabase() {
$chamilo_path_folder= api_get_path(SYS_CODE_PATH);
$installation_settings['{ORGANISATIONNAME}'] = 'My Organisation';
$installation_settings['{ORGANISATIONURL}'] = 'http://www.chamilo.org';
$installation_settings['{CAMPUSNAME}'] = 'My campus';
@ -65,8 +58,8 @@ class TestInstallUpgrade extends UnitTestCase{
$installation_settings['{ADMINPHONE}'] = '(000) 001 02 03';
$installation_settings['{PLATFORM_AUTH_SOURCE}'] = PLATFORM_AUTH_SOURCE;
$installation_settings['{ADMINLANGUAGE}'] = 'spanish';
$installation_settings['{HASHFUNCTIONMODE}'] = 'md5';
$db_script = $chamilo_path_folder.'install/dokeos_main.sql';
$installation_settings['{HASHFUNCTIONMODE}'] = 'md5';
$db_script = $chamilo_path_folder.'install/dokeos_main.sql';
$res = load_main_database($installation_settings,$db_script);
$this->assertFalse($res);
}
@ -100,20 +93,20 @@ class TestInstallUpgrade extends UnitTestCase{
//var_dump($res);
}
public function testMyDirectoryToArray() {
public function testMyDirectoryToArray() {
$chamilo_path_folder= api_get_path(SYS_PATH);
$directory= $chamilo_path_folder.'home';
$res = my_directory_to_array($directory);
$this->assertTrue(is_array($res));
$this->assertTrue(is_array($res));
}
/*
public function testDeleteCourse() {
global $cidReq;
global $cidReq;
$resu = CourseManager::delete_course($cidReq);
session_destroy();
session_destroy();
}*/
}
?>

Loading…
Cancel
Save