summaryrefslogtreecommitdiffstats
path: root/apis
diff options
context:
space:
mode:
authorSimon Rettberg2014-08-18 19:26:33 +0200
committerSimon Rettberg2014-08-18 19:26:33 +0200
commit428dcc01350673171c4700c83d90bf6fd73adc1e (patch)
treec6849e1ca2ed855569d866ddd3dc3e925e4acacd /apis
parent[i18n] Fix loading of messages (diff)
downloadslx-admin-428dcc01350673171c4700c83d90bf6fd73adc1e.tar.gz
slx-admin-428dcc01350673171c4700c83d90bf6fd73adc1e.tar.xz
slx-admin-428dcc01350673171c4700c83d90bf6fd73adc1e.zip
[i18n] Moved all texts from cat_setting and setting to json files
Diffstat (limited to 'apis')
-rw-r--r--apis/update.inc.php49
1 files changed, 42 insertions, 7 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php
index bab6bcea..3c4acfb2 100644
--- a/apis/update.inc.php
+++ b/apis/update.inc.php
@@ -1,6 +1,6 @@
<?php
-$targetVersion = 3;
+$targetVersion = 4;
// #######################
@@ -33,7 +33,6 @@ if ($currentVersion < $targetVersion) {
die("Updated to $currentVersion");
// #######################
-
// ##### 2014-05-28
// Add dateline field to property table
@@ -41,9 +40,11 @@ function update_1()
{
$res = Database::simpleQuery("DESCRIBE property", array(), false);
$type = false;
- if ($res === false) return;
+ if ($res === false)
+ return;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['Field'] !== 'dateline') continue;
+ if ($row['Field'] !== 'dateline')
+ continue;
$type = $row['Type'];
break;
}
@@ -56,7 +57,6 @@ function update_1()
}
// #######################
-
// ##### 2014-06-05
// Add 'news' table to database schema
function update_2()
@@ -64,7 +64,8 @@ function update_2()
$res = Database::simpleQuery("show tables", array(), false);
$found = false;
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- if ($row['Tables_in_openslx'] !== 'news') continue;
+ if ($row['Tables_in_openslx'] !== 'news')
+ continue;
$found = true;
break;
}
@@ -81,4 +82,38 @@ function update_2()
");
}
return true;
-} \ No newline at end of file
+}
+
+// #######################
+// ##### 2014-08-18
+// Remove setting descriptions from DB, put into json files now
+function update_3()
+{
+ $res = Database::simpleQuery("DESCRIBE setting", array(), false);
+ if ($res !== false) {
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ switch ($row['Field']) {
+ case 'de':
+ case 'en':
+ case 'pt':
+ case 'description':
+ Database::exec("ALTER TABLE setting DROP {$row['Field']}");
+ break;
+ }
+ }
+ }
+ $res = Database::simpleQuery("DESCRIBE cat_setting", array(), false);
+ if ($res !== false) {
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ switch ($row['Field']) {
+ case 'de':
+ case 'en':
+ case 'pt':
+ case 'name':
+ Database::exec("ALTER TABLE cat_setting DROP {$row['Field']}");
+ break;
+ }
+ }
+ }
+ return true;
+}