Skip to content

Commit

Permalink
Merge pull request #88 from ggoffy/master
Browse files Browse the repository at this point in the history
adapted update due to new semantic versioning
  • Loading branch information
ggoffy authored Aug 6, 2022
2 parents 2d7841f + 459dc09 commit 282b5e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<h5>1.15 RC2</h5> [2021/04/19]
<hr>
Expand Down
12 changes: 8 additions & 4 deletions include/onupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 282b5e6

Please sign in to comment.