상수처리 개선 및 버그수정

This commit is contained in:
hanssem@forppl.com 2020-08-10 00:58:15 +09:00
parent e3879ac634
commit 3b8b79acf1
6 changed files with 67 additions and 59 deletions

View file

@ -104,16 +104,14 @@ class adminAdminView extends admin
return; return;
} }
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site ? $module_info->location_site : 'https://xe1.xpressengine.com/';
$download_server = $module_info->download_server ? $module_info->download_server : 'https://download.xpressengine.com/';
$oAutoinstallModel = getModel('autoinstall'); $oAutoinstallModel = getModel('autoinstall');
$params = array(); $params = array();
$params["act"] = "getResourceapiLastupdate"; $params["act"] = "getResourceapiLastupdate";
$body = XmlGenerater::generate($params); $body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml"); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml");
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff); $lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body; $updateDate = $lUpdateDoc->response->updatedate->body;

View file

@ -16,10 +16,6 @@ class autoinstallAdminController extends autoinstall
*/ */
function init() function init()
{ {
$oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleConfig('autoinstall');
$location_site = $module_info->location_site ? $module_info->location_site : 'https://xe1.xpressengine.com/';
$download_server = $module_info->download_server ? $module_info->download_server : 'https://download.xpressengine.com/';
} }
/** /**
@ -79,12 +75,10 @@ class autoinstallAdminController extends autoinstall
'ssl_verify_host' => FALSE 'ssl_verify_host' => FALSE
); );
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml = new XmlParser(); $xml = new XmlParser();
$xmlDoc = $xml->parse($buff); $xmlDoc = $xml->parse($buff);
$this->updateCategory($xmlDoc); $this->updateCategory($xmlDoc);
@ -233,12 +227,10 @@ class autoinstallAdminController extends autoinstall
$oModuleInstaller = new FTPModuleInstaller($package); $oModuleInstaller = new FTPModuleInstaller($package);
} }
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$oModuleInstaller->setServerUrl($download_server); $oModuleInstaller->setServerUrl($config->download_server);
$oModuleInstaller->setPassword($ftp_password); $oModuleInstaller->setPassword($ftp_password);
$output = $oModuleInstaller->install(); $output = $oModuleInstaller->install();
if(!$output->toBool()) if(!$output->toBool())
@ -411,12 +403,10 @@ class autoinstallAdminController extends autoinstall
$oModuleInstaller = new FTPModuleInstaller($package); $oModuleInstaller = new FTPModuleInstaller($package);
} }
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$oModuleInstaller->setServerUrl($download_server); $oModuleInstaller->setServerUrl($config->download_server);
$oModuleInstaller->setPassword($ftp_password); $oModuleInstaller->setPassword($ftp_password);
$output = $oModuleInstaller->uninstall(); $output = $oModuleInstaller->uninstall();
@ -436,12 +426,12 @@ class autoinstallAdminController extends autoinstall
{ {
// if end of string does not have a slash, add it // if end of string does not have a slash, add it
$_location_site = Context::get('location_site'); $_location_site = Context::get('location_site');
if(substr($_location_site, -1) != '/') if(substr($_location_site, -1) != '/' && strlen($_location_site) > 0)
{ {
$_location_site .= '/'; $_location_site .= '/';
} }
$_download_server = Context::get('download_server'); $_download_server = Context::get('download_server');
if(substr($_download_server, -1) != '/') if(substr($_download_server, -1) != '/' && strlen($_download_server) > 0)
{ {
$_download_server .= '/'; $_download_server .= '/';
} }

View file

@ -420,6 +420,37 @@ class autoinstallAdminModel extends autoinstall
return new BaseObject(); return new BaseObject();
} }
public function getAutoInstallAdminModuleConfig()
{
$oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleConfig('autoinstall');
$_location_site = 'https://xe1.xpressengine.com/';
$_download_server = 'https://download.xpressengine.com/';
if($module_info->location_site && $module_info->download_server)
{
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
}
else
{
$args = new stdClass();
$args->location_site = $_location_site;
$args->download_server = $_download_server;
$oModuleController = getController('module');
$output = $oModuleController->updateModuleConfig('autoinstall', $args);
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
}
$obj = new stdClass();
$obj->location_site = $location_site ? $location_site : $_location_site;
$obj->download_server = $download_server ? $download_server : $_download_server;
return $obj;
}
} }
/* End of file autoinstall.admin.model.php */ /* End of file autoinstall.admin.model.php */
/* Location: ./modules/autoinstall/autoinstall.admin.model.php */ /* Location: ./modules/autoinstall/autoinstall.admin.model.php */

View file

@ -27,14 +27,12 @@ class autoinstallAdminView extends autoinstall
*/ */
function init() function init()
{ {
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site ? $module_info->location_site : 'https://xe1.xpressengine.com/';
$download_server = $module_info->download_server ? $module_info->download_server : 'https://download.xpressengine.com/';
$template_path = sprintf("%stpl/", $this->module_path); $template_path = sprintf("%stpl/", $this->module_path);
Context::set('original_site', $location_site); Context::set('original_site', $config->location_site);
Context::set('uri', $download_server); Context::set('uri', $config->download_server);
$this->setTemplatePath($template_path); $this->setTemplatePath($template_path);
$ftp_info = Context::getFTPInfo(); $ftp_info = Context::getFTPInfo();
@ -197,17 +195,15 @@ class autoinstallAdminView extends autoinstall
$depto = array(); $depto = array();
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
foreach($items as $item) foreach($items as $item)
{ {
$v = $this->rearrange($item, $targets); $v = $this->rearrange($item, $targets);
$v->item_screenshot_url = str_replace('./', $download_server, $v->item_screenshot_url); $v->item_screenshot_url = str_replace('./', $config->download_server, $v->item_screenshot_url);
$v->category = $this->categories[$v->category_srl]->title; $v->category = $this->categories[$v->category_srl]->title;
$v->url = $location_site . '?mid=download&package_srl=' . $v->package_srl; $v->url = $config->location_site . '?mid=download&package_srl=' . $v->package_srl;
if($packages[$v->package_srl]) if($packages[$v->package_srl])
{ {
@ -335,12 +331,10 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_host' => FALSE 'ssl_verify_host' => FALSE
); );
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XmlParser();
$xmlDoc = $xml_lUpdate->parse($buff); $xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item) if($xmlDoc && $xmlDoc->response->packagelist->item)
@ -434,12 +428,10 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_host' => FALSE 'ssl_verify_host' => FALSE
); );
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff); $lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body; $updateDate = $lUpdateDoc->response->updatedate->body;
@ -591,12 +583,10 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_host' => FALSE 'ssl_verify_host' => FALSE
); );
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XmlParser();
$xmlDoc = $xml_lUpdate->parse($buff); $xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item) if($xmlDoc && $xmlDoc->response->packagelist->item)

View file

@ -13,6 +13,7 @@
<action name="getAutoinstallAdminSkinPackageList" type="model" /> <action name="getAutoinstallAdminSkinPackageList" type="model" />
<action name="getAutoinstallAdminIsAuthed" type="model" /> <action name="getAutoinstallAdminIsAuthed" type="model" />
<action name="getAutoInstallAdminInstallInfo" type="model" /> <action name="getAutoInstallAdminInstallInfo" type="model" />
<action name="getAutoInstallAdminModuleConfig" type="model" />
<action name="procAutoinstallAdminUpdateinfo" type="controller" /> <action name="procAutoinstallAdminUpdateinfo" type="controller" />
<action name="procAutoinstallAdminPackageinstall" type="controller" ruleset="ftp" /> <action name="procAutoinstallAdminPackageinstall" type="controller" ruleset="ftp" />

View file

@ -346,13 +346,11 @@ class menuAdminModel extends menu
$module->defaultMobileSkin->skin = $defaultMobileSkin; $module->defaultMobileSkin->skin = $defaultMobileSkin;
$module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin; $module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin;
$oModuleModel = getModel('module'); $oModel = getAdminModel('autoinstall');
$module_info = $oModuleModel->getModuleConfig('autoinstall'); $config = $oModel->getAutoInstallAdminModuleConfig();
$location_site = $module_info->location_site ? $module_info->location_site : 'https://xe1.xpressengine.com/';
$download_server = $module_info->download_server ? $module_info->download_server : 'https://download.xpressengine.com/';
$module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name); $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name);
$module->url = $location_site . '?mid=download&package_srl=' . $module->package_srl; $module->url = $config->location_site . '?mid=download&package_srl=' . $module->package_srl;
if($module_name == 'page') if($module_name == 'page')
{ {