Fix migration

This commit is contained in:
Laurent Destailleur 2021-06-23 11:14:28 +02:00
parent eb9be15c4c
commit f24d8a31af
3 changed files with 31 additions and 8 deletions

View File

@ -416,7 +416,7 @@ script:
- |
echo "Enabling new modules"
# Enable modules not enabled into original dump
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log

View File

@ -489,10 +489,16 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
'MAIN_MODULE_VARIANTS'=>'newboxdefonly',
'MAIN_MODULE_WEBSITE'=>'newboxdefonly',
);
migrate_reload_modules($db, $langs, $conf, $listofmodule);
$result = migrate_reload_modules($db, $langs, $conf, $listofmodule);
if ($result < 0) {
$error++;
}
// Reload menus (this must be always and only into last targeted version)
migrate_reload_menu($db, $langs, $conf);
$result = migrate_reload_menu($db, $langs, $conf);
if ($result < 0) {
$error++;
}
}
// Can force activation of some module during migration with parameter 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...'
@ -545,10 +551,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
print '</table>';
// Set constant to ask to remake a new ping to inform about upgrade (if first ping was done and OK)
$sql = 'UPDATE '.MAIN_DB_PREFIX."const SET VALUE = 'torefresh' WHERE name = 'MAIN_FIRST_PING_OK_ID'";
$db->query($sql, 1);
if (!$error) {
// Set constant to ask to remake a new ping to inform about upgrade (if first ping was done and OK)
$sql = 'UPDATE '.MAIN_DB_PREFIX."const SET VALUE = 'torefresh' WHERE name = 'MAIN_FIRST_PING_OK_ID'";
$db->query($sql, 1);
}
// We always commit.
// Process is designed so we can run it several times whatever is situation.
@ -4282,6 +4289,22 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod->remove('noboxes'); // We need to remove because a permission id has been removed
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_KNOWLEDGEMANAGEMENT') { // Permission has changed into 3.0 and 3.1
dolibarr_install_syslog("upgrade2::migrate_reload_modules Knowledge Management");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modKnowledgeManagement.class.php';
if ($res) {
$mod = new modKnowledgeManagement($db);
$mod->remove('noboxes'); // We need to remove because a permission id has been removed
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_EVENTORGANIZATION') { // Permission has changed into 3.0 and 3.1
dolibarr_install_syslog("upgrade2::migrate_reload_modules EventOrganization");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modEventOrganization.class.php';
if ($res) {
$mod = new modEventOrganization($db);
$mod->remove('noboxes'); // We need to remove because a permission id has been removed
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_PAYBOX') { // Permission has changed into 3.0
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php';

View File

@ -87,7 +87,7 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->knowledgemanagement->enabled)) {
// print __METHOD__." module knowledgemanagement order must be enabled.\n"; die(1);
print __METHOD__." module knowledgemanagement order must be enabled.\n"; die(1);
}
}