mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
issue 2662 adminlogging, autoinstall
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12236 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
db5e4b2ff0
commit
71361410b6
10 changed files with 2290 additions and 2233 deletions
|
|
@ -1,42 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* adminlogging class
|
||||
* Base class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminlogging extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* adminlogging class
|
||||
* Base class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
* Install adminlogging module
|
||||
* @return Object
|
||||
*/
|
||||
class adminlogging extends ModuleObject {
|
||||
/**
|
||||
* Install adminlogging module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall() {
|
||||
return new Object();
|
||||
}
|
||||
function moduleInstall()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* If update is necessary it returns true
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* If update is necessary it returns true
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* Update module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Regenerate cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file adminlogging.class.php */
|
||||
/* Location: ./modules/adminlogging/adminlogging.class.php */
|
||||
|
|
|
|||
|
|
@ -1,39 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* adminloggingController class
|
||||
* controller class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminloggingController extends adminlogging
|
||||
{
|
||||
/**
|
||||
* adminloggingController class
|
||||
* controller class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class adminloggingController extends adminlogging {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
}
|
||||
function init()
|
||||
{
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert log
|
||||
* @return void
|
||||
*/
|
||||
function insertLog($module, $act)
|
||||
{
|
||||
if(!$module || !$act) return;
|
||||
/**
|
||||
* Insert log
|
||||
* @return void
|
||||
*/
|
||||
function insertLog($module, $act)
|
||||
{
|
||||
if(!$module || !$act) return;
|
||||
|
||||
$args->module = $module;
|
||||
$args->act = $act;
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$args->regdate = date('YmdHis');
|
||||
$args->requestVars = print_r(Context::getRequestVars(), true);
|
||||
$args->module = $module;
|
||||
$args->act = $act;
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$args->regdate = date('YmdHis');
|
||||
$args->requestVars = print_r(Context::getRequestVars(), true);
|
||||
|
||||
$output = executeQuery('adminlogging.insertLog', $args);
|
||||
}
|
||||
}
|
||||
?>
|
||||
$output = executeQuery('adminlogging.insertLog', $args);
|
||||
}
|
||||
}
|
||||
/* End of file adminlogging.controller.php */
|
||||
/* Location: ./modules/adminlogging/adminlogging.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* adminloggingModel class
|
||||
* model class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminloggingModel extends adminlogging
|
||||
{
|
||||
}
|
||||
/**
|
||||
* adminloggingModel class
|
||||
* model class of adminlogging module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/adminlogging
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminloggingModel extends adminlogging
|
||||
{
|
||||
}
|
||||
/* End of file adminlogging.model.php */
|
||||
/* Location: ./modules/adminlogging/adminlogging.model.php */
|
||||
|
|
|
|||
|
|
@ -1,308 +1,191 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
|
||||
/**
|
||||
* autoinstall module admin controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallAdminController extends autoinstall
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
|
||||
|
||||
/**
|
||||
* autoinstall module admin controller class
|
||||
/**
|
||||
* Check file checksum is equal
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class autoinstallAdminController extends autoinstall {
|
||||
* @param string $file local file path
|
||||
* @param string $checksum Recieved checksum from server
|
||||
* @return bool Returns true on equal local checksum and recieved checksum, otherwise false.
|
||||
*/
|
||||
function checkFileCheckSum($file, $checksum)
|
||||
{
|
||||
$local_checksum = md5_file(FileHandler::getRealPath($file));
|
||||
return ($local_checksum === $checksum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Clean download file
|
||||
*
|
||||
* @param object $obj
|
||||
* @return void
|
||||
*/
|
||||
function _cleanDownloaded($obj)
|
||||
{
|
||||
FileHandler::removeDir($obj->download_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check file checksum is equal
|
||||
*
|
||||
* @param string $file local file path
|
||||
* @param string $checksum Recieved checksum from server
|
||||
* @return bool Returns true on equal local checksum and recieved checksum, otherwise false.
|
||||
*/
|
||||
function checkFileCheckSum($file, $checksum){
|
||||
$local_checksum = md5_file(FileHandler::getRealPath($file));
|
||||
return ($local_checksum === $checksum);
|
||||
}
|
||||
/**
|
||||
* Update easy install information
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminUpdateinfo()
|
||||
{
|
||||
$this->_updateinfo();
|
||||
$this->setMessage("success_updated", 'update');
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean download file
|
||||
*
|
||||
* @param object $obj
|
||||
* @return void
|
||||
*/
|
||||
function _cleanDownloaded($obj){
|
||||
FileHandler::removeDir($obj->download_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update easy install information
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminUpdateinfo()
|
||||
{
|
||||
$this->_updateinfo();
|
||||
$this->setMessage("success_updated", 'update');
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update easy install information
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _updateinfo(){
|
||||
$oModel = &getModel('autoinstall');
|
||||
$item = $oModel->getLatestPackage();
|
||||
if($item)
|
||||
{
|
||||
$params["updatedate"] = $item->updatedate;
|
||||
}
|
||||
|
||||
$params["act"] = "getResourceapiUpdate";
|
||||
$body = XmlGenerater::generate($params);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->parse($buff);
|
||||
$this->updateCategory($xmlDoc);
|
||||
$this->updatePackages($xmlDoc);
|
||||
$this->checkInstalled();
|
||||
|
||||
$oAdminController = &getAdminController('admin');
|
||||
$output = $oAdminController->cleanFavorite();
|
||||
/**
|
||||
* Update easy install information
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _updateinfo()
|
||||
{
|
||||
$oModel = &getModel('autoinstall');
|
||||
$item = $oModel->getLatestPackage();
|
||||
if($item)
|
||||
{
|
||||
$params["updatedate"] = $item->updatedate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update installed package information
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkInstalled()
|
||||
{
|
||||
executeQuery("autoinstall.deleteInstalledPackage");
|
||||
$oModel =& getModel('autoinstall');
|
||||
$packages = $oModel->getPackages();
|
||||
foreach($packages as $package)
|
||||
{
|
||||
$real_path = FileHandler::getRealPath($package->path);
|
||||
if(!file_exists($real_path)) {
|
||||
continue;
|
||||
}
|
||||
$params["act"] = "getResourceapiUpdate";
|
||||
$body = XmlGenerater::generate($params);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->parse($buff);
|
||||
$this->updateCategory($xmlDoc);
|
||||
$this->updatePackages($xmlDoc);
|
||||
$this->checkInstalled();
|
||||
|
||||
$type = $oModel->getTypeFromPath($package->path);
|
||||
if($type == "core")
|
||||
{
|
||||
$version = __ZBXE_VERSION__;
|
||||
}
|
||||
else
|
||||
{
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
{
|
||||
case "m.layout":
|
||||
$type = "layout";
|
||||
case "module":
|
||||
case "addon":
|
||||
case "layout":
|
||||
case "widget":
|
||||
$config_file = "/conf/info.xml";
|
||||
break;
|
||||
case "component":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
case "style":
|
||||
case "m.skin":
|
||||
$type = "skin";
|
||||
case "skin":
|
||||
case "widgetstyle":
|
||||
$config_file = "/skin.xml";
|
||||
break;
|
||||
case "drcomponent":
|
||||
$config_file = "/info.xml";
|
||||
$type = "component";
|
||||
break;
|
||||
case "theme":
|
||||
$config_file = "/conf/info.xml";
|
||||
$type = "theme";
|
||||
break;
|
||||
}
|
||||
if(!$config_file) continue;
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
$version = $xmlDoc->{$type}->version->body;
|
||||
}
|
||||
$oAdminController = &getAdminController('admin');
|
||||
$output = $oAdminController->cleanFavorite();
|
||||
}
|
||||
|
||||
$args = null;
|
||||
$args->package_srl = $package->package_srl;
|
||||
$args->version = $package->version;
|
||||
$args->current_version = $version;
|
||||
if(version_compare($args->version, $args->current_version, ">"))
|
||||
{
|
||||
$args->need_update="Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->need_update="N";
|
||||
}
|
||||
|
||||
$output = executeQuery("autoinstall.insertInstalledPackage", $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install package
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminPackageinstall()
|
||||
{
|
||||
@set_time_limit(0);
|
||||
$package_srls = Context::get('package_srl');
|
||||
$oModel =& getModel('autoinstall');
|
||||
$packages = explode(',', $package_srls);
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
$ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_password = $_SESSION['ftp_password'];
|
||||
}
|
||||
|
||||
$isSftpSupported = function_exists(ssh2_sftp);
|
||||
foreach($packages as $package_srl)
|
||||
{
|
||||
$package = $oModel->getPackage($package_srl);
|
||||
if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
|
||||
{
|
||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||
}
|
||||
else if(function_exists(ftp_connect))
|
||||
{
|
||||
$oModuleInstaller = new PHPFTPModuleInstaller($package);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleInstaller = new FTPModuleInstaller($package);
|
||||
}
|
||||
|
||||
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->install();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
|
||||
$this->_updateinfo();
|
||||
|
||||
$this->setMessage('success_installed', 'update');
|
||||
|
||||
if (Context::get('return_url'))
|
||||
/**
|
||||
* Update installed package information
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function checkInstalled()
|
||||
{
|
||||
executeQuery("autoinstall.deleteInstalledPackage");
|
||||
$oModel =& getModel('autoinstall');
|
||||
$packages = $oModel->getPackages();
|
||||
foreach($packages as $package)
|
||||
{
|
||||
$real_path = FileHandler::getRealPath($package->path);
|
||||
if(!file_exists($real_path))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('return_url'));
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = $oModel->getTypeFromPath($package->path);
|
||||
if($type == "core")
|
||||
{
|
||||
$version = __ZBXE_VERSION__;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(preg_replace('/act=[^&]*/', 'act=dispAutoinstallAdminIndex', Context::get('error_return_url')));
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
{
|
||||
case "m.layout":
|
||||
$type = "layout";
|
||||
case "module":
|
||||
case "addon":
|
||||
case "layout":
|
||||
case "widget":
|
||||
$config_file = "/conf/info.xml";
|
||||
break;
|
||||
case "component":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
case "style":
|
||||
case "m.skin":
|
||||
$type = "skin";
|
||||
case "skin":
|
||||
case "widgetstyle":
|
||||
$config_file = "/skin.xml";
|
||||
break;
|
||||
case "drcomponent":
|
||||
$config_file = "/info.xml";
|
||||
$type = "component";
|
||||
break;
|
||||
case "theme":
|
||||
$config_file = "/conf/info.xml";
|
||||
$type = "theme";
|
||||
break;
|
||||
}
|
||||
if(!$config_file) continue;
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
$version = $xmlDoc->{$type}->version->body;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update package informations using recieved data from server
|
||||
*
|
||||
* @param object $xmlDoc Recieved data
|
||||
* @return void
|
||||
*/
|
||||
function updatePackages(&$xmlDoc)
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!$xmlDoc->response->packages->item) return;
|
||||
if(!is_array($xmlDoc->response->packages->item))
|
||||
{
|
||||
$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
|
||||
}
|
||||
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl');
|
||||
foreach($xmlDoc->response->packages->item as $item)
|
||||
{
|
||||
$args = null;
|
||||
foreach($targets as $target)
|
||||
{
|
||||
$args->{$target} = $item->{$target}->body;
|
||||
}
|
||||
if($oModel->getPackage($args->package_srl))
|
||||
{
|
||||
$output = executeQuery("autoinstall.updatePackage", $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery("autoinstall.insertPackage", $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$output = executeQuery("autoinstall.deletePackage", $args);
|
||||
$output = executeQuery("autoinstall.insertPackage", $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$args = null;
|
||||
$args->package_srl = $package->package_srl;
|
||||
$args->version = $package->version;
|
||||
$args->current_version = $version;
|
||||
if(version_compare($args->version, $args->current_version, ">"))
|
||||
{
|
||||
$args->need_update="Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->need_update="N";
|
||||
}
|
||||
|
||||
/**
|
||||
* Update category using recived data from server.
|
||||
*
|
||||
* @param object $xmlDoc Recived data
|
||||
* @return void
|
||||
*/
|
||||
function updateCategory(&$xmlDoc)
|
||||
{
|
||||
executeQuery("autoinstall.deleteCategory");
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!is_array($xmlDoc->response->categorylist->item))
|
||||
{
|
||||
$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
|
||||
}
|
||||
$list_order = 0;
|
||||
foreach($xmlDoc->response->categorylist->item as $item)
|
||||
{
|
||||
$args = null;
|
||||
$args->category_srl = $item->category_srl->body;
|
||||
$args->parent_srl = $item->parent_srl->body;
|
||||
$args->title = $item->title->body;
|
||||
$args->list_order = $list_order++;
|
||||
$output = executeQuery("autoinstall.insertCategory", $args);
|
||||
}
|
||||
}
|
||||
$output = executeQuery("autoinstall.insertInstalledPackage", $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall package
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminUninstallPackage()
|
||||
/**
|
||||
* Install package
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminPackageinstall()
|
||||
{
|
||||
@set_time_limit(0);
|
||||
$package_srls = Context::get('package_srl');
|
||||
$oModel =& getModel('autoinstall');
|
||||
$packages = explode(',', $package_srls);
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
$ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_password = $_SESSION['ftp_password'];
|
||||
}
|
||||
|
||||
$isSftpSupported = function_exists(ssh2_sftp);
|
||||
foreach($packages as $package_srl)
|
||||
{
|
||||
$package_srl = Context::get('package_srl');
|
||||
$oModel =& getModel('autoinstall');
|
||||
$package = $oModel->getPackage($package_srl);
|
||||
$path = $package->path;
|
||||
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
$ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_password = $_SESSION['ftp_password'];
|
||||
}
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
|
||||
$isSftpSupported = function_exists(ssh2_sftp);
|
||||
if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
|
||||
{
|
||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||
}
|
||||
else if(function_exists('ftp_connect'))
|
||||
else if(function_exists(ftp_connect))
|
||||
{
|
||||
$oModuleInstaller = new PHPFTPModuleInstaller($package);
|
||||
}
|
||||
|
|
@ -312,23 +195,144 @@
|
|||
}
|
||||
|
||||
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
|
||||
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->uninstall();
|
||||
$output = $oModuleInstaller->install();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
|
||||
$this->_updateinfo();
|
||||
$this->_updateinfo();
|
||||
|
||||
$this->setMessage('success_deleted', 'update');
|
||||
$this->setMessage('success_installed', 'update');
|
||||
|
||||
if (Context::get('return_url'))
|
||||
if(Context::get('return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('return_url'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(preg_replace('/act=[^&]*/', 'act=dispAutoinstallAdminIndex', Context::get('error_return_url')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update package informations using recieved data from server
|
||||
*
|
||||
* @param object $xmlDoc Recieved data
|
||||
* @return void
|
||||
*/
|
||||
function updatePackages(&$xmlDoc)
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!$xmlDoc->response->packages->item) return;
|
||||
if(!is_array($xmlDoc->response->packages->item))
|
||||
{
|
||||
$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
|
||||
}
|
||||
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl');
|
||||
foreach($xmlDoc->response->packages->item as $item)
|
||||
{
|
||||
$args = null;
|
||||
foreach($targets as $target)
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('return_url'));
|
||||
$args->{$target} = $item->{$target}->body;
|
||||
}
|
||||
if($oModel->getPackage($args->package_srl))
|
||||
{
|
||||
$output = executeQuery("autoinstall.updatePackage", $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstalledPackages'));
|
||||
$output = executeQuery("autoinstall.insertPackage", $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$output = executeQuery("autoinstall.deletePackage", $args);
|
||||
$output = executeQuery("autoinstall.insertPackage", $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
/**
|
||||
* Update category using recived data from server.
|
||||
*
|
||||
* @param object $xmlDoc Recived data
|
||||
* @return void
|
||||
*/
|
||||
function updateCategory(&$xmlDoc)
|
||||
{
|
||||
executeQuery("autoinstall.deleteCategory");
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!is_array($xmlDoc->response->categorylist->item))
|
||||
{
|
||||
$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
|
||||
}
|
||||
$list_order = 0;
|
||||
foreach($xmlDoc->response->categorylist->item as $item)
|
||||
{
|
||||
$args = null;
|
||||
$args->category_srl = $item->category_srl->body;
|
||||
$args->parent_srl = $item->parent_srl->body;
|
||||
$args->title = $item->title->body;
|
||||
$args->list_order = $list_order++;
|
||||
$output = executeQuery("autoinstall.insertCategory", $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall package
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAutoinstallAdminUninstallPackage()
|
||||
{
|
||||
$package_srl = Context::get('package_srl');
|
||||
$oModel =& getModel('autoinstall');
|
||||
$package = $oModel->getPackage($package_srl);
|
||||
$path = $package->path;
|
||||
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
$ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_password = $_SESSION['ftp_password'];
|
||||
}
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
|
||||
$isSftpSupported = function_exists(ssh2_sftp);
|
||||
if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
|
||||
{
|
||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||
}
|
||||
else if(function_exists('ftp_connect'))
|
||||
{
|
||||
$oModuleInstaller = new PHPFTPModuleInstaller($package);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleInstaller = new FTPModuleInstaller($package);
|
||||
}
|
||||
|
||||
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
|
||||
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->uninstall();
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->_updateinfo();
|
||||
|
||||
$this->setMessage('success_deleted', 'update');
|
||||
|
||||
if(Context::get('return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('return_url'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstalledPackages'));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file autoinstall.admin.controller.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,179 +1,181 @@
|
|||
<?php
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class autoinstallAdminModel extends autoinstall {
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallAdminModel extends autoinstall
|
||||
{
|
||||
|
||||
var $layout_category_srl = 18322954;
|
||||
var $mobile_layout_category_srl = 18994172;
|
||||
var $module_skin_category_srl = 18322943;
|
||||
var $module_mobile_skin_category_srl = 18994170;
|
||||
var $layout_category_srl = 18322954;
|
||||
var $mobile_layout_category_srl = 18994172;
|
||||
var $module_skin_category_srl = 18322943;
|
||||
var $module_mobile_skin_category_srl = 18994170;
|
||||
|
||||
/**
|
||||
* Pre process parameters
|
||||
*/
|
||||
function preProcParam(&$order_target, &$order_type, &$page)
|
||||
/**
|
||||
* Pre process parameters
|
||||
*/
|
||||
function preProcParam(&$order_target, &$order_type, &$page)
|
||||
{
|
||||
$order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1);
|
||||
if(!isset($order_target_array[$order_target]))
|
||||
{
|
||||
$order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1);
|
||||
if(!isset($order_target_array[$order_target]))
|
||||
{
|
||||
$order_target = 'newest';
|
||||
}
|
||||
|
||||
$order_type_array = array('asc' => 1, 'desc' => 1);
|
||||
if(!isset($order_type_array[$order_type]))
|
||||
{
|
||||
$order_type = 'desc';
|
||||
}
|
||||
|
||||
$page = (int)$page;
|
||||
if($page < 1)
|
||||
{
|
||||
$page = 1;
|
||||
}
|
||||
$order_target = 'newest';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of package that can have instance
|
||||
*/
|
||||
function getAutoinstallAdminMenuPackageList()
|
||||
$order_type_array = array('asc' => 1, 'desc' => 1);
|
||||
if(!isset($order_type_array[$order_type]))
|
||||
{
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('menu', $order_target, $order_type, $page, $search_keyword);
|
||||
$order_type = 'desc';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of layout package
|
||||
*/
|
||||
function getAutoinstallAdminLayoutPackageList()
|
||||
$page = (int)$page;
|
||||
if($page < 1)
|
||||
{
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
$page = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$type_array = array('M' => 1, 'P' => 1);
|
||||
$type = Context::get('type');
|
||||
if(!isset($type_array[$type]))
|
||||
{
|
||||
$type = 'P';
|
||||
}
|
||||
/**
|
||||
* Return list of package that can have instance
|
||||
*/
|
||||
function getAutoinstallAdminMenuPackageList()
|
||||
{
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
|
||||
if($type == 'P')
|
||||
{
|
||||
$category_srl = $this->layout_category_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_srl = $this->mobile_layout_category_srl;
|
||||
}
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('menu', $order_target, $order_type, $page, $search_keyword);
|
||||
}
|
||||
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('layout', $order_target, $order_type, $page, $search_keyword, $category_srl);
|
||||
/**
|
||||
* Return list of layout package
|
||||
*/
|
||||
function getAutoinstallAdminLayoutPackageList()
|
||||
{
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
|
||||
$type_array = array('M' => 1, 'P' => 1);
|
||||
$type = Context::get('type');
|
||||
if(!isset($type_array[$type]))
|
||||
{
|
||||
$type = 'P';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of module skin package
|
||||
*/
|
||||
function getAutoinstallAdminSkinPackageList()
|
||||
if($type == 'P')
|
||||
{
|
||||
Context::setRequestMethod('JSON');
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
$parent_program = Context::get('parent_program');
|
||||
|
||||
$type_array = array('M' => 1, 'P' => 1);
|
||||
$type = Context::get('type');
|
||||
if(!isset($type_array[$type]))
|
||||
{
|
||||
$type = 'P';
|
||||
}
|
||||
|
||||
if($type == 'P')
|
||||
{
|
||||
$category_srl = $this->module_skin_category_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_srl = $this->module_mobile_skin_category_srl;
|
||||
}
|
||||
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('skin', $order_target, $order_type, $page, $search_keyword, $category_srl, $parent_program);
|
||||
$category_srl = $this->layout_category_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_srl = $this->mobile_layout_category_srl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Package List
|
||||
*/
|
||||
function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL)
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('layout', $order_target, $order_type, $page, $search_keyword, $category_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of module skin package
|
||||
*/
|
||||
function getAutoinstallAdminSkinPackageList()
|
||||
{
|
||||
Context::setRequestMethod('JSON');
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
$order_target = Context::get('order_target');
|
||||
$order_type = Context::get('order_type');
|
||||
$page = Context::get('page');
|
||||
$parent_program = Context::get('parent_program');
|
||||
|
||||
$type_array = array('M' => 1, 'P' => 1);
|
||||
$type = Context::get('type');
|
||||
if(!isset($type_array[$type]))
|
||||
{
|
||||
if($type == 'menu')
|
||||
{
|
||||
$params["act"] = "getResourceapiMenuPackageList";
|
||||
}
|
||||
elseif($type == 'skin')
|
||||
{
|
||||
$params["act"] = "getResourceapiSkinPackageList";
|
||||
$params['parent_program'] = $parent_program;
|
||||
}
|
||||
else
|
||||
{
|
||||
$params["act"] = "getResourceapiPackagelist";
|
||||
}
|
||||
|
||||
$oAdminView = getAdminView('autoinstall');
|
||||
$params["order_target"] = $order_target;
|
||||
$params["order_type"] = $order_type;
|
||||
$params["page"] = $page;
|
||||
|
||||
if($category_srl)
|
||||
{
|
||||
$params["category_srl"] = $category_srl;
|
||||
}
|
||||
|
||||
if($search_keyword)
|
||||
{
|
||||
$params["search_keyword"] = $search_keyword;
|
||||
}
|
||||
|
||||
$xmlDoc = XmlGenerater::getXmlDoc($params);
|
||||
if($xmlDoc && $xmlDoc->response->packagelist->item)
|
||||
{
|
||||
$item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item);
|
||||
$this->add('item_list', $item_list);
|
||||
$array = array('total_count', 'total_page', 'cur_page', 'page_count', 'first_page', 'last_page');
|
||||
$page_nav = $oAdminView->rearrange($xmlDoc->response->page_navigation, $array);
|
||||
$page_navigation = new PageHandler($page_nav->total_count, $page_nav->total_page, $page_nav->cur_page, 5);
|
||||
$this->add('page_navigation', $page_navigation);
|
||||
}
|
||||
$type = 'P';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get is authed ftp
|
||||
*/
|
||||
function getAutoinstallAdminIsAuthed()
|
||||
if($type == 'P')
|
||||
{
|
||||
$is_authed = 0;
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
$is_authed = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_authed = (int)isset($_SESSION['ftp_password']);
|
||||
}
|
||||
|
||||
$this->add('is_authed', $is_authed);
|
||||
$category_srl = $this->module_skin_category_srl;
|
||||
}
|
||||
}
|
||||
?>
|
||||
else
|
||||
{
|
||||
$category_srl = $this->module_mobile_skin_category_srl;
|
||||
}
|
||||
|
||||
$this->preProcParam($order_target, $order_type, $page);
|
||||
$this->getPackageList('skin', $order_target, $order_type, $page, $search_keyword, $category_srl, $parent_program);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Package List
|
||||
*/
|
||||
function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL)
|
||||
{
|
||||
if($type == 'menu')
|
||||
{
|
||||
$params["act"] = "getResourceapiMenuPackageList";
|
||||
}
|
||||
elseif($type == 'skin')
|
||||
{
|
||||
$params["act"] = "getResourceapiSkinPackageList";
|
||||
$params['parent_program'] = $parent_program;
|
||||
}
|
||||
else
|
||||
{
|
||||
$params["act"] = "getResourceapiPackagelist";
|
||||
}
|
||||
|
||||
$oAdminView = getAdminView('autoinstall');
|
||||
$params["order_target"] = $order_target;
|
||||
$params["order_type"] = $order_type;
|
||||
$params["page"] = $page;
|
||||
|
||||
if($category_srl)
|
||||
{
|
||||
$params["category_srl"] = $category_srl;
|
||||
}
|
||||
|
||||
if($search_keyword)
|
||||
{
|
||||
$params["search_keyword"] = $search_keyword;
|
||||
}
|
||||
|
||||
$xmlDoc = XmlGenerater::getXmlDoc($params);
|
||||
if($xmlDoc && $xmlDoc->response->packagelist->item)
|
||||
{
|
||||
$item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item);
|
||||
$this->add('item_list', $item_list);
|
||||
$array = array('total_count', 'total_page', 'cur_page', 'page_count', 'first_page', 'last_page');
|
||||
$page_nav = $oAdminView->rearrange($xmlDoc->response->page_navigation, $array);
|
||||
$page_navigation = new PageHandler($page_nav->total_count, $page_nav->total_page, $page_nav->cur_page, 5);
|
||||
$this->add('page_navigation', $page_navigation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get is authed ftp
|
||||
*/
|
||||
function getAutoinstallAdminIsAuthed()
|
||||
{
|
||||
$is_authed = 0;
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
$is_authed = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_authed = (int)isset($_SESSION['ftp_password']);
|
||||
}
|
||||
|
||||
$this->add('is_authed', $is_authed);
|
||||
}
|
||||
}
|
||||
/* End of file autoinstall.admin.model.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.admin.model.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,155 +1,163 @@
|
|||
<?php
|
||||
/**
|
||||
* XML Generater
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class XmlGenerater
|
||||
{
|
||||
/**
|
||||
* XML Generater
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* Generate XML using given data
|
||||
*
|
||||
* @param array $params The data
|
||||
* @return string Returns xml string
|
||||
*/
|
||||
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);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
if(!$buff) return;
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->parse($buff);
|
||||
return $xmlDoc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* High class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class autoinstall extends ModuleObject {
|
||||
/**
|
||||
* Temporary directory path
|
||||
*/
|
||||
var $tmp_dir = './files/cache/autoinstall/';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function autoinstall()
|
||||
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)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if ($config->downloadServer != _XE_DOWNLOAD_SERVER_)
|
||||
{
|
||||
$this->stop('msg_not_match_server');
|
||||
}
|
||||
$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);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
if(!$buff) return;
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->parse($buff);
|
||||
return $xmlDoc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* High class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstall extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Temporary directory path
|
||||
*/
|
||||
var $tmp_dir = './files/cache/autoinstall/';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function autoinstall()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if ($config->downloadServer != _XE_DOWNLOAD_SERVER_)
|
||||
{
|
||||
$this->stop('msg_not_match_server');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For additional tasks required when installing
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
|
||||
$oModuleController->insertModuleConfig('autoinstall', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check if installation is succeeded
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_installed_packages"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_remote_categories.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_remote_categories"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* For additional tasks required when installing
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleInstall() {
|
||||
$oModuleController = &getController('module');
|
||||
// 2011.08.08 add column 'list_order' in ai_remote_categories
|
||||
if(!$oDB->isColumnExists('ai_remote_categories', 'list_order')) return true;
|
||||
|
||||
// 2011.08.08 set _XE_DOWNLOAD_SERVER_ at module config
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if(!isset($config->downloadServer)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_installed_packages"))
|
||||
{
|
||||
$oDB->dropTable("autoinstall_installed_packages");
|
||||
}
|
||||
if(!file_exists(FileHandler::getRealPath("./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'));
|
||||
}
|
||||
|
||||
// 2011. 08. 08 set _XE_DOWNLOAD_SERVER_ at module config
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if(!isset($config->downloadServer))
|
||||
{
|
||||
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
|
||||
$oModuleController->insertModuleConfig('autoinstall', $config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check if installation is succeeded
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_installed_packages"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!file_exists(FileHandler::getRealPath("./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;
|
||||
|
||||
// 2011.08.08 set _XE_DOWNLOAD_SERVER_ at module config
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if (!isset($config->downloadServer)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_installed_packages"))
|
||||
{
|
||||
$oDB->dropTable("autoinstall_installed_packages");
|
||||
}
|
||||
if(!file_exists(FileHandler::getRealPath("./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'));
|
||||
}
|
||||
|
||||
// 2011. 08. 08 set _XE_DOWNLOAD_SERVER_ at module config
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if (!isset($config->downloadServer)){
|
||||
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
|
||||
$oModuleController->insertModuleConfig('autoinstall', $config);
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return Object
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return Object
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file autoinstall.class.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,358 +1,361 @@
|
|||
<?php
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class autoinstallModel extends autoinstall {
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallModel extends autoinstall
|
||||
{
|
||||
/**
|
||||
* Get category information
|
||||
*
|
||||
* @param int $category_srl The sequence of category to get information
|
||||
* @return object
|
||||
*/
|
||||
function getCategory($category_srl)
|
||||
{
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQueryArray("autoinstall.getCategory", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category information
|
||||
*
|
||||
* @param int $category_srl The sequence of category to get information
|
||||
* @return object
|
||||
*/
|
||||
function getCategory($category_srl)
|
||||
{
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQueryArray("autoinstall.getCategory", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
/**
|
||||
* Get packages information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getPackages()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getPackages");
|
||||
if(!$output->data) return array();
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get packages information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getPackages()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getPackages");
|
||||
if(!$output->data) return array();
|
||||
return $output->data;
|
||||
}
|
||||
/**
|
||||
* Get installed packages information
|
||||
*
|
||||
* @param int $package_srl The sequence of package to get information
|
||||
* @return object
|
||||
*/
|
||||
function getInstalledPackage($package_srl)
|
||||
{
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed packages information
|
||||
*
|
||||
* @param int $package_srl The sequence of package to get information
|
||||
* @return object
|
||||
*/
|
||||
function getInstalledPackage($package_srl)
|
||||
{
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
/**
|
||||
* Get one package information
|
||||
*
|
||||
* @param int $package_srl The sequence of package to get information
|
||||
* @return object
|
||||
*/
|
||||
function getPackage($package_srl)
|
||||
{
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one package information
|
||||
*
|
||||
* @param int $package_srl The sequence of package to get information
|
||||
* @return object
|
||||
*/
|
||||
function getPackage($package_srl)
|
||||
{
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
/**
|
||||
* Get category list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCategoryList()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getCategories");
|
||||
if(!$output->toBool() || !$output->data) return array();
|
||||
|
||||
/**
|
||||
* Get category list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCategoryList()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getCategories");
|
||||
if(!$output->toBool() || !$output->data) return array();
|
||||
$categoryList = array();
|
||||
foreach($output->data as $category)
|
||||
{
|
||||
$category->children = array();
|
||||
$categoryList[$category->category_srl] = $category;
|
||||
}
|
||||
|
||||
$categoryList = array();
|
||||
foreach($output->data as $category)
|
||||
{
|
||||
$category->children = array();
|
||||
$categoryList[$category->category_srl] = $category;
|
||||
}
|
||||
|
||||
$depth0 = array();
|
||||
foreach($categoryList as $key => $category)
|
||||
{
|
||||
if($category->parent_srl)
|
||||
{
|
||||
$categoryList[$category->parent_srl]->children[] =& $categoryList[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
$depth0[] = $key;
|
||||
}
|
||||
}
|
||||
$resultList = array();
|
||||
foreach($depth0 as $category_srl)
|
||||
{
|
||||
$this->setDepth($categoryList[$category_srl], 0, $categoryList, $resultList);
|
||||
}
|
||||
return $resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pcakge count in category
|
||||
*
|
||||
* @param int $category_srl The sequence of category to get count
|
||||
* @return int
|
||||
*/
|
||||
function getPackageCount($category_srl)
|
||||
{
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQuery("autoinstall.getPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed package count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getInstalledPackageCount()
|
||||
{
|
||||
$output = executeQuery("autoinstall.getInstalledPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set depth, children list and package count of category
|
||||
*
|
||||
* @param object $item Category information
|
||||
* @param int $depth Depth of category
|
||||
* @param array $list Category list
|
||||
* @param array $resultList Final result list
|
||||
* @return string $siblingList Comma seperated list
|
||||
*/
|
||||
function setDepth(&$item, $depth, &$list, &$resultList)
|
||||
{
|
||||
$resultList[$item->category_srl] =& $item;
|
||||
$item->depth = $depth;
|
||||
$siblingList = $item->category_srl;
|
||||
foreach($item->children as $child)
|
||||
{
|
||||
$siblingList .= ",".$this->setDepth($list[$child->category_srl], $depth+1, $list, $resultList);
|
||||
}
|
||||
if(count($item->children) < 1)
|
||||
{
|
||||
$item->nPackages = $this->getPackageCount($item->category_srl);
|
||||
}
|
||||
$item->childrenList = $siblingList;
|
||||
return $siblingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastest package information
|
||||
*
|
||||
* @return object Returns lastest package information. If no result returns null.
|
||||
*/
|
||||
function getLatestPackage() {
|
||||
$output = executeQueryArray("autoinstall.getLatestPackage");
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed package informations
|
||||
*
|
||||
* @param array $package_list Package sequence list to get information
|
||||
* @return array Returns array contains pacakge information. If no result returns empty array.
|
||||
*/
|
||||
function getInstalledPackages($package_list) {
|
||||
$args->package_list = $package_list;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackages", $args);
|
||||
$result = array();
|
||||
if(!$output->data) return $result;
|
||||
foreach($output->data as $value)
|
||||
{
|
||||
$result[$value->package_srl] = $value;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed package list
|
||||
*
|
||||
* @param int $page
|
||||
* @return Object
|
||||
*/
|
||||
function getInstalledPackageList($page)
|
||||
{
|
||||
$args->page = $page;
|
||||
$args->list_count = 10;
|
||||
$args->page_count = 5;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackageList", $args);
|
||||
$res = array();
|
||||
if ($output->data)
|
||||
$depth0 = array();
|
||||
foreach($categoryList as $key => $category)
|
||||
{
|
||||
if($category->parent_srl)
|
||||
{
|
||||
foreach($output->data as $val)
|
||||
{
|
||||
$res[$val->package_srl] = $val;
|
||||
}
|
||||
$categoryList[$category->parent_srl]->children[] =& $categoryList[$key];
|
||||
}
|
||||
$output->data = $res;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type using path
|
||||
*
|
||||
* @param string $path Path to get type
|
||||
* @return string
|
||||
*/
|
||||
function getTypeFromPath($path)
|
||||
{
|
||||
if(!$path) return null;
|
||||
if($path == ".") return "core";
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
$type = substr(array_pop($path_array), 0, -1);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config file path by type
|
||||
*
|
||||
* @param string $type Type to get config file path
|
||||
* @return string
|
||||
*/
|
||||
function getConfigFilePath($type)
|
||||
{
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
else
|
||||
{
|
||||
case "m.layout":
|
||||
case "module":
|
||||
case "addon":
|
||||
case "layout":
|
||||
case "widget":
|
||||
$config_file = "/conf/info.xml";
|
||||
break;
|
||||
case "component":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
case "m.skin":
|
||||
case "skin":
|
||||
case "widgetstyle":
|
||||
case "style":
|
||||
$config_file = "/skin.xml";
|
||||
break;
|
||||
case "drcomponent":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
$depth0[] = $key;
|
||||
}
|
||||
return $config_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns target is removable
|
||||
*
|
||||
* @param string $path Path
|
||||
* @return bool
|
||||
*/
|
||||
function checkRemovable($path)
|
||||
$resultList = array();
|
||||
foreach($depth0 as $category_srl)
|
||||
{
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
$oModule =& getModule($target_name, "class");
|
||||
if(!$oModule) return false;
|
||||
if(method_exists($oModule, "moduleUninstall")) return true;
|
||||
else return false;
|
||||
$this->setDepth($categoryList[$category_srl], 0, $categoryList, $resultList);
|
||||
}
|
||||
return $resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sequence of package by path
|
||||
*
|
||||
* @param string $path Path to get sequence
|
||||
* @return int
|
||||
*/
|
||||
function getPackageSrlByPath($path)
|
||||
/**
|
||||
* Get pcakge count in category
|
||||
*
|
||||
* @param int $category_srl The sequence of category to get count
|
||||
* @return int
|
||||
*/
|
||||
function getPackageCount($category_srl)
|
||||
{
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQuery("autoinstall.getPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed package count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getInstalledPackageCount()
|
||||
{
|
||||
$output = executeQuery("autoinstall.getInstalledPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set depth, children list and package count of category
|
||||
*
|
||||
* @param object $item Category information
|
||||
* @param int $depth Depth of category
|
||||
* @param array $list Category list
|
||||
* @param array $resultList Final result list
|
||||
* @return string $siblingList Comma seperated list
|
||||
*/
|
||||
function setDepth(&$item, $depth, &$list, &$resultList)
|
||||
{
|
||||
$resultList[$item->category_srl] =& $item;
|
||||
$item->depth = $depth;
|
||||
$siblingList = $item->category_srl;
|
||||
foreach($item->children as $child)
|
||||
{
|
||||
if (!$path) return;
|
||||
$siblingList .= ",".$this->setDepth($list[$child->category_srl], $depth+1, $list, $resultList);
|
||||
}
|
||||
if(count($item->children) < 1)
|
||||
{
|
||||
$item->nPackages = $this->getPackageCount($item->category_srl);
|
||||
}
|
||||
$item->childrenList = $siblingList;
|
||||
return $siblingList;
|
||||
}
|
||||
|
||||
if(substr($path,-1) == '/') $path = substr($path, 0, strlen($path)-1);
|
||||
/**
|
||||
* Get lastest package information
|
||||
*
|
||||
* @return object Returns lastest package information. If no result returns null.
|
||||
*/
|
||||
function getLatestPackage()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getLatestPackage");
|
||||
if(!$output->data) return null;
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
if (!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path])
|
||||
/**
|
||||
* Get installed package informations
|
||||
*
|
||||
* @param array $package_list Package sequence list to get information
|
||||
* @return array Returns array contains pacakge information. If no result returns empty array.
|
||||
*/
|
||||
function getInstalledPackages($package_list)
|
||||
{
|
||||
$args->package_list = $package_list;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackages", $args);
|
||||
$result = array();
|
||||
if(!$output->data) return $result;
|
||||
foreach($output->data as $value)
|
||||
{
|
||||
$result[$value->package_srl] = $value;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed package list
|
||||
*
|
||||
* @param int $page
|
||||
* @return Object
|
||||
*/
|
||||
function getInstalledPackageList($page)
|
||||
{
|
||||
$args->page = $page;
|
||||
$args->list_count = 10;
|
||||
$args->page_count = 5;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackageList", $args);
|
||||
$res = array();
|
||||
if($output->data)
|
||||
{
|
||||
foreach($output->data as $val)
|
||||
{
|
||||
$args->path = $path;
|
||||
$output = executeQuery('autoinstall.getPackageSrlByPath', $args);
|
||||
|
||||
$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl;
|
||||
$res[$val->package_srl] = $val;
|
||||
}
|
||||
|
||||
return $GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path];
|
||||
}
|
||||
$output->data = $res;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remove url by package srl
|
||||
*
|
||||
* @param int $packageSrl Sequence of pakcage to get url
|
||||
* @return string
|
||||
*/
|
||||
function getRemoveUrlByPackageSrl($packageSrl)
|
||||
/**
|
||||
* Get type using path
|
||||
*
|
||||
* @param string $path Path to get type
|
||||
* @return string
|
||||
*/
|
||||
function getTypeFromPath($path)
|
||||
{
|
||||
if(!$path) return null;
|
||||
if($path == ".") return "core";
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
$type = substr(array_pop($path_array), 0, -1);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config file path by type
|
||||
*
|
||||
* @param string $type Type to get config file path
|
||||
* @return string
|
||||
*/
|
||||
function getConfigFilePath($type)
|
||||
{
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
{
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if (!$ftp_info->ftp_root_path) return;
|
||||
|
||||
if (!$packageSrl) return;
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
case "m.layout":
|
||||
case "module":
|
||||
case "addon":
|
||||
case "layout":
|
||||
case "widget":
|
||||
$config_file = "/conf/info.xml";
|
||||
break;
|
||||
case "component":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
case "m.skin":
|
||||
case "skin":
|
||||
case "widgetstyle":
|
||||
case "style":
|
||||
$config_file = "/skin.xml";
|
||||
break;
|
||||
case "drcomponent":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
}
|
||||
return $config_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remove url by path
|
||||
*
|
||||
* @param string $path Path to get url
|
||||
* @return string
|
||||
*/
|
||||
function getRemoveUrlByPath($path)
|
||||
/**
|
||||
* Returns target is removable
|
||||
*
|
||||
* @param string $path Path
|
||||
* @return bool
|
||||
*/
|
||||
function checkRemovable($path)
|
||||
{
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
$oModule =& getModule($target_name, "class");
|
||||
if(!$oModule) return false;
|
||||
if(method_exists($oModule, "moduleUninstall")) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sequence of package by path
|
||||
*
|
||||
* @param string $path Path to get sequence
|
||||
* @return int
|
||||
*/
|
||||
function getPackageSrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
|
||||
if(substr($path,-1) == '/') $path = substr($path, 0, strlen($path)-1);
|
||||
|
||||
if(!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path])
|
||||
{
|
||||
if (!$path) return;
|
||||
$args->path = $path;
|
||||
$output = executeQuery('autoinstall.getPackageSrlByPath', $args);
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if (!$ftp_info->ftp_root_path) return;
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if (!$packageSrl) return;
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get update url by package srl
|
||||
*
|
||||
* @param int $packageSrl Sequence to get url
|
||||
* @return string
|
||||
*/
|
||||
function getUpdateUrlByPackageSrl($packageSrl)
|
||||
{
|
||||
if (!$packageSrl) return;
|
||||
return $GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path];
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
/**
|
||||
* Get remove url by package srl
|
||||
*
|
||||
* @param int $packageSrl Sequence of pakcage to get url
|
||||
* @return string
|
||||
*/
|
||||
function getRemoveUrlByPackageSrl($packageSrl)
|
||||
{
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path) return;
|
||||
|
||||
/**
|
||||
* Get update url by path
|
||||
*
|
||||
* @param string $path Path to get url
|
||||
* @return string
|
||||
*/
|
||||
function getUpdateUrlByPath($path)
|
||||
{
|
||||
if (!$path) return;
|
||||
if(!$packageSrl) return;
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if (!$packageSrl) return;
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
/**
|
||||
* Get remove url by path
|
||||
*
|
||||
* @param string $path Path to get url
|
||||
* @return string
|
||||
*/
|
||||
function getRemoveUrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
|
||||
}
|
||||
?>
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if (!$ftp_info->ftp_root_path) return;
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if(!$packageSrl) return;
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get update url by package srl
|
||||
*
|
||||
* @param int $packageSrl Sequence to get url
|
||||
* @return string
|
||||
*/
|
||||
function getUpdateUrlByPackageSrl($packageSrl)
|
||||
{
|
||||
if(!$packageSrl) return;
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get update url by path
|
||||
*
|
||||
* @param string $path Path to get url
|
||||
* @return string
|
||||
*/
|
||||
function getUpdateUrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if (!$packageSrl) return;
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.model.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.model.php */
|
||||
|
|
|
|||
|
|
@ -1,31 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* View class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallView extends autoinstall
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* View class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class autoinstallView extends autoinstall {
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispAutoinstallTest(){
|
||||
$file = "modules.test.tar";
|
||||
$checksum = '549989037bd8401d39b83ca2393d8131';
|
||||
$file = "modules.test.skins.test.tar";
|
||||
$oAutoinstallAdminController = &getAdminController('autoinstall');
|
||||
$output = $oAutoinstallAdminController->install($file, $checksum);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Test
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispAutoinstallTest()
|
||||
{
|
||||
$file = "modules.test.tar";
|
||||
$checksum = '549989037bd8401d39b83ca2393d8131';
|
||||
$file = "modules.test.skins.test.tar";
|
||||
$oAutoinstallAdminController = &getAdminController('autoinstall');
|
||||
$output = $oAutoinstallAdminController->install($file, $checksum);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
/* End of file autoinstall.view.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue