mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
issue 2119. supporting php 5.4. autoinstall module.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12714 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0841f7be53
commit
6be23a3ac2
7 changed files with 610 additions and 324 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once(_XE_PATH_ . 'modules/autoinstall/autoinstall.lib.php');
|
||||
|
||||
/**
|
||||
* autoinstall module admin controller class
|
||||
*
|
||||
|
|
@ -7,11 +9,13 @@ require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
|
|||
*/
|
||||
class autoinstallAdminController extends autoinstall
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +61,7 @@ class autoinstallAdminController extends autoinstall
|
|||
*/
|
||||
function _updateinfo()
|
||||
{
|
||||
$oModel = &getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$item = $oModel->getLatestPackage();
|
||||
if($item)
|
||||
{
|
||||
|
|
@ -73,7 +77,7 @@ class autoinstallAdminController extends autoinstall
|
|||
$this->updatePackages($xmlDoc);
|
||||
$this->checkInstalled();
|
||||
|
||||
$oAdminController = &getAdminController('admin');
|
||||
$oAdminController = getAdminController('admin');
|
||||
$output = $oAdminController->cleanFavorite();
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +89,7 @@ class autoinstallAdminController extends autoinstall
|
|||
function checkInstalled()
|
||||
{
|
||||
executeQuery("autoinstall.deleteInstalledPackage");
|
||||
$oModel =& getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$packages = $oModel->getPackages();
|
||||
foreach($packages as $package)
|
||||
{
|
||||
|
|
@ -102,7 +106,7 @@ class autoinstallAdminController extends autoinstall
|
|||
}
|
||||
else
|
||||
{
|
||||
$config_file = null;
|
||||
$config_file = NULL;
|
||||
switch($type)
|
||||
{
|
||||
case "m.layout":
|
||||
|
|
@ -132,10 +136,20 @@ class autoinstallAdminController extends autoinstall
|
|||
$type = "theme";
|
||||
break;
|
||||
}
|
||||
if(!$config_file) continue;
|
||||
|
||||
if(!$config_file)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile($real_path . $config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
|
||||
if(!$xmlDoc)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$version = $xmlDoc->{$type}->version->body;
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +179,7 @@ class autoinstallAdminController extends autoinstall
|
|||
{
|
||||
@set_time_limit(0);
|
||||
$package_srls = Context::get('package_srl');
|
||||
$oModel =& getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$packages = explode(',', $package_srls);
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$_SESSION['ftp_password'])
|
||||
|
|
@ -197,7 +211,10 @@ class autoinstallAdminController extends autoinstall
|
|||
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->install();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_updateinfo();
|
||||
|
|
@ -222,8 +239,11 @@ class autoinstallAdminController extends autoinstall
|
|||
*/
|
||||
function updatePackages(&$xmlDoc)
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!$xmlDoc->response->packages->item) return;
|
||||
$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);
|
||||
|
|
@ -231,7 +251,7 @@ class autoinstallAdminController extends autoinstall
|
|||
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance');
|
||||
foreach($xmlDoc->response->packages->item as $item)
|
||||
{
|
||||
$args = null;
|
||||
$args = new stdClass();
|
||||
foreach($targets as $target)
|
||||
{
|
||||
$args->{$target} = $item->{$target}->body;
|
||||
|
|
@ -261,7 +281,7 @@ class autoinstallAdminController extends autoinstall
|
|||
function updateCategory(&$xmlDoc)
|
||||
{
|
||||
executeQuery("autoinstall.deleteCategory");
|
||||
$oModel =& getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
if(!is_array($xmlDoc->response->categorylist->item))
|
||||
{
|
||||
$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
|
||||
|
|
@ -306,7 +326,7 @@ class autoinstallAdminController extends autoinstall
|
|||
*/
|
||||
function uninstallPackageByPackageSrl($package_srl)
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$package = $oModel->getPackage($package_srl);
|
||||
|
||||
$this->_uninstallPackage($package);
|
||||
|
|
@ -355,12 +375,16 @@ class autoinstallAdminController extends autoinstall
|
|||
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->uninstall();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->_updateinfo();
|
||||
|
||||
$this->setMessage('success_deleted', 'update');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.admin.controller.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
|
|
@ -184,7 +185,10 @@ class autoinstallAdminModel extends autoinstall
|
|||
{
|
||||
$oModel = getModel('autoinstall');
|
||||
$output = executeQueryArray('autoinstall.getNeedUpdate');
|
||||
if(!is_array($output->data)) return NULL;
|
||||
if(!is_array($output->data))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$xml = new XmlParser();
|
||||
|
|
@ -210,9 +214,18 @@ class autoinstallAdminModel extends autoinstall
|
|||
if($xmlDoc)
|
||||
{
|
||||
$type = $packageInfo->type;
|
||||
if($type == "drcomponent") $type = "component";
|
||||
if($type == "style" || $type == "m.skin") $type = "skin";
|
||||
if($type == "m.layout") $type = "layout";
|
||||
if($type == "drcomponent")
|
||||
{
|
||||
$type = "component";
|
||||
}
|
||||
if($type == "style" || $type == "m.skin")
|
||||
{
|
||||
$type = "skin";
|
||||
}
|
||||
if($type == "m.layout")
|
||||
{
|
||||
$type = "layout";
|
||||
}
|
||||
$title = $xmlDoc->{$type}->title->body;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Admin view class in the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallAdminView extends autoinstall
|
||||
{
|
||||
|
||||
/**
|
||||
* Category list
|
||||
* @var array
|
||||
|
|
@ -15,7 +17,7 @@ class autoinstallAdminView extends autoinstall
|
|||
* Is set a ftp information
|
||||
* @var bool
|
||||
*/
|
||||
var $ftp_set = false;
|
||||
var $ftp_set = FALSE;
|
||||
|
||||
/**
|
||||
* initialize
|
||||
|
|
@ -30,12 +32,18 @@ class autoinstallAdminView extends autoinstall
|
|||
$this->setTemplatePath($template_path);
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path) Context::set('show_ftp_note', true);
|
||||
else $this->ftp_set = true;
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
Context::set('show_ftp_note', TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ftp_set = TRUE;
|
||||
}
|
||||
|
||||
$this->dispCategory();
|
||||
$oModel = &getModel('autoinstall');
|
||||
Context::set('tCount', $oModel->getPackageCount(null));
|
||||
$oModel = getModel('autoinstall');
|
||||
Context::set('tCount', $oModel->getPackageCount(NULL));
|
||||
Context::set('iCount', $oModel->getInstalledPackageCount());
|
||||
}
|
||||
|
||||
|
|
@ -160,18 +168,29 @@ class autoinstallAdminView extends autoinstall
|
|||
*/
|
||||
function rearranges($items, $packages = null)
|
||||
{
|
||||
if(!is_array($items)) $items = array($items);
|
||||
if(!is_array($items))
|
||||
{
|
||||
$items = array($items);
|
||||
}
|
||||
|
||||
$item_list = array();
|
||||
$targets = array('category_srl', 'package_srl', 'item_screenshot_url', 'package_voted', 'package_voter', 'package_description', 'package_downloaded', 'item_regdate', 'title', 'item_version', 'package_star', 'depfrom');
|
||||
$targetpackages = array();
|
||||
|
||||
foreach($items as $item)
|
||||
{
|
||||
$targetpackages[$item->package_srl->body] = 0;
|
||||
}
|
||||
$oModel = &getModel('autoinstall');
|
||||
|
||||
$oModel = getModel('autoinstall');
|
||||
|
||||
if($package == null)
|
||||
{
|
||||
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
|
||||
}
|
||||
|
||||
$depto = array();
|
||||
|
||||
foreach($items as $item)
|
||||
{
|
||||
$v = $this->rearrange($item, $targets);
|
||||
|
|
@ -184,6 +203,7 @@ class autoinstallAdminView extends autoinstall
|
|||
$v->current_version = $packages[$v->package_srl]->current_version;
|
||||
$v->need_update = $packages[$v->package_srl]->need_update;
|
||||
$v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path);
|
||||
|
||||
if($this->ftp_set && $v->depfrom)
|
||||
{
|
||||
$depfrom = explode(",", $v->depfrom);
|
||||
|
|
@ -192,12 +212,19 @@ class autoinstallAdminView extends autoinstall
|
|||
$depto[$package_srl][] = $v->package_srl;
|
||||
}
|
||||
}
|
||||
if($v->type == "core") $v->avail_remove = false;
|
||||
|
||||
if($v->type == "core")
|
||||
{
|
||||
$v->avail_remove = FALSE;
|
||||
}
|
||||
else if($v->type == "module")
|
||||
{
|
||||
$v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path);
|
||||
}
|
||||
else $v->avail_remove = true;
|
||||
else
|
||||
{
|
||||
$v->avail_remove = TRUE;
|
||||
}
|
||||
}
|
||||
$item_list[$v->package_srl] = $v;
|
||||
}
|
||||
|
|
@ -209,16 +236,37 @@ class autoinstallAdminView extends autoinstall
|
|||
{
|
||||
$path = $val->path;
|
||||
$type = $oModel->getTypeFromPath($path);
|
||||
if(!$type || $type == "core") continue;
|
||||
|
||||
if(!$type || $type == "core")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$config_file = $oModel->getConfigFilePath($type);
|
||||
if(!$config_file) continue;
|
||||
if(!$config_file)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
if($type == "drcomponent") $type = "component";
|
||||
if($type == "style" || $type == "m.skin") $type = "skin";
|
||||
if($type == "m.layout") $type = "layout";
|
||||
if(!$xmlDoc)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if($type == "drcomponent")
|
||||
{
|
||||
$type = "component";
|
||||
}
|
||||
if($type == "style" || $type == "m.skin")
|
||||
{
|
||||
$type = "skin";
|
||||
}
|
||||
if($type == "m.layout")
|
||||
{
|
||||
$type = "layout";
|
||||
}
|
||||
$title = $xmlDoc->{$type}->title->body;
|
||||
$installed[$key]->title = $title;
|
||||
}
|
||||
|
|
@ -246,9 +294,13 @@ class autoinstallAdminView extends autoinstall
|
|||
function dispAutoinstallAdminInstalledPackages()
|
||||
{
|
||||
$page = Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
if(!$page)
|
||||
{
|
||||
$page = 1;
|
||||
}
|
||||
Context::set('page', $page);
|
||||
$oModel = &getModel('autoinstall');
|
||||
|
||||
$oModel = getModel('autoinstall');
|
||||
$output = $oModel->getInstalledPackageList($page);
|
||||
$package_list = $output->data;
|
||||
|
||||
|
|
@ -297,12 +349,15 @@ class autoinstallAdminView extends autoinstall
|
|||
function dispAutoinstallAdminInstall()
|
||||
{
|
||||
$package_srl = Context::get('package_srl');
|
||||
if(!$package_srl) return $this->dispAutoinstallAdminIndex();
|
||||
if(!$package_srl)
|
||||
{
|
||||
return $this->dispAutoinstallAdminIndex();
|
||||
}
|
||||
|
||||
$params["act"] = "getResourceapiInstallInfo";
|
||||
$params["package_srl"] = $package_srl;
|
||||
$xmlDoc = XmlGenerater::getXmlDoc($params);
|
||||
$oModel = &getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
|
||||
$targetpackages = array();
|
||||
if($xmlDoc)
|
||||
|
|
@ -316,7 +371,11 @@ class autoinstallAdminView extends autoinstall
|
|||
$package->path = $xmlPackage->path->body;
|
||||
if($xmlPackage->depends)
|
||||
{
|
||||
if(!is_array($xmlPackage->depends->item)) $xmlPackage->depends->item = array($xmlPackage->depends->item);
|
||||
if(!is_array($xmlPackage->depends->item))
|
||||
{
|
||||
$xmlPackage->depends->item = array($xmlPackage->depends->item);
|
||||
}
|
||||
|
||||
$package->depends = array();
|
||||
foreach($xmlPackage->depends->item as $item)
|
||||
{
|
||||
|
|
@ -328,22 +387,23 @@ class autoinstallAdminView extends autoinstall
|
|||
$package->depends[] = $dep_item;
|
||||
$targetpackages[$dep_item->package_srl] = 1;
|
||||
}
|
||||
|
||||
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
|
||||
$package->deplist = "";
|
||||
foreach($package->depends as $key => $dep)
|
||||
{
|
||||
if(!$packages[$dep->package_srl])
|
||||
{
|
||||
$package->depends[$key]->installed = false;
|
||||
$package->depends[$key]->installed = FALSE;
|
||||
$package->package_srl .= "," . $dep->package_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$package->depends[$key]->installed = true;
|
||||
$package->depends[$key]->installed = TRUE;
|
||||
$package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version;
|
||||
if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">"))
|
||||
{
|
||||
$package->depends[$key]->need_update = true;
|
||||
$package->depends[$key]->need_update = TRUE;
|
||||
$package->package_srl .= "," . $dep->package_srl;
|
||||
|
||||
if($dep->path === '.')
|
||||
|
|
@ -353,15 +413,16 @@ class autoinstallAdminView extends autoinstall
|
|||
}
|
||||
else
|
||||
{
|
||||
$package->need_update = false;
|
||||
$package->need_update = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$installedPackage = $oModel->getInstalledPackage($package_srl);
|
||||
if($installedPackage)
|
||||
{
|
||||
$package->installed = true;
|
||||
$package->installed = TRUE;
|
||||
$package->cur_version = $installedPackage->current_version;
|
||||
$package->need_update = version_compare($package->version, $installedPackage->current_version, ">");
|
||||
}
|
||||
|
|
@ -372,10 +433,12 @@ class autoinstallAdminView extends autoinstall
|
|||
Context::set('contain_core', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
Context::set('need_password', true);
|
||||
Context::set('need_password', TRUE);
|
||||
}
|
||||
|
||||
$this->setTemplateFile('install');
|
||||
|
||||
$security = new Security();
|
||||
|
|
@ -389,10 +452,13 @@ class autoinstallAdminView extends autoinstall
|
|||
*/
|
||||
function dispAutoinstallAdminIndex()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path) Context::set('show_ftp_note', true);
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
Context::set('show_ftp_note', TRUE);
|
||||
}
|
||||
|
||||
$this->setTemplateFile('index');
|
||||
|
||||
|
|
@ -409,40 +475,55 @@ class autoinstallAdminView extends autoinstall
|
|||
return $this->stop('msg_connection_fail');
|
||||
}
|
||||
|
||||
$oModel = &getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$item = $oModel->getLatestPackage();
|
||||
if(!$item || $item->updatedate < $updateDate || count($this->categories) < 1)
|
||||
{
|
||||
$oController = &getAdminController('autoinstall');
|
||||
$oController = getAdminController('autoinstall');
|
||||
$oController->_updateinfo();
|
||||
|
||||
if(!$_SESSION['__XE_EASYINSTALL_REDIRECT__'])
|
||||
{
|
||||
header('location: ' . getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex'));
|
||||
$_SESSION['__XE_EASYINSTALL_REDIRECT__'] = true;
|
||||
$_SESSION['__XE_EASYINSTALL_REDIRECT__'] = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
unset($_SESSION['__XE_EASYINSTALL_REDIRECT__']);
|
||||
|
||||
$page = Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
if(!$page)
|
||||
{
|
||||
$page = 1;
|
||||
}
|
||||
Context::set('page', $page);
|
||||
|
||||
$order_type = Context::get('order_type');
|
||||
if(!in_array($order_type, array('asc', 'desc'))) $order_type = 'desc';
|
||||
if(!in_array($order_type, array('asc', 'desc')))
|
||||
{
|
||||
$order_type = 'desc';
|
||||
}
|
||||
Context::set('order_type', $order_type);
|
||||
|
||||
$order_target = Context::get('order_target');
|
||||
if(!in_array($order_target, array('newest', 'download', 'popular'))) $order_target = 'newest';
|
||||
if(!in_array($order_target, array('newest', 'download', 'popular')))
|
||||
{
|
||||
$order_target = 'newest';
|
||||
}
|
||||
Context::set('order_target', $order_target);
|
||||
|
||||
$search_keyword = Context::get('search_keyword');
|
||||
|
||||
$childrenList = Context::get('childrenList');
|
||||
$category_srl = Context::get('category_srl');
|
||||
if($childrenList) $params["category_srl"] = $childrenList;
|
||||
else if($category_srl) $params["category_srl"] = $category_srl;
|
||||
if($childrenList)
|
||||
{
|
||||
$params["category_srl"] = $childrenList;
|
||||
}
|
||||
else if($category_srl)
|
||||
{
|
||||
$params["category_srl"] = $category_srl;
|
||||
}
|
||||
|
||||
$params["act"] = "getResourceapiPackagelist";
|
||||
$params["order_target"] = $order_target;
|
||||
|
|
@ -474,8 +555,8 @@ class autoinstallAdminView extends autoinstall
|
|||
*/
|
||||
function dispCategory()
|
||||
{
|
||||
$oModel = &getModel('autoinstall');
|
||||
$this->categories = &$oModel->getCategoryList();
|
||||
$oModel = getModel('autoinstall');
|
||||
$this->categories = $oModel->getCategoryList();
|
||||
Context::set('categories', $this->categories);
|
||||
}
|
||||
|
||||
|
|
@ -487,21 +568,37 @@ class autoinstallAdminView extends autoinstall
|
|||
function dispAutoinstallAdminUninstall()
|
||||
{
|
||||
$package_srl = Context::get('package_srl');
|
||||
if(!$package_srl) return $this->dispAutoinstallAdminIndex();
|
||||
$oModel =& getModel('autoinstall');
|
||||
if(!$package_srl)
|
||||
{
|
||||
return $this->dispAutoinstallAdminIndex();
|
||||
}
|
||||
|
||||
$oModel = getModel('autoinstall');
|
||||
$installedPackage = $oModel->getInstalledPackage($package_srl);
|
||||
if(!$installedPackage) return $this->dispAutoinstallAdminInstalledPackages();
|
||||
if(!$installedPackage)
|
||||
{
|
||||
return $this->dispAutoinstallAdminInstalledPackages();
|
||||
}
|
||||
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
Context::set('need_password', true);
|
||||
Context::set('need_password', TRUE);
|
||||
}
|
||||
|
||||
$installedPackage = $oModel->getPackage($package_srl);
|
||||
$path = $installedPackage->path;
|
||||
$type = $oModel->getTypeFromPath($path);
|
||||
if(!$type || $type == "core") return $this->stop("msg_invalid_request");
|
||||
|
||||
if(!$type || $type == "core")
|
||||
{
|
||||
return $this->stop("msg_invalid_request");
|
||||
}
|
||||
|
||||
$config_file = $oModel->getConfigFilePath($type);
|
||||
if(!$config_file) return $this->stop("msg_invalid_request");
|
||||
if(!$config_file)
|
||||
{
|
||||
return $this->stop("msg_invalid_request");
|
||||
}
|
||||
|
||||
$params["act"] = "getResourceapiPackages";
|
||||
$params["package_srls"] = $package_srl;
|
||||
|
|
@ -530,6 +627,7 @@ class autoinstallAdminView extends autoinstall
|
|||
return $this->stop('msg_connection_fail');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.admin.view.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* XML Generater
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class XmlGenerater
|
||||
{
|
||||
|
||||
/**
|
||||
* Generate XML using given data
|
||||
*
|
||||
|
|
@ -14,7 +16,11 @@ class XmlGenerater
|
|||
function generate(&$params)
|
||||
{
|
||||
$xmlDoc = '<?xml version="1.0" encoding="utf-8" ?><methodCall><params>';
|
||||
if(!is_array($params)) return null;
|
||||
if(!is_array($params))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$params["module"] = "resourceapi";
|
||||
foreach($params as $key => $val)
|
||||
{
|
||||
|
|
@ -34,11 +40,16 @@ class XmlGenerater
|
|||
{
|
||||
$body = XmlGenerater::generate($params);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
if(!$buff) return;
|
||||
if(!$buff)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->parse($buff);
|
||||
return $xmlDoc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -47,6 +58,7 @@ class XmlGenerater
|
|||
*/
|
||||
class autoinstall extends ModuleObject
|
||||
{
|
||||
|
||||
/**
|
||||
* Temporary directory path
|
||||
*/
|
||||
|
|
@ -59,7 +71,7 @@ class autoinstall extends ModuleObject
|
|||
*/
|
||||
function autoinstall()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('autoinstall');
|
||||
if($config->downloadServer != _XE_DOWNLOAD_SERVER_)
|
||||
{
|
||||
|
|
@ -74,7 +86,7 @@ class autoinstall extends ModuleObject
|
|||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController = getController('module');
|
||||
|
||||
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
|
||||
$oModuleController->insertModuleConfig('autoinstall', $config);
|
||||
|
|
@ -87,26 +99,32 @@ class autoinstall extends ModuleObject
|
|||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$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;
|
||||
return TRUE;
|
||||
}
|
||||
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_remote_categories.xml"))
|
||||
&& $oDB->isTableExists("autoinstall_remote_categories"))
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// 2011.08.08 add column 'list_order' in ai_remote_categories
|
||||
if(!$oDB->isColumnExists('ai_remote_categories', 'list_order')) return true;
|
||||
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;
|
||||
if(!isset($config->downloadServer))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// 2012.11.12 add column 'have_instance' in autoinstall_packages
|
||||
if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
|
||||
|
|
@ -114,7 +132,7 @@ class autoinstall extends ModuleObject
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -124,9 +142,9 @@ class autoinstall extends ModuleObject
|
|||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB =& DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
$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"))
|
||||
|
|
@ -142,7 +160,7 @@ class autoinstall extends ModuleObject
|
|||
// 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->addColumn('ai_remote_categories', 'list_order', 'number', 11, NULL, TRUE);
|
||||
$oDB->addIndex('ai_remote_categories', 'idx_list_order', array('list_order'));
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +187,9 @@ class autoinstall extends ModuleObject
|
|||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.class.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.class.php */
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once(_XE_PATH_ . 'libs/ftp.class.php');
|
||||
|
||||
/**
|
||||
* Module installer
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class ModuleInstaller
|
||||
{
|
||||
|
||||
/**
|
||||
* Package information
|
||||
* @var object
|
||||
*/
|
||||
var $package = null;
|
||||
var $package = NULL;
|
||||
|
||||
/**
|
||||
* Server's base url
|
||||
|
|
@ -72,16 +75,22 @@ class ModuleInstaller
|
|||
*/
|
||||
function uninstall()
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
$oModel = getModel('autoinstall');
|
||||
$type = $oModel->getTypeFromPath($this->package->path);
|
||||
if($type == "module")
|
||||
{
|
||||
$output = $this->uninstallModule();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$output = $this->_removeDir($this->package->path);
|
||||
$this->_close();
|
||||
|
|
@ -126,7 +135,7 @@ class ModuleInstaller
|
|||
$postdata["path"] = $this->package->path;
|
||||
$postdata["module"] = "resourceapi";
|
||||
$postdata["act"] = "procResourceapiDownload";
|
||||
$buff = FileHandler::getRemoteResource($this->base_url, null, 3, "POST", "application/x-www-form-urlencoded", array(), array(), $postdata);
|
||||
$buff = FileHandler::getRemoteResource($this->base_url, NULL, 3, "POST", "application/x-www-form-urlencoded", array(), array(), $postdata);
|
||||
FileHandler::writeFile($this->download_file, $buff);
|
||||
}
|
||||
|
||||
|
|
@ -141,16 +150,25 @@ class ModuleInstaller
|
|||
{
|
||||
$path_array = explode("/", $this->package->path);
|
||||
$target_name = array_pop($path_array);
|
||||
$oModule =& getModule($target_name, "class");
|
||||
if(!$oModule) return new Object(-1, 'msg_invalid_request');
|
||||
if(!method_exists($oModule, "moduleUninstall")) return new Object(-1, 'msg_invalid_request');
|
||||
$oModule = getModule($target_name, "class");
|
||||
if(!$oModule)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
if(!method_exists($oModule, "moduleUninstall"))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$output = $oModule->moduleUninstall();
|
||||
if(is_subclass_of($output, 'Object') && !$output->toBool()) return $output;
|
||||
if(is_subclass_of($output, 'Object') && !$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$schema_dir = sprintf('%s/schemas/', $this->package->path);
|
||||
$schema_files = FileHandler::readDir($schema_dir);
|
||||
$oDB =& DB::getInstance();
|
||||
$oDB = DB::getInstance();
|
||||
if(is_array($schema_files))
|
||||
{
|
||||
foreach($schema_files as $file)
|
||||
|
|
@ -182,8 +200,8 @@ class ModuleInstaller
|
|||
|
||||
if($type == "module")
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oInstallController = &getController('install');
|
||||
$oModuleModel = getModel('module');
|
||||
$oInstallController = getController('install');
|
||||
$module_path = ModuleHandler::getModulePath($target_name);
|
||||
if($oModuleModel->checkNeedInstall($target_name))
|
||||
{
|
||||
|
|
@ -191,7 +209,7 @@ class ModuleInstaller
|
|||
}
|
||||
if($oModuleModel->checkNeedUpdate($target_name))
|
||||
{
|
||||
$oModule = &getModule($target_name, 'class');
|
||||
$oModule = getModule($target_name, 'class');
|
||||
if(method_exists($oModule, 'moduleUpdate'))
|
||||
{
|
||||
$oModule->moduleUpdate();
|
||||
|
|
@ -261,7 +279,10 @@ class ModuleInstaller
|
|||
$files = array();
|
||||
while($file = $oDir->read())
|
||||
{
|
||||
if($file == "." || $file == "..") continue;
|
||||
if($file == "." || $file == "..")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
|
|
@ -271,17 +292,24 @@ class ModuleInstaller
|
|||
if(is_dir(FileHandler::getRealPath($file_path)))
|
||||
{
|
||||
$output = $this->_removeDir($file_path);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $this->_removeFile($file_path);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output = $this->_removeDir_real($path);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -290,23 +318,24 @@ class ModuleInstaller
|
|||
*/
|
||||
class SFTPModuleInstaller extends ModuleInstaller
|
||||
{
|
||||
|
||||
/**
|
||||
* FTP information
|
||||
* @var object
|
||||
*/
|
||||
var $ftp_info = null;
|
||||
var $ftp_info = NULL;
|
||||
|
||||
/**
|
||||
* SFTP connection
|
||||
* @var resource
|
||||
*/
|
||||
var $connection = null;
|
||||
var $connection = NULL;
|
||||
|
||||
/**
|
||||
* SFTP resource
|
||||
* @var resource
|
||||
*/
|
||||
var $sftp = null;
|
||||
var $sftp = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -332,7 +361,10 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
return new Object(-1, 'msg_sftp_not_supported');
|
||||
}
|
||||
|
||||
if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
||||
if($this->ftp_info->ftp_host)
|
||||
{
|
||||
|
|
@ -359,6 +391,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -369,7 +402,10 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!@ssh2_sftp_unlink($this->sftp, $target_path))
|
||||
|
|
@ -387,7 +423,10 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
|
||||
|
|
@ -403,11 +442,18 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
* @param array $file_list File list to copy
|
||||
* @return Object
|
||||
*/
|
||||
function _copyDir(&$file_list){
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
function _copyDir(&$file_list)
|
||||
{
|
||||
if(!$this->ftp_password)
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_password_input');
|
||||
}
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
|
||||
|
||||
if(is_array($file_list))
|
||||
|
|
@ -424,7 +470,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
{
|
||||
ssh2_sftp_mkdir($this->sftp, $pathname, 0755, true);
|
||||
ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
|
||||
}
|
||||
|
||||
ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
|
||||
|
|
@ -432,6 +478,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -440,17 +487,18 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
class PHPFTPModuleInstaller extends ModuleInstaller
|
||||
{
|
||||
|
||||
/**
|
||||
* FTP information
|
||||
* @var object
|
||||
*/
|
||||
var $ftp_info = null;
|
||||
var $ftp_info = NULL;
|
||||
|
||||
/**
|
||||
* FTP connection
|
||||
* @var resource
|
||||
*/
|
||||
var $connection = null;
|
||||
var $connection = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -496,7 +544,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
if($this->ftp_info->ftp_pasv != "N")
|
||||
{
|
||||
ftp_pasv($this->connection, true);
|
||||
ftp_pasv($this->connection, TRUE);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -509,7 +557,10 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!@ftp_delete($this->connection, $target_path))
|
||||
|
|
@ -527,7 +578,10 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!@ftp_rmdir($this->connection, $target_path))
|
||||
|
|
@ -555,12 +609,21 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _copyDir(&$file_list)
|
||||
{
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
if(!$this->ftp_password)
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_password_input');
|
||||
}
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
if(!$this->target_path) $this->target_path = '.';
|
||||
if(!$this->target_path)
|
||||
{
|
||||
$this->target_path = '.';
|
||||
}
|
||||
if(substr($this->download_path, -1) == '/')
|
||||
{
|
||||
$this->download_path = substr($this->download_path, 0, -1);
|
||||
|
|
@ -571,7 +634,10 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
{
|
||||
foreach($file_list as $k => $file)
|
||||
{
|
||||
if(!$file) continue;
|
||||
if(!$file)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$org_file = $file;
|
||||
if($this->package->path == ".")
|
||||
{
|
||||
|
|
@ -585,7 +651,10 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
|
||||
for($i = 0; $i < count($path_list); $i++)
|
||||
{
|
||||
if($path_list=="") continue;
|
||||
if($path_list == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$real_path .= $path_list[$i] . "/";
|
||||
$ftp_path .= $path_list[$i] . "/";
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
|
|
@ -623,6 +692,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
$this->_close();
|
||||
return new Object();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -631,17 +701,18 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
class FTPModuleInstaller extends ModuleInstaller
|
||||
{
|
||||
|
||||
/**
|
||||
* FTP instance
|
||||
* @var FTP
|
||||
*/
|
||||
var $oFtp = null;
|
||||
var $oFtp = NULL;
|
||||
|
||||
/**
|
||||
* FTP information
|
||||
* @var object
|
||||
*/
|
||||
var $ftp_info = null;
|
||||
var $ftp_info = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -675,7 +746,8 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
{
|
||||
return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_host));
|
||||
}
|
||||
if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) {
|
||||
if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
|
||||
{
|
||||
$this->_close();
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
|
@ -691,7 +763,10 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!$this->oFtp->ftp_delete($target_path))
|
||||
|
|
@ -708,7 +783,10 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
if(substr($path, 0, 2) == "./")
|
||||
{
|
||||
$path = substr($path, 2);
|
||||
}
|
||||
$target_path = $this->ftp_info->ftp_root_path . $path;
|
||||
|
||||
if(!$this->oFtp->ftp_rmdir($target_path))
|
||||
|
|
@ -736,10 +814,16 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _copyDir(&$file_list)
|
||||
{
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
if(!$this->ftp_password)
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_password_input');
|
||||
}
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$oFtp = &$this->oFtp;
|
||||
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
|
||||
|
|
@ -761,7 +845,10 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
|
||||
for($i = 0; $i < count($path_list); $i++)
|
||||
{
|
||||
if($path_list=="") continue;
|
||||
if($path_list == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$real_path .= $path_list[$i] . "/";
|
||||
$ftp_path .= $path_list[$i] . "/";
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
|
|
@ -778,7 +865,7 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.lib.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.lib.php */
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Model class of the autoinstall module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class autoinstallModel extends autoinstall
|
||||
{
|
||||
|
||||
/**
|
||||
* Get category information
|
||||
*
|
||||
|
|
@ -13,9 +15,13 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getCategory($category_srl)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQueryArray("autoinstall.getCategory", $args);
|
||||
if(!$output->data) return null;
|
||||
if(!$output->data)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +33,10 @@ class autoinstallModel extends autoinstall
|
|||
function getPackages()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getPackages");
|
||||
if(!$output->data) return array();
|
||||
if(!$output->data)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +51,10 @@ class autoinstallModel extends autoinstall
|
|||
$args = new stdClass();
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
if(!$output->data)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +69,10 @@ class autoinstallModel extends autoinstall
|
|||
$args = new stdClass();
|
||||
$args->package_srl = $package_srl;
|
||||
$output = executeQueryArray("autoinstall.getPackage", $args);
|
||||
if(!$output->data) return null;
|
||||
if(!$output->data)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +84,10 @@ class autoinstallModel extends autoinstall
|
|||
function getCategoryList()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getCategories");
|
||||
if(!$output->toBool() || !$output->data) return array();
|
||||
if(!$output->toBool() || !$output->data)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$categoryList = array();
|
||||
foreach($output->data as $category)
|
||||
|
|
@ -109,7 +127,10 @@ class autoinstallModel extends autoinstall
|
|||
$args = new stdClass();
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQuery("autoinstall.getPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
if(!$output->data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
|
|
@ -120,8 +141,11 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getInstalledPackageCount()
|
||||
{
|
||||
$output = executeQuery("autoinstall.getInstalledPackageCount", $args);
|
||||
if(!$output->data) return 0;
|
||||
$output = executeQuery("autoinstall.getInstalledPackageCount");
|
||||
if(!$output->data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +183,10 @@ class autoinstallModel extends autoinstall
|
|||
function getLatestPackage()
|
||||
{
|
||||
$output = executeQueryArray("autoinstall.getLatestPackage");
|
||||
if(!$output->data) return null;
|
||||
if(!$output->data)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +202,10 @@ class autoinstallModel extends autoinstall
|
|||
$args->package_list = $package_list;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackages", $args);
|
||||
$result = array();
|
||||
if(!$output->data) return $result;
|
||||
if(!$output->data)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
foreach($output->data as $value)
|
||||
{
|
||||
$result[$value->package_srl] = $value;
|
||||
|
|
@ -216,8 +246,16 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getTypeFromPath($path)
|
||||
{
|
||||
if(!$path) return null;
|
||||
if($path == ".") return "core";
|
||||
if(!$path)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if($path == ".")
|
||||
{
|
||||
return "core";
|
||||
}
|
||||
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
if(!$target_name)
|
||||
|
|
@ -236,7 +274,7 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getConfigFilePath($type)
|
||||
{
|
||||
$config_file = null;
|
||||
$config_file = NULL;
|
||||
switch($type)
|
||||
{
|
||||
case "m.layout":
|
||||
|
|
@ -272,10 +310,19 @@ class autoinstallModel extends autoinstall
|
|||
{
|
||||
$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;
|
||||
$oModule = getModule($target_name, "class");
|
||||
if(!$oModule)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(method_exists($oModule, "moduleUninstall"))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,9 +333,15 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getPackageSrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
if(!$path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(substr($path,-1) == '/') $path = substr($path, 0, strlen($path)-1);
|
||||
if(substr($path, -1) == '/')
|
||||
{
|
||||
$path = substr($path, 0, strlen($path) - 1);
|
||||
}
|
||||
|
||||
if(!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path])
|
||||
{
|
||||
|
|
@ -311,9 +364,15 @@ class autoinstallModel extends autoinstall
|
|||
function getRemoveUrlByPackageSrl($packageSrl)
|
||||
{
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path) return;
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$packageSrl) return;
|
||||
if(!$packageSrl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
|
@ -326,13 +385,22 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getRemoveUrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
if(!$path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if (!$ftp_info->ftp_root_path) return;
|
||||
if(!$ftp_info->ftp_root_path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if(!$packageSrl) return;
|
||||
if(!$packageSrl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
|
@ -345,7 +413,10 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getUpdateUrlByPackageSrl($packageSrl)
|
||||
{
|
||||
if(!$packageSrl) return;
|
||||
if(!$packageSrl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
|
@ -358,15 +429,20 @@ class autoinstallModel extends autoinstall
|
|||
*/
|
||||
function getUpdateUrlByPath($path)
|
||||
{
|
||||
if(!$path) return;
|
||||
if(!$path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$packageSrl = $this->getPackageSrlByPath($path);
|
||||
if (!$packageSrl) return;
|
||||
if(!$packageSrl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
|
||||
}
|
||||
|
||||
|
||||
function getHaveInstance($columnList = array())
|
||||
{
|
||||
$output = executeQueryArray('autoinstall.getHaveInstance', NULL, $columnList);
|
||||
|
|
@ -377,6 +453,7 @@ class autoinstallModel extends autoinstall
|
|||
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.model.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.model.php */
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
/* End of file autoinstall.view.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.view.php */
|
||||
Loading…
Add table
Add a link
Reference in a new issue