Fix some modules not being updated during initial install

This commit is contained in:
Kijin Sung 2023-06-21 00:39:52 +09:00
parent 2af94e496e
commit 7b39fac881
2 changed files with 16 additions and 6 deletions

View file

@ -2,7 +2,7 @@
/**
* This script updates all modules.
*
*
* Running this script on the CLI is better than clicking 'update' in the
* admin dashboard because some module updates may take a long time.
*/
@ -47,10 +47,13 @@ $oInstallAdminController = getAdminController('install');
foreach ($need_update as $module)
{
echo 'Updating ' . $module . '...' . PHP_EOL;
$oModule = getModule($module, 'class');
if ($oModule)
$oModule = ModuleModel::getModuleInstallClass($module);
if (is_object($oModule) && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
{
$oModule->moduleUpdate();
if ($oModule->checkUpdate())
{
return $oModule->moduleUpdate();
}
}
}

View file

@ -487,6 +487,7 @@ class installController extends install
// Determine the order of module installation depending on category
$install_step = array('system','content','member');
$update_order = [];
// Install all the remaining modules
foreach($install_step as $category)
@ -497,7 +498,7 @@ class installController extends install
{
if($module == 'module') continue;
$this->installModule($module, sprintf('./modules/%s', $module));
$this->updateModule($module);
$update_order[] = $module;
}
unset($modules[$category]);
}
@ -514,12 +515,18 @@ class installController extends install
{
if($module == 'module') continue;
$this->installModule($module, sprintf('./modules/%s', $module));
$this->updateModule($module);
$update_order[] = $module;
}
}
}
}
// Update all modules
foreach ($update_order as $module)
{
$this->updateModule($module);
}
return new BaseObject();
}