Skip to content

Commit 37c4c70

Browse files
committed
fix activation to not remove config
update version
1 parent 7316cfc commit 37c4c70

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Config/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<descriptive locale="en_US">
88
<title>Keyword</title>
99
</descriptive>
10-
<version>2.4.6</version>
10+
<version>2.4.7</version>
1111
<author>
1212
<name>Michaël Espeche</name>
1313
<email>mespeche@openstudio.fr</email>

Keyword.php

+19-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323

2424
namespace Keyword;
2525

26+
use Keyword\Model\CategoryAssociatedKeywordQuery;
27+
use Keyword\Model\FolderAssociatedKeywordQuery;
28+
use Keyword\Model\ContentAssociatedKeywordQuery;
29+
use Keyword\Model\KeywordGroupQuery;
30+
use Keyword\Model\KeywordQuery;
31+
use Keyword\Model\ProductAssociatedKeywordQuery;
2632
use Propel\Runtime\Connection\ConnectionInterface;
2733
use Thelia\Install\Database;
2834
use Thelia\Module\BaseModule;
@@ -31,7 +37,18 @@ class Keyword extends BaseModule
3137
{
3238
public function postActivation(ConnectionInterface $con = null)
3339
{
34-
$database = new Database($con->getWrappedConnection());
35-
$database->insertSql(null, array(THELIA_ROOT . '/local/modules/Keyword/Config/thelia.sql'));
40+
41+
try {
42+
CategoryAssociatedKeywordQuery::create()->findOne();
43+
ContentAssociatedKeywordQuery::create()->findOne();
44+
FolderAssociatedKeywordQuery::create()->findOne();
45+
ProductAssociatedKeywordQuery::create()->findOne();
46+
KeywordQuery::create()->findOne();
47+
KeywordGroupQuery::create()->findOne();
48+
} catch (\Exception $e) {
49+
$database = new Database($con);
50+
$database->insertSql(null, [__DIR__ . "/Config/thelia.sql"]);
51+
}
52+
3653
}
3754
}

0 commit comments

Comments
 (0)