mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Only install and update default modules #1967
This commit is contained in:
parent
58d369cc31
commit
c70293edf2
1 changed files with 39 additions and 21 deletions
|
|
@ -458,7 +458,6 @@ class installController extends install
|
|||
*/
|
||||
function installDownloadedModule()
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
// Create a table ny finding schemas/*.xml file in each module
|
||||
$module_list = FileHandler::readDir('./modules/', NULL, false, true);
|
||||
$modules = array();
|
||||
|
|
@ -466,19 +465,29 @@ class installController extends install
|
|||
{
|
||||
// Get module name
|
||||
$module = basename($module_path);
|
||||
$xml_info = $oModuleModel->getModuleInfoXml($module);
|
||||
if(!$xml_info) continue;
|
||||
$modules[$xml_info->category][] = $module;
|
||||
|
||||
// Only install default modules at this time
|
||||
if (!Context::isDefaultPlugin($module, 'module'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to group modules by category
|
||||
$xml_info = ModuleModel::getModuleInfoXml($module);
|
||||
if (!$xml_info)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$modules[$xml_info->category ?: 'other'][] = $module;
|
||||
}
|
||||
|
||||
// Install "module" module in advance
|
||||
$this->installModule('module','./modules/module');
|
||||
$oModule = ModuleModel::getModuleInstallClass($module);
|
||||
if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate') && $oModule->checkUpdate())
|
||||
{
|
||||
$oModule->moduleUpdate();
|
||||
}
|
||||
$this->updateModule('module');
|
||||
|
||||
// Determine the order of module installation depending on category
|
||||
$install_step = array('system','content','member');
|
||||
|
||||
// Install all the remaining modules
|
||||
foreach($install_step as $category)
|
||||
{
|
||||
|
|
@ -488,16 +497,12 @@ class installController extends install
|
|||
{
|
||||
if($module == 'module') continue;
|
||||
$this->installModule($module, sprintf('./modules/%s', $module));
|
||||
|
||||
$oModule = ModuleModel::getModuleInstallClass($module);
|
||||
if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
|
||||
{
|
||||
if($oModule->checkUpdate()) $oModule->moduleUpdate();
|
||||
}
|
||||
$this->updateModule($module);
|
||||
}
|
||||
unset($modules[$category]);
|
||||
}
|
||||
}
|
||||
|
||||
// Install all the remaining modules
|
||||
if(count($modules))
|
||||
{
|
||||
|
|
@ -509,12 +514,7 @@ class installController extends install
|
|||
{
|
||||
if($module == 'module') continue;
|
||||
$this->installModule($module, sprintf('./modules/%s', $module));
|
||||
|
||||
$oModule = ModuleModel::getModuleInstallClass($module);
|
||||
if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
|
||||
{
|
||||
if($oModule->checkUpdate()) $oModule->moduleUpdate();
|
||||
}
|
||||
$this->updateModule($module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -573,6 +573,24 @@ class installController extends install
|
|||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a module if necessary.
|
||||
*
|
||||
* @param string $module
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateModule($module)
|
||||
{
|
||||
$oModule = ModuleModel::getModuleInstallClass($module);
|
||||
if (is_object($oModule) && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
|
||||
{
|
||||
if ($oModule->checkUpdate())
|
||||
{
|
||||
return $oModule->moduleUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder for third-party apps that try to manipulate system configuration.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue