mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
#18859373 : module uninstall
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7399 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
258159d0a3
commit
10a9cbf347
19 changed files with 480 additions and 75 deletions
|
|
@ -57,16 +57,14 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if($package->path == ".")
|
||||
{
|
||||
$type = "core";
|
||||
$type = $oModel->getTypeFromPath($package->path);
|
||||
if($type == "core")
|
||||
{
|
||||
$version = __ZBXE_VERSION__;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_array = explode("/", $package->path);
|
||||
$target_name = array_pop($path_array);
|
||||
$type = substr(array_pop($path_array), 0, -1);
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
{
|
||||
case "module":
|
||||
|
|
@ -86,10 +84,8 @@
|
|||
$config_file = "/info.xml";
|
||||
$type = "component";
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if(!$config_file) continue;
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
|
|
@ -136,7 +132,7 @@
|
|||
{
|
||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||
}
|
||||
else if(function_exists(ftp_connect))
|
||||
else if(false && function_exists(ftp_connect))
|
||||
{
|
||||
$oModuleInstaller = new PHPFTPModuleInstaller($package);
|
||||
}
|
||||
|
|
@ -196,5 +192,42 @@
|
|||
executeQuery("autoinstall.insertCategory", $args);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if($ftp_info->sftp && $ftp_info->sftp == 'Y')
|
||||
{
|
||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||
}
|
||||
else if(function_exists(ftp_connect))
|
||||
{
|
||||
$oModuleInstaller = new PHPFTPModuleInstaller($package);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleInstaller = new FTPModuleInstaller($package);
|
||||
}
|
||||
|
||||
$oModuleInstaller->setPassword($ftp_password);
|
||||
$output = $oModuleInstaller->uninstall();
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
class autoinstallAdminView extends autoinstall {
|
||||
|
||||
var $categories;
|
||||
var $ftp_set = false;
|
||||
|
||||
function init() {
|
||||
$template_path = sprintf("%stpl/",$this->module_path);
|
||||
|
|
@ -18,6 +19,8 @@
|
|||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_root_path) Context::set('show_ftp_note', true);
|
||||
else $this->ftp_set = true;
|
||||
|
||||
|
||||
$this->dispCategory();
|
||||
$oModel = &getModel('autoinstall');
|
||||
|
|
@ -39,7 +42,7 @@
|
|||
{
|
||||
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');
|
||||
$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)
|
||||
{
|
||||
|
|
@ -48,7 +51,7 @@
|
|||
$oModel = &getModel('autoinstall');
|
||||
if($package == null)
|
||||
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
|
||||
|
||||
$depto = array();
|
||||
foreach($items as $item)
|
||||
{
|
||||
$v = $this->rearrange($item, $targets);
|
||||
|
|
@ -56,10 +59,52 @@
|
|||
{
|
||||
$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);
|
||||
foreach($depfrom as $package_srl)
|
||||
{
|
||||
$depto[$package_srl][] = $v->package_srl;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
$item_list[$v->package_srl] = $v;
|
||||
}
|
||||
|
||||
if(count($depto) > 0)
|
||||
{
|
||||
$installed = $oModel->getInstalledPackages(implode(",", array_keys($depto)));
|
||||
foreach($installed as $key=>$val)
|
||||
{
|
||||
$path = $val->path;
|
||||
$type = $oModel->getTypeFromPath($path);
|
||||
if(!$type || $type == "core") continue;
|
||||
$config_file = $oModel->getConfigFilePath($type);
|
||||
if(!$config_file) continue;
|
||||
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file);
|
||||
if(!$xmlDoc) continue;
|
||||
if($type == "drcomponent") $type = "component";
|
||||
$title = $xmlDoc->{$type}->title->body;
|
||||
$installed[$key]->title = $title;
|
||||
}
|
||||
Context::set('installed', $installed);
|
||||
foreach($installed as $key=>$val)
|
||||
{
|
||||
foreach($depto[$key] as $package_srl)
|
||||
{
|
||||
$item_list[$package_srl]->avail_remove = false;
|
||||
$item_list[$package_srl]->deps[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
|
|
@ -235,5 +280,37 @@
|
|||
$this->categories = &$oModel->getCategoryList();
|
||||
Context::set('categories', $this->categories);
|
||||
}
|
||||
|
||||
function dispAutoinstallAdminUninstall()
|
||||
{
|
||||
$package_srl = Context::get('package_srl');
|
||||
if(!$package_srl) return $this->dispAutoinstallAdminIndex();
|
||||
$oModel =& getModel('autoinstall');
|
||||
$installedPackage = $oModel->getInstalledPackage($package_srl);
|
||||
if(!$installedPackage) return $this->dispAutoinstallAdminInstalledPackages();
|
||||
|
||||
if(!$_SESSION['ftp_password'])
|
||||
{
|
||||
Context::set('need_password', true);
|
||||
}
|
||||
$installedPackage = $oModel->getPackage($package_srl);
|
||||
$path = $installedPackage->path;
|
||||
$type = $oModel->getTypeFromPath($path);
|
||||
if(!$type || $type == "core") $this->stop("msg_invalid_request");
|
||||
$config_file = $oModel->getConfigFilePath($type);
|
||||
if(!$config_file) $this->stop("msg_invalid_request");
|
||||
|
||||
$xml = new XmlParser();
|
||||
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file);
|
||||
if(!$xmlDoc) $this->stop("msg_invalid_request");
|
||||
if($type == "drcomponent") $type = "component";
|
||||
$title = $xmlDoc->{$type}->title->body;
|
||||
$installedPackage->title = $title;
|
||||
$installedPackage->type = $type;
|
||||
Context::set('package', $installedPackage);
|
||||
|
||||
$this->setTemplateFile('uninstall');
|
||||
Context::addJsFilter($this->module_path.'tpl/filter', 'uninstall_package.xml');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,23 @@
|
|||
var $download_path;
|
||||
var $ftp_password;
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
$oModel =& getModel('autoinstall');
|
||||
$type = $oModel->getTypeFromPath($this->package->path);
|
||||
if($type == "module") {
|
||||
$output = $this->uninstallModule();
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$output = $this->_removeDir($this->package->path);
|
||||
$this->_close();
|
||||
return $output;
|
||||
}
|
||||
|
||||
function setPassword($ftp_password)
|
||||
{
|
||||
$this->ftp_password = $ftp_password;
|
||||
|
|
@ -41,11 +58,38 @@
|
|||
FileHandler::writeFile($this->download_file, $buff);
|
||||
}
|
||||
|
||||
function installModule()
|
||||
{
|
||||
function uninstallModule()
|
||||
{
|
||||
$path_array = explode("/", $this->package->path);
|
||||
$target_name = array_pop($path_array);
|
||||
$type = substr(array_pop($path_array), 0, -1);
|
||||
$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(!$output->toBool()) return $output;
|
||||
|
||||
$schema_dir = sprintf('%s/schemas/', $this->package->path);
|
||||
$schema_files = FileHandler::readDir($schema_dir);
|
||||
$oDB =& DB::getInstance();
|
||||
foreach($schema_files as $file)
|
||||
{
|
||||
$filename_arr = explode(".", $file);
|
||||
$filename = array_shift($filename_arr);
|
||||
$oDB->dropTable($filename);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function installModule()
|
||||
{
|
||||
$path = $this->package->path;
|
||||
if($path != ".") {
|
||||
$path_array = explode("/", $path);
|
||||
$target_name = array_pop($path_array);
|
||||
$type = substr(array_pop($path_array), 0, -1);
|
||||
}
|
||||
|
||||
if($type == "module")
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -97,38 +141,100 @@
|
|||
return $file_list;
|
||||
}
|
||||
|
||||
function _removeDir($path) {
|
||||
$real_path = FileHandler::getRealPath($path);
|
||||
$oDir = dir($path);
|
||||
$files = array();
|
||||
while($file = $oDir->read()) {
|
||||
if($file == "." || $file == "..") continue;
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
$file_path = $path."/".$file;
|
||||
if(is_dir(FileHandler::getRealPath($file_path)))
|
||||
{
|
||||
$output = $this->_removeDir($file_path);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $this->_removeFile($file_path);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
}
|
||||
$output = $this->_removeDir_real($path);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SFTPModuleInstaller extends ModuleInstaller {
|
||||
var $ftp_info = null;
|
||||
var $connection = null;
|
||||
var $sftp = null;
|
||||
|
||||
function SFTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list){
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->sftp || $ftp_info->sftp != 'Y') return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
function _connect() {
|
||||
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($ftp_info->ftp_host)
|
||||
if($this->ftp_info->ftp_host)
|
||||
{
|
||||
$ftp_host = $ftp_info->ftp_host;
|
||||
$ftp_host = $this->ftp_info->ftp_host;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_host = "127.0.0.1";
|
||||
}
|
||||
$connection = ssh2_connect($ftp_host, $ftp_info->ftp_port);
|
||||
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $this->ftp_password))
|
||||
$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
|
||||
if(!ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
|
||||
{
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
$this->sftp = ssh2_sftp($this->connection);
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$sftp = ssh2_sftp($connection);
|
||||
function _close() {
|
||||
}
|
||||
|
||||
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
||||
function _removeFile($path)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return new Object(-1, "failed to delete file ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return new Object(-1, "failed to delete directory ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list){
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
|
||||
|
||||
foreach($file_list as $k => $file){
|
||||
$org_file = $file;
|
||||
|
|
@ -141,10 +247,10 @@
|
|||
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
{
|
||||
ssh2_sftp_mkdir($sftp, $pathname, 0755, true);
|
||||
ssh2_sftp_mkdir($this->sftp, $pathname, 0755, true);
|
||||
}
|
||||
|
||||
ssh2_scp_send($connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
|
||||
ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -152,38 +258,79 @@
|
|||
|
||||
|
||||
class PHPFTPModuleInstaller extends ModuleInstaller {
|
||||
var $ftp_info = null;
|
||||
var $connection = null;
|
||||
|
||||
function PHPFTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list) {
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if($ftp_info->ftp_host)
|
||||
function _connect()
|
||||
{
|
||||
if($this->ftp_info->ftp_host)
|
||||
{
|
||||
$ftp_host = $ftp_info->ftp_host;
|
||||
$ftp_host = $this->ftp_info->ftp_host;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_host = "127.0.0.1";
|
||||
}
|
||||
|
||||
$connection = ftp_connect($ftp_host, $ftp_info->ftp_port);
|
||||
if(!$connection) return new Object(-1, 'msg_ftp_not_connected');
|
||||
$login_result = @ftp_login($connection, $ftp_info->ftp_user, $this->ftp_password);
|
||||
$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
|
||||
if(!$this->connection) return new Object(-1, 'msg_ftp_not_connected');
|
||||
|
||||
$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
|
||||
if(!$login_result)
|
||||
{
|
||||
$this->_close();
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
if($ftp_info->ftp_pasv != "N")
|
||||
{
|
||||
ftp_pasv($connection, true);
|
||||
}
|
||||
|
||||
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
if($this->ftp_info->ftp_pasv != "N")
|
||||
{
|
||||
ftp_pasv($this->connection, true);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _removeFile($path)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return new Object(-1, "failed to delete file ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return new Object(-1, "failed to delete directory ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
||||
function _close() {
|
||||
ftp_close($this->connection);
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list) {
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
|
||||
|
||||
foreach($file_list as $k => $file){
|
||||
$org_file = $file;
|
||||
|
|
@ -195,7 +342,7 @@
|
|||
$path_list = explode('/', dirname($this->target_path."/".$file));
|
||||
|
||||
$real_path = "./";
|
||||
$ftp_path = $ftp_info->ftp_root_path;
|
||||
$ftp_path = $this->ftp_info->ftp_root_path;
|
||||
|
||||
for($i=0;$i<count($path_list);$i++)
|
||||
{
|
||||
|
|
@ -204,7 +351,7 @@
|
|||
$ftp_path .= $path_list[$i]."/";
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
{
|
||||
if(!ftp_mkdir($connection, $ftp_path))
|
||||
if(!@ftp_mkdir($this->connection, $ftp_path))
|
||||
{
|
||||
return new Object(-1, "msg_make_directory_failed");
|
||||
}
|
||||
|
|
@ -212,14 +359,14 @@
|
|||
if(!stristr(PHP_OS, 'win'))
|
||||
{
|
||||
if (function_exists('ftp_chmod')) {
|
||||
if(!ftp_chmod($connection, 0755, $ftp_path))
|
||||
if(!ftp_chmod($this->connection, 0755, $ftp_path))
|
||||
{
|
||||
return new Object(-1, "msg_permission_adjust_failed");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!ftp_site($connection, "CHMOD 755 ".$ftp_path))
|
||||
if(!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
|
||||
{
|
||||
return new Object(-1, "msg_permission_adjust_failed");
|
||||
}
|
||||
|
|
@ -227,49 +374,85 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!ftp_put($connection, $target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
|
||||
if(!ftp_put($this->connection, $target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
|
||||
{
|
||||
return new Object(-1, "msg_ftp_upload_failed");
|
||||
}
|
||||
}
|
||||
|
||||
ftp_close($connection);
|
||||
$this->_close();
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
|
||||
class FTPModuleInstaller extends ModuleInstaller {
|
||||
var $oFtp = null;
|
||||
var $ftp_info = null;
|
||||
|
||||
function FTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list){
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
|
||||
if($ftp_info->ftp_host)
|
||||
function _connect() {
|
||||
if($this->ftp_info->ftp_host)
|
||||
{
|
||||
$ftp_host = $ftp_info->ftp_host;
|
||||
$ftp_host = $this->ftp_info->ftp_host;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_host = "127.0.0.1";
|
||||
}
|
||||
|
||||
$oFtp = new ftp();
|
||||
if(!$oFtp->ftp_connect($ftp_host, $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $this->ftp_password)) {
|
||||
$oFtp->ftp_quit();
|
||||
$this->oFtp = new ftp();
|
||||
if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
||||
if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) {
|
||||
$this->_close();
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$_list = $oFtp->ftp_rawlist($ftp_info->ftp_root_path);
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$path;
|
||||
|
||||
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
||||
if(!$this->oFtp->ftp_delete($target_path))
|
||||
{
|
||||
return new Object(-1, "failed to delete file ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return new Object(-1, "failed to delete directory ".$path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function _close() {
|
||||
$this->oFtp->ftp_quit();
|
||||
}
|
||||
|
||||
function _copyDir(&$file_list){
|
||||
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
|
||||
$output = $this->_connect();
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$oFtp =& $this->oFtp;
|
||||
$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
|
||||
|
||||
foreach($file_list as $k => $file){
|
||||
$org_file = $file;
|
||||
|
|
@ -281,7 +464,7 @@
|
|||
$path_list = explode('/', dirname($this->target_path."/".$file));
|
||||
|
||||
$real_path = "./";
|
||||
$ftp_path = $ftp_info->ftp_root_path;
|
||||
$ftp_path = $this->ftp_info->ftp_root_path;
|
||||
|
||||
for($i=0;$i<count($path_list);$i++)
|
||||
{
|
||||
|
|
@ -296,7 +479,8 @@
|
|||
}
|
||||
$oFtp->ftp_put($target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file));
|
||||
}
|
||||
$oFtp->ftp_quit();
|
||||
|
||||
$this->_close();
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@
|
|||
return array_shift($output->data);
|
||||
}
|
||||
|
||||
function getInstalledPackages(&$package_list) {
|
||||
$args->package_list = &$package_list;
|
||||
function getInstalledPackages($package_list) {
|
||||
$args->package_list = $package_list;
|
||||
$output = executeQueryArray("autoinstall.getInstalledPackages", $args);
|
||||
$result = array();
|
||||
if(!$output->data) return $result;
|
||||
|
|
@ -133,5 +133,50 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function getConfigFilePath($type)
|
||||
{
|
||||
$config_file = null;
|
||||
switch($type)
|
||||
{
|
||||
case "module":
|
||||
case "addon":
|
||||
case "layout":
|
||||
case "widget":
|
||||
$config_file = "/conf/info.xml";
|
||||
break;
|
||||
case "component":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
case "skin":
|
||||
case "widgetstyle":
|
||||
$config_file = "/skin.xml";
|
||||
break;
|
||||
case "drcomponent":
|
||||
$config_file = "/info.xml";
|
||||
break;
|
||||
}
|
||||
return $config_file;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="0.2">
|
||||
<title xml:lang="ko">쉬운 설치</title>
|
||||
<title xml:lang="en">One Click Installer</title>
|
||||
<title xml:lang="en">EasyInstaller</title>
|
||||
<title xml:lang="vi">Cài đặt tự động</title>
|
||||
<title xml:lang="zh-TW">自動安裝</title>
|
||||
<title xml:lang="zh-CN">在线安装</title>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<description xml:lang="zh-TW">可以藉由此模組安裝、更新程式包括模組、面板、版面等。</description>
|
||||
<description xml:lang="zh-CN">很方便的在管理页面一键安装XE相关模块(模块/皮肤/布局/控件/控件样式等)。</description>
|
||||
<description xml:lang="jp">管理者モードにてクリックだけで、モジュール/スキン/レイアウト/ウィジェット/ウィジェットスタイルのインストールを可能にするモジュールです。</description>
|
||||
<version>0.2</version>
|
||||
<version>0.3</version>
|
||||
<date>2009-11-11</date>
|
||||
<category>system</category>
|
||||
<author email_address="haneul0318@gmail.com" link="http://www.seungyeop.kr">
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
<module>
|
||||
<actions>
|
||||
<action name="dispAutoinstallAdminInstall" type="view" standalone="true" />
|
||||
<action name="dispAutoinstallAdminUninstall" type="view" standalone="true" />
|
||||
<action name="procAutoinstallAdminUninstallPackage" type="controller" standalone="true" />
|
||||
<action name="dispAutoinstallAdminInstalledPackages" type="view" standalone="true" />
|
||||
<action name="dispAutoinstallAdminIndex" type="view" standalone="true" admin_index="true" />
|
||||
<action name="procAutoinstallAdminUpdateinfo" type="controller" standalone="true" />
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "Download";
|
||||
$lang->view_installed_packages = "Installed Packages";
|
||||
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "ダウンロード";
|
||||
$lang->view_installed_packages = "Installed Packages";
|
||||
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "다운로드";
|
||||
$lang->view_installed_packages = "설치된 패키지";
|
||||
$lang->msg_ftp_password_input = "FTP 비밀번호를 입력해주세요";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = 'Download';
|
||||
$lang->view_installed_packages = 'Installed Packages';
|
||||
$lang->msg_ftp_password_input = 'Please input FTP password';
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "Download";
|
||||
$lang->view_installed_packages = "Installed Packages";
|
||||
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "Download";
|
||||
$lang->view_installed_packages = "Installed Packages";
|
||||
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@
|
|||
$lang->cmd_download = "下載";
|
||||
$lang->view_installed_packages = "已安裝套裝軟體";
|
||||
$lang->msg_ftp_password_input = "請輸入 FTP 密碼";
|
||||
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
|
||||
$lang->description_uninstall = "패키지를 삭제합니다. 모듈의 경우 모든 데이터가 사라집니다.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
<query id="getInstalledPackages" action="select">
|
||||
<tables>
|
||||
<table name="ai_installed_packages" />
|
||||
<table name="ai_installed_packages" alias="installed" />
|
||||
<table name="autoinstall_packages" alias="package" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
<column name="installed.*" />
|
||||
<column name="path" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="package_srl" var="package_list" notnull="notnull" />
|
||||
<condition operation="in" column="installed.package_srl" var="package_list" notnull="notnull" />
|
||||
<condition operation="equal" column="installed.package_srl" default="package.package_srl" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
.updateList td .title{ position:relative;}
|
||||
.updateList td .title h3 { padding:0; margin:0 0 5px 0; font-size:12px;}
|
||||
.updateList td .title a {text-decoration:none; color:#333 !important; }
|
||||
.updateList td .title .button{ position:absolute; top:0; right:0;}
|
||||
.updateList td .title .buttons{ position:absolute; top:0; right:0;}
|
||||
.updateList td .info p{ margin:0 0 5px 0; line-height:1.5;}
|
||||
.updateList td .info p.desc{ margin:0 100px 10px 0;}
|
||||
.updateList td .info p.meta{ font-size:11px;}
|
||||
|
|
|
|||
10
modules/autoinstall/tpl/filter/uninstall_package.xml
Normal file
10
modules/autoinstall/tpl/filter/uninstall_package.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<filter name="uninstall_package" module="autoinstall" act="procAutoinstallAdminUninstallPackage" confirm_msg_code="confirm_delete">
|
||||
<form>
|
||||
<node target="ftp_password" required="true" />
|
||||
</form>
|
||||
<response callback_func="completeUninstall">
|
||||
<tag name="error" />
|
||||
<tag name="message" />
|
||||
</response>
|
||||
</filter>
|
||||
|
||||
|
|
@ -31,3 +31,11 @@ function completeInstall(ret_obj) {
|
|||
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
|
||||
}
|
||||
|
||||
function completeUninstall(ret_obj) {
|
||||
alert(ret_obj['message']);
|
||||
if(ret_obj['error'] != 0) return;
|
||||
var params = new Array();
|
||||
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,12 +37,27 @@
|
|||
<a href="{$target_url}">{htmlspecialchars($val->title)} ver. {htmlspecialchars($val->item_version)}</a>
|
||||
</h3>
|
||||
<!--@if($val->current_version)-->
|
||||
{$lang->current_version} : {$val->current_version}
|
||||
<p>{$lang->current_version} : {$val->current_version}
|
||||
<!--@if($val->deps)-->
|
||||
<br />
|
||||
{$lang->dependant_list} :
|
||||
<!--@foreach($val->deps as $package_srl)-->
|
||||
{$installed[$package_srl]->title}.
|
||||
<!--@endforeach-->
|
||||
<!--@end-->
|
||||
</p>
|
||||
<div class="buttons">
|
||||
<!--@if($val->avail_remove)-->
|
||||
<a href="{getUrl('act','dispAutoinstallAdminUninstall','package_srl',$val->package_srl)}" class="button red strong"><span>{$lang->cmd_delete}</span></a>
|
||||
<!--@end-->
|
||||
<!--@if($val->need_update == 'Y')-->
|
||||
<a href="{getUrl('act','dispAutoinstallAdminInstall','package_srl',$val->package_srl)}" class="button"><span>{$lang->update}</span></a>
|
||||
<!--@end-->
|
||||
</div>
|
||||
<!--@else-->
|
||||
<div class="buttons">
|
||||
<a href="{getUrl('act','dispAutoinstallAdminInstall','package_srl',$val->package_srl)}" class="button"><span>{$lang->install}</span></a>
|
||||
</div>
|
||||
<!--@end-->
|
||||
</div>
|
||||
<div class="info">
|
||||
|
|
|
|||
14
modules/autoinstall/tpl/uninstall.html
Normal file
14
modules/autoinstall/tpl/uninstall.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!--#include("header.html")-->
|
||||
<!--%import("css/autoinstall.css")-->
|
||||
<!--%import("js/autoinstall.js")-->
|
||||
<div class="infoText">
|
||||
<p><strong>{$package->title}</strong> [{$package->type}] - {$package->path}</p>
|
||||
<p>{$lang->description_uninstall}</p>
|
||||
<form action="./" method="POST" onsubmit="return procFilter(this, uninstall_package);">
|
||||
<input type="hidden" name="package_srl" value="{$package_srl}" />
|
||||
<!--@if($need_password)-->
|
||||
<p><label for="ftp_password">FTP {$lang->password} ({$lang->about_ftp_password}):</label><input type="password" name="ftp_password" id="ftp_password" class="inputTypeText" /></p>
|
||||
<!--@end-->
|
||||
<span class="button strong"><input type="submit" value="{$lang->cmd_delete}" /></span>
|
||||
</form>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue