forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_storage_engine.patch
91 lines (85 loc) · 2.64 KB
/
db_storage_engine.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From 235e306470be92bb759770ad076fc32740886faa Mon Sep 17 00:00:00 2001
From: Stefan Schneider <[email protected]>
Date: Sat, 21 Nov 2015 13:58:29 +0100
Subject: [PATCH] The variable 'storage_engine' has been deleted since mysql
5.7.5
(https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_storage_engine).
The variable 'default_storage_engine' could be used instead of
'storage_engine'. It was introduced in mysql 5.5.3
(https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_storage_engine)
---
Services/Database/classes/class.ilDBInnoDB.php | 3 +--
Services/Database/classes/class.ilDBMySQL.php | 33 ++++++++++++++++++++++----
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/Services/Database/classes/class.ilDBInnoDB.php b/Services/Database/classes/class.ilDBInnoDB.php
index a482853..718066d 100755
--- a/Services/Database/classes/class.ilDBInnoDB.php
+++ b/Services/Database/classes/class.ilDBInnoDB.php
@@ -43,8 +43,7 @@ class ilDBInnoDB extends ilDBMySQL
{
$this->query("SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
}
-
- $this->query("SET SESSION STORAGE_ENGINE = 'INNODB'");
+ $this->setStorageEngine('INNODB');
}
/**
diff --git a/Services/Database/classes/class.ilDBMySQL.php b/Services/Database/classes/class.ilDBMySQL.php
index 9aecf27..d8d932f 100755
--- a/Services/Database/classes/class.ilDBMySQL.php
+++ b/Services/Database/classes/class.ilDBMySQL.php
@@ -219,6 +219,14 @@ class ilDBMySQL extends ilDB
}
/**
+ * Set the storage engine
+ */
+ function setStorageEngine($a_storage_engine) {
+ $storage_engine_var = ($this->isMysql5_6OrHigher()) ? "DEFAULT_STORAGE_ENGINE" : "STORAGE_ENGINE";
+ $this->query("SET SESSION " . $storage_engine_var . " = '" . $a_storage_engine . "'");
+ }
+
+ /**
* Get reserved words
*/
static function getReservedWords()
@@ -328,10 +336,9 @@ class ilDBMySQL extends ilDB
{
$this->query("SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
}
-
- $this->query("SET SESSION STORAGE_ENGINE = 'MYISAM'");
+ $this->setStorageEngine('MYISAM');
}
-
+
/**
* now()
*
@@ -415,7 +422,25 @@ class ilDBMySQL extends ilDB
return false;
}
-
+
+ /**
+ * check wether current MySQL server is version 5.6.x or higher
+ *
+ * NOTE: Two sourcecodes use this or a similar handling:
+ * - classes/class.ilDB.php
+ * - setup/classes/class.ilClient.php
+ */
+ function isMysql5_6OrHigher()
+ {
+ $version = explode(".", $this->getDBVersion());
+ if ((int)$version[0] >= 5 ||
+ ((int)$version[0] == 5 && (int)$version[1] >= 6))
+ {
+ return true;
+ }
+ return false;
+ }
+
/**
* Check query size
*/
--
2.4.9 (Apple Git-60)