mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제 - 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제 - 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를 사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf() 처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
172 lines
3.7 KiB
PHP
172 lines
3.7 KiB
PHP
<?php
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
|
|
|
/**
|
|
* XML Generater
|
|
* @author NAVER (developers@xpressengine.com)
|
|
*/
|
|
class XmlGenerater
|
|
{
|
|
|
|
/**
|
|
* Generate XML using given data
|
|
*
|
|
* @param array $params The data
|
|
* @return string Returns xml string
|
|
*/
|
|
function generate(&$params)
|
|
{
|
|
$xmlDoc = '<?xml version="1.0" encoding="utf-8" ?><methodCall><params>';
|
|
if(!is_array($params))
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
$params["module"] = "resourceapi";
|
|
foreach($params as $key => $val)
|
|
{
|
|
$xmlDoc .= sprintf("<%s><![CDATA[%s]]></%s>", $key, $val, $key);
|
|
}
|
|
$xmlDoc .= "</params></methodCall>";
|
|
return $xmlDoc;
|
|
}
|
|
|
|
/**
|
|
* Request data to server and returns result
|
|
*
|
|
* @param array $params Request data
|
|
* @return object
|
|
*/
|
|
function getXmlDoc(&$params)
|
|
{
|
|
$body = XmlGenerater::generate($params);
|
|
$request_config = array(
|
|
'ssl_verify_peer' => FALSE,
|
|
'ssl_verify_host' => FALSE
|
|
);
|
|
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
|
|
if(!$buff)
|
|
{
|
|
return;
|
|
}
|
|
|
|
$xml = new XmlParser();
|
|
$xmlDoc = $xml->parse($buff);
|
|
return $xmlDoc;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* High class of the autoinstall module
|
|
* @author NAVER (developers@xpressengine.com)
|
|
*/
|
|
class autoinstall extends ModuleObject
|
|
{
|
|
|
|
/**
|
|
* Temporary directory path
|
|
*/
|
|
var $tmp_dir = './files/cache/autoinstall/';
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @return void
|
|
*/
|
|
function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* For additional tasks required when installing
|
|
*
|
|
* @return Object
|
|
*/
|
|
function moduleInstall()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Method to check if installation is succeeded
|
|
*
|
|
* @return bool
|
|
*/
|
|
function checkUpdate()
|
|
{
|
|
$oDB = DB::getInstance();
|
|
$oModuleModel = getModel('module');
|
|
|
|
if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml') && $oDB->isTableExists("autoinstall_installed_packages"))
|
|
{
|
|
return TRUE;
|
|
}
|
|
if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
|
|
&& $oDB->isTableExists("autoinstall_remote_categories"))
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
// 2011.08.08 add column 'list_order' in ai_remote_categories
|
|
if(!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
// 2012.11.12 add column 'have_instance' in autoinstall_packages
|
|
if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
/**
|
|
* Execute update
|
|
*
|
|
* @return Object
|
|
*/
|
|
function moduleUpdate()
|
|
{
|
|
$oDB = DB::getInstance();
|
|
$oModuleModel = getModel('module');
|
|
$oModuleController = getController('module');
|
|
|
|
if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml')
|
|
&& $oDB->isTableExists("autoinstall_installed_packages"))
|
|
{
|
|
$oDB->dropTable("autoinstall_installed_packages");
|
|
}
|
|
if(!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml')
|
|
&& $oDB->isTableExists("autoinstall_remote_categories"))
|
|
{
|
|
$oDB->dropTable("autoinstall_remote_categories");
|
|
}
|
|
|
|
// 2011.08.08 add column 'list_order' in 'ai_remote_categories
|
|
if(!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
|
|
{
|
|
$oDB->addColumn('ai_remote_categories', 'list_order', 'number', 11, NULL, TRUE);
|
|
$oDB->addIndex('ai_remote_categories', 'idx_list_order', array('list_order'));
|
|
}
|
|
|
|
// 2012.11.12 add column 'have_instance' in autoinstall_packages
|
|
if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
|
|
{
|
|
$oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Re-generate the cache file
|
|
* @return Object
|
|
*/
|
|
function recompileCache()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
/* End of file autoinstall.class.php */
|
|
/* Location: ./modules/autoinstall/autoinstall.class.php */
|