4 require_once(
_XE_PATH_ .
'modules/autoinstall/autoinstall.lib.php');
32 return ($local_checksum === $checksum);
54 $this->
setMessage(
"success_updated",
'update');
66 $item = $oModel->getLatestPackage();
69 $params[
"updatedate"] = $item->updatedate;
72 $params[
"act"] =
"getResourceapiUpdate";
76 $xmlDoc = $xml->parse($buff);
94 $packages = $oModel->getPackages();
95 foreach($packages as $package)
98 if(!file_exists($real_path))
103 $type = $oModel->getTypeFromPath($package->path);
119 $config_file =
"/conf/info.xml";
122 $config_file =
"/info.xml";
129 $config_file =
"/skin.xml";
132 $config_file =
"/info.xml";
136 $config_file =
"/conf/info.xml";
147 $xmlDoc = $xml->loadXmlFile($real_path . $config_file);
154 $version = $xmlDoc->{$type}->version->body;
157 $args =
new stdClass();
158 $args->package_srl = $package->package_srl;
159 $args->version = $package->version;
160 $args->current_version = $version;
161 if(version_compare(
$args->version,
$args->current_version,
">"))
163 $args->need_update =
"Y";
167 $args->need_update =
"N";
185 $packages = explode(
',', $package_srls);
187 if(!$_SESSION[
'ftp_password'])
193 $ftp_password = $_SESSION[
'ftp_password'];
196 $isSftpSupported = function_exists(ssh2_sftp);
197 foreach($packages as $package_srl)
199 $package = $oModel->getPackage($package_srl);
200 if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
204 else if($ftp_info->sftp && $ftp_info->sftp ==
'Y' && $isSftpSupported)
208 else if(function_exists(ftp_connect))
218 $oModuleInstaller->setPassword($ftp_password);
219 $output = $oModuleInstaller->install();
226 $this->_updateinfo();
228 $this->setMessage(
'success_installed',
'update');
236 $this->setRedirectUrl(preg_replace(
'/act=[^&]*/',
'act=dispAutoinstallAdminIndex',
Context::get(
'error_return_url')));
249 if(!$xmlDoc->response->packages->item)
253 if(!is_array($xmlDoc->response->packages->item))
255 $xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
257 $targets = array(
'package_srl',
'updatedate',
'latest_item_srl',
'path',
'version',
'category_srl',
'have_instance');
258 foreach($xmlDoc->response->packages->item as $item)
260 $args =
new stdClass();
261 foreach($targets as $target)
263 $args->{$target} = $item->{$target}->body;
265 if($oModel->getPackage(
$args->package_srl))
291 if(!is_array($xmlDoc->response->categorylist->item))
293 $xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
296 foreach($xmlDoc->response->categorylist->item as $item)
298 $args =
new stdClass();
299 $args->category_srl = $item->category_srl->body;
300 $args->parent_srl = $item->parent_srl->body;
301 $args->title = $item->title->body;
302 $args->list_order = $list_order++;
316 $output = $this->uninstallPackageByPackageSrl($package_srl);
328 $this->setRedirectUrl(
getNotEncodedUrl(
'',
'module',
'admin',
'act',
'dispAutoinstallAdminInstalledPackages'));
340 $package = $oModel->getPackage($package_srl);
342 return $this->_uninstallPackage($package);
352 $package->path = $path;
353 return $this->_uninstallPackage($package);
356 private function _uninstallPackage($package)
358 $path = $package->path;
362 if(!$_SESSION[
'ftp_password'])
368 $ftp_password = $_SESSION[
'ftp_password'];
372 $isSftpSupported = function_exists(ssh2_sftp);
373 if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
377 else if($ftp_info->sftp && $ftp_info->sftp ==
'Y' && $isSftpSupported)
381 else if(function_exists(
'ftp_connect'))
392 $oModuleInstaller->setPassword($ftp_password);
393 $output = $oModuleInstaller->uninstall();
399 $this->_updateinfo();
401 $this->setMessage(
'success_deleted',
'update');
setMessage($message= 'success', $type=NULL)
uninstallPackageByPackageSrl($package_srl)
checkFileCheckSum($file, $checksum)
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
const _XE_DOWNLOAD_SERVER_
setRedirectUrl($url= './', $output=NULL)
uninstallPackageByPath($path)
getAdminModel($module_name)
procAutoinstallAdminPackageinstall()
getAdminController($module_name)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
procAutoinstallAdminUpdateinfo()
procAutoinstallAdminUninstallPackage()