From d512f52e1f5a0fad93baf849c9737dfca35fad4c Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 13 Nov 2017 13:36:24 +0100 Subject: [PATCH] - Bugfix: check if parameter dependencies is present in extension.json - Bugfix: if it is a new installation all the SQLs will be executed, otherwise all the SQLs from version current + 1 will be executed --- application/libraries/ExtensionsLib.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/application/libraries/ExtensionsLib.php b/application/libraries/ExtensionsLib.php index 1472f27b8..efe1ea4e5 100644 --- a/application/libraries/ExtensionsLib.php +++ b/application/libraries/ExtensionsLib.php @@ -497,7 +497,7 @@ class ExtensionsLib 'license' => isset($extensionJson->license) ? $extensionJson->license : null, 'url' => isset($extensionJson->url) ? $extensionJson->url : null, 'core_version' => $extensionJson->core_version, - 'dependencies' => $extensionJson->dependencies + 'dependencies' => isset($extensionJson->dependencies) ? $extensionJson->dependencies : null ) ); if (isSuccess($result)) @@ -519,8 +519,17 @@ class ExtensionsLib private function _loadSQLs($pkgSQLsPath, $extensionJson) { $this->_printStart('Loading and executing SQL files'); + $this->_printInfo('WARNING: if this step will fail, the database and all the directories'); + $this->_printInfo('have to be clean manually before install again this extension'); - for ($sqlDir = $extensionJson->currentInstalledVersion; $sqlDir <= $extensionJson->version; $sqlDir++) + $startVersion = $extensionJson->currentInstalledVersion; + + if ($extensionJson->currentInstalledVersion < $extensionJson->version) + { + $startVersion++; + } + + for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++) { if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false) {