mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +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,16 +1,19 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'libs/ftp.class.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();
|
||||
|
|
@ -108,17 +117,17 @@ class ModuleInstaller
|
|||
{
|
||||
if($this->package->path == ".")
|
||||
{
|
||||
$this->download_file = $this->temp_dir."xe.tar";
|
||||
$this->download_file = $this->temp_dir . "xe.tar";
|
||||
$this->target_path = "";
|
||||
$this->download_path = $this->temp_dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
$subpath = substr($this->package->path,2);
|
||||
$this->download_file = $this->temp_dir.$subpath.".tar";
|
||||
$subpath = substr($this->package->path, 2);
|
||||
$this->download_file = $this->temp_dir . $subpath . ".tar";
|
||||
$subpatharr = explode("/", $subpath);
|
||||
array_pop($subpatharr);
|
||||
$this->download_path = $this->temp_dir.implode("/", $subpatharr);
|
||||
$this->download_path = $this->temp_dir . implode("/", $subpatharr);
|
||||
$this->target_path = implode("/", $subpatharr);
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
|
|
@ -230,7 +248,7 @@ class ModuleInstaller
|
|||
*/
|
||||
function _unPack()
|
||||
{
|
||||
require_once(_XE_PATH_.'libs/tar.class.php');
|
||||
require_once(_XE_PATH_ . 'libs/tar.class.php');
|
||||
|
||||
$oTar = new tar();
|
||||
$oTar->openTAR($this->download_file);
|
||||
|
|
@ -241,7 +259,7 @@ class ModuleInstaller
|
|||
{
|
||||
foreach($_files as $key => $info)
|
||||
{
|
||||
FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
|
||||
FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
|
||||
$file_list[] = $info['name'];
|
||||
}
|
||||
}
|
||||
|
|
@ -261,27 +279,37 @@ class ModuleInstaller
|
|||
$files = array();
|
||||
while($file = $oDir->read())
|
||||
{
|
||||
if($file == "." || $file == "..") continue;
|
||||
if($file == "." || $file == "..")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
$file_path = $path."/".$file;
|
||||
$file_path = $path . "/" . $file;
|
||||
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
|
||||
|
|
@ -316,7 +345,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function SFTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->package = &$package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -345,7 +377,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
$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');
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
$this->sftp = ssh2_sftp($this->connection);
|
||||
|
|
@ -359,6 +391,7 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -369,8 +402,11 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$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))
|
||||
{
|
||||
|
|
@ -387,8 +423,11 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$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))
|
||||
{
|
||||
|
|
@ -403,12 +442,19 @@ 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;
|
||||
$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
|
||||
|
||||
if(is_array($file_list))
|
||||
{
|
||||
|
|
@ -417,21 +463,22 @@ class SFTPModuleInstaller extends ModuleInstaller
|
|||
$org_file = $file;
|
||||
if($this->package->path == ".")
|
||||
{
|
||||
$file = substr($file,3);
|
||||
$file = substr($file, 3);
|
||||
}
|
||||
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
||||
$pathname = dirname($target_dir."/".$file);
|
||||
$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
|
||||
$pathname = dirname($target_dir . "/" . $file);
|
||||
|
||||
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);
|
||||
ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
|
@ -460,7 +508,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function PHPFTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->package = &$package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
|
|
@ -490,13 +538,13 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
if(!$login_result)
|
||||
{
|
||||
$this->_close();
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
||||
$_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,12 +557,15 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$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(-1, "failed to delete file " . $path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -527,12 +578,15 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$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(-1, "failed to delete directory " . $path);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -555,39 +609,54 @@ 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);
|
||||
}
|
||||
$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
|
||||
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
|
||||
|
||||
if(is_array($file_list))
|
||||
{
|
||||
foreach($file_list as $k => $file)
|
||||
{
|
||||
if(!$file) continue;
|
||||
if(!$file)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$org_file = $file;
|
||||
if($this->package->path == ".")
|
||||
{
|
||||
$file = substr($file,3);
|
||||
$file = substr($file, 3);
|
||||
}
|
||||
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
||||
$path_list = explode('/', dirname($this->target_path."/".$file));
|
||||
$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
|
||||
$path_list = explode('/', dirname($this->target_path . "/" . $file));
|
||||
|
||||
$real_path = "./";
|
||||
$ftp_path = $this->ftp_info->ftp_root_path;
|
||||
|
||||
for($i=0;$i<count($path_list);$i++)
|
||||
for($i = 0; $i < count($path_list); $i++)
|
||||
{
|
||||
if($path_list=="") continue;
|
||||
$real_path .= $path_list[$i]."/";
|
||||
$ftp_path .= $path_list[$i]."/";
|
||||
if($path_list == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$real_path .= $path_list[$i] . "/";
|
||||
$ftp_path .= $path_list[$i] . "/";
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
{
|
||||
if(!@ftp_mkdir($this->connection, $ftp_path))
|
||||
|
|
@ -606,7 +675,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
|
||||
if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
|
||||
{
|
||||
return new Object(-1, "msg_permission_adjust_failed");
|
||||
}
|
||||
|
|
@ -614,7 +683,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!ftp_put($this->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");
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -650,8 +721,8 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function FTPModuleInstaller(&$package)
|
||||
{
|
||||
$this->package =& $package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
$this->package = &$package;
|
||||
$this->ftp_info = Context::getFTPInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -675,9 +746,10 @@ 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');
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$_SESSION['ftp_password'] = $this->ftp_password;
|
||||
return new Object();
|
||||
|
|
@ -691,8 +763,11 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeFile($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$path;
|
||||
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,8 +783,11 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
*/
|
||||
function _removeDir_real($path)
|
||||
{
|
||||
if(substr($path, 0, 2) == "./") $path = substr($path, 2);
|
||||
$target_path = $this->ftp_info->ftp_root_path.$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))
|
||||
{
|
||||
|
|
@ -736,13 +814,19 @@ 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;
|
||||
$oFtp = &$this->oFtp;
|
||||
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
|
||||
|
||||
if(is_array($file_list))
|
||||
{
|
||||
|
|
@ -751,26 +835,29 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
$org_file = $file;
|
||||
if($this->package->path == ".")
|
||||
{
|
||||
$file = substr($file,3);
|
||||
$file = substr($file, 3);
|
||||
}
|
||||
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
||||
$path_list = explode('/', dirname($this->target_path."/".$file));
|
||||
$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
|
||||
$path_list = explode('/', dirname($this->target_path . "/" . $file));
|
||||
|
||||
$real_path = "./";
|
||||
$ftp_path = $this->ftp_info->ftp_root_path;
|
||||
|
||||
for($i=0;$i<count($path_list);$i++)
|
||||
for($i = 0; $i < count($path_list); $i++)
|
||||
{
|
||||
if($path_list=="") continue;
|
||||
$real_path .= $path_list[$i]."/";
|
||||
$ftp_path .= $path_list[$i]."/";
|
||||
if($path_list == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$real_path .= $path_list[$i] . "/";
|
||||
$ftp_path .= $path_list[$i] . "/";
|
||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||
{
|
||||
$oFtp->ftp_mkdir($ftp_path);
|
||||
$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
|
||||
$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
|
||||
}
|
||||
}
|
||||
$oFtp->ftp_put($target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file));
|
||||
$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -778,7 +865,7 @@ class FTPModuleInstaller extends ModuleInstaller
|
|||
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.lib.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.lib.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue