Skip to content

Commit

Permalink
0017541: crash: storage_engine' has been deleted since mysql 5.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyer-ilias committed Nov 23, 2015
1 parent aa93b5d commit 3721bf8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Services/Database/classes/class.ilDBInnoDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ function initConnection()
{
$this->query("SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
}

$this->query("SET SESSION STORAGE_ENGINE = 'INNODB'");
$this->setStorageEngine('INNODB');
}

/**
Expand Down
33 changes: 29 additions & 4 deletions Services/Database/classes/class.ilDBMySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ function getDBType()
return "mysql";
}

/**
* 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
*/
Expand Down Expand Up @@ -328,10 +336,9 @@ function initConnection()
{
$this->query("SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
}

$this->query("SET SESSION STORAGE_ENGINE = 'MYISAM'");
$this->setStorageEngine('MYISAM');
}

/**
* now()
*
Expand Down Expand Up @@ -415,7 +422,25 @@ function isMysql4_1OrHigher()

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
*/
Expand Down

0 comments on commit 3721bf8

Please sign in to comment.