diff --git a/boot.php b/boot.php index 8837d88..3be28cd 100644 --- a/boot.php +++ b/boot.php @@ -41,3 +41,9 @@ rex_extension::register('REX_FORM_SAVED', 'iwcc_cache::write'); rex_extension::register('CLANG_ADDED', 'iwcc_clang::clangAdded'); rex_extension::register('CLANG_DELETED', 'iwcc_clang::clangDeleted'); + +if (rex_be_controller::getCurrentPagePart(1) == 'iwcc' && $this->getConfig('justInstalled')) +{ + $this->setConfig('justInstalled', false); + iwcc_clang::addonJustInstalled(); +} diff --git a/install.php b/install.php index c20d051..4377838 100644 --- a/install.php +++ b/install.php @@ -59,9 +59,6 @@ ->setPrimaryKey('pid') ->ensure(); - -if (!$this->hasConfig()) { - rex_sql_util::importDump(rex_addon::get('iwcc')->getPath('_install.sql')); - iwcc_clang::addonJustInstalled(); - $this->setConfig('config', []); +if ($this->getConfig('justInstalled', -1) === -1) { + $this->setConfig('justInstalled', true); } diff --git a/lib/iwcc_clang.php b/lib/iwcc_clang.php index 47e5158..6fd0ccc 100644 --- a/lib/iwcc_clang.php +++ b/lib/iwcc_clang.php @@ -195,11 +195,12 @@ private static function addClang($clangId) foreach (iwcc_config::getTables(1) as $table) { $firstLang = rex_sql::factory(); - $firstLang->setQuery('SELECT * FROM ' . $table . ' WHERE clang_id=?', [rex_clang::getStartId()]); + $firstLang->setTable($table); + $firstLang->setWhere('clang_id='.rex_clang::getStartId()); + $firstLang->select(); $fields = $firstLang->getFieldnames(); $newLang = rex_sql::factory(); - $newLang->setDebug(false); foreach ($firstLang as $firstLangEntry) { $newLang->setTable($table); diff --git a/package.yml b/package.yml index 0e87c03..c42d276 100644 --- a/package.yml +++ b/package.yml @@ -1,5 +1,5 @@ package: iwcc -version: '1.0.3' +version: '1.0.4' author: 'Friends Of REDAXO' supportpage: https://redaxo.org/support/community/#slack diff --git a/uninstall.php b/uninstall.php index 99318fd..ad833c6 100644 --- a/uninstall.php +++ b/uninstall.php @@ -1,5 +1,5 @@ removeConfig('config'); +rex_config::remove('iwcc', 'config'); rex_sql_table::get(rex::getTable('iwcc_cookiegroup'))->drop(); rex_sql_table::get(rex::getTable('iwcc_cookie'))->drop(); rex_sql_table::get(rex::getTable('iwcc_text'))->drop();