Skip to content

Commit

Permalink
Lowercase table name of advanced layout settings
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 committed Apr 15, 2020
1 parent 820e162 commit bfae434
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions application/modules/admin/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getInstallSql()
`info` VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `[prefix]_admin_layoutAdvSettings` (
CREATE TABLE IF NOT EXISTS `[prefix]_admin_layoutadvsettings` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`layoutKey` VARCHAR(255) NOT NULL,
`key` VARCHAR(255) NOT NULL,
Expand Down Expand Up @@ -660,7 +660,7 @@ public function getUpdate($installedVersion)
rename(ROOT_PATH.'/_vendor', ROOT_PATH.'/vendor');
break;
case "2.1.31":
$this->db()->query('CREATE TABLE IF NOT EXISTS `[prefix]_admin_layoutAdvSettings` (
$this->db()->query('CREATE TABLE IF NOT EXISTS `[prefix]_admin_layoutadvsettings` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`layoutKey` VARCHAR(255) NOT NULL,
`key` VARCHAR(255) NOT NULL,
Expand All @@ -672,6 +672,9 @@ public function getUpdate($installedVersion)
removeDir(ROOT_PATH.'/delete_vendor');
rename(ROOT_PATH.'/_vendor', ROOT_PATH.'/vendor');
break;
case "2.1.32":
// Lowercase table name as it caused problems on different os (case sensitive or insensitive)
$this->db()->query('ALTER TABLE `[prefix]_admin_layoutAdvSettings` RENAME TO `[prefix]_admin_layoutadvsettings`;');
}

return 'Update function executed.';
Expand Down
16 changes: 8 additions & 8 deletions application/modules/admin/mappers/LayoutAdvSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LayoutAdvSettings extends \Ilch\Mapper
public function getSetting($layoutKey, $key)
{
$result = $this->db()->select('*')
->from('admin_layoutAdvSettings')
->from('admin_layoutadvsettings')
->where(['layoutKey' => $layoutKey, 'key' => $key])
->execute()
->fetchAssoc();
Expand All @@ -52,7 +52,7 @@ public function getSetting($layoutKey, $key)
public function getSettings($layoutKey)
{
$array = $this->db()->select('*')
->from('admin_layoutAdvSettings')
->from('admin_layoutadvsettings')
->where(['layoutKey' => $layoutKey])
->execute()
->fetchRows();
Expand Down Expand Up @@ -82,7 +82,7 @@ public function getSettings($layoutKey)
public function getListOfLayoutKeys()
{
$layoutKeys = $this->db()->select('DISTINCT layoutKey')
->from('admin_layoutAdvSettings')
->from('admin_layoutadvsettings')
->execute()
->fetchList();

Expand Down Expand Up @@ -129,7 +129,7 @@ public function save($models)
*/
private function updateSetting($model)
{
$affectedRows = $this->db()->update('admin_layoutAdvSettings')
$affectedRows = $this->db()->update('admin_layoutadvsettings')
->values([
'layoutKey' => $model->getLayoutKey(),
'key' => $model->getKey(),
Expand All @@ -142,7 +142,7 @@ private function updateSetting($model)
// If the value was unchanged then affected rows will be 0, even though it was existing.
// Therefore check if the specific setting exists in this case.
return $this->db()->select('COUNT(*)')
->from('admin_layoutAdvSettings')
->from('admin_layoutadvsettings')
->where(['layoutKey' => $model->getLayoutKey(), 'key' => $model->getKey()])
->execute()
->fetchCell();
Expand All @@ -162,7 +162,7 @@ private function insertSetting($model)
return;
}

$this->db()->insert('admin_layoutAdvSettings')
$this->db()->insert('admin_layoutadvsettings')
->values([
'layoutKey' => $model->getLayoutKey(),
'key' => $model->getKey(),
Expand All @@ -180,7 +180,7 @@ private function insertSetting($model)
public function hasSettings($layoutKey)
{
return (bool)$this->db()->select('COUNT(*)')
->from('admin_layoutAdvSettings')
->from('admin_layoutadvsettings')
->where(['layoutKey' => $layoutKey])
->execute()
->fetchCell();
Expand Down Expand Up @@ -225,7 +225,7 @@ public function deleteSettings($layoutKey)
*/
private function deleteBy($where)
{
$this->db()->delete('admin_layoutAdvSettings')
$this->db()->delete('admin_layoutadvsettings')
->where($where)
->execute();
}
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$serverTimeZone = @date_default_timezone_get();
date_default_timezone_set('UTC');

define('VERSION', '2.1.32');
define('VERSION', '2.1.33');
define('ILCH_SERVER', 'http://www.ilch.de/ilch2');
define('SERVER_TIMEZONE', $serverTimeZone);
define('DEFAULT_MODULE', 'page');
Expand Down

0 comments on commit bfae434

Please sign in to comment.