diff --git a/docs/changelog.txt b/docs/changelog.txt index 188fe45..274fce3 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -7,6 +7,7 @@ - added chmod in install/update (cesagonchu/goffy) - hide download button when album is empty (cesagonchu/goffy) - fixed bug with download zip (cesagonchu/goffy) + - adapted update due to new semantic versioning (goffy)
1.15 RC2
[2021/04/19]
diff --git a/include/onupdate.php b/include/onupdate.php index b68f63d..dde386a 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -80,17 +80,21 @@ function xoops_module_update_wggallery($module, $prev_version = null) //$migrate->setDefinitionFile('update_' . $moduleDirName); //} catch (\Exception $e) { // as long as this is not done default file has to be created - $moduleVersion = $module->getInfo('version'); - $fileYaml = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . "/sql/{$moduleDirName}_{$moduleVersion}_migrate.yml"; + $moduleVersionOld = $module->getInfo('version'); + $moduleVersionNew = \str_replace(['.', '-'], '_', $moduleVersionOld); + $fileYaml = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . "/sql/{$moduleDirName}_{$moduleVersionNew}_migrate.yml"; //} // create a schema file based on sql/mysql.sql $migratehelper = new MigrateHelper($fileSql, $fileYaml); - if (!$migratehelper->createSchemaFromSqlfile()) { \xoops_error('Error: creation schema file failed!'); return false; - }; + } + + //create copy for XOOPS 2.5.11 Beta 1 and older versions + $fileYaml2 = \XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . "/sql/{$moduleDirName}_{$moduleVersionOld}_migrate.yml"; + \copy($fileYaml, $fileYaml2); // run standard procedure for db migration $migrate->synchronizeSchema();