当前位置: 首页>>代码示例>>PHP>>正文


PHP iaUtil::downloadRemoteContent方法代码示例

本文整理汇总了PHP中iaUtil::downloadRemoteContent方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUtil::downloadRemoteContent方法的具体用法?PHP iaUtil::downloadRemoteContent怎么用?PHP iaUtil::downloadRemoteContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iaUtil的用法示例。


在下文中一共展示了iaUtil::downloadRemoteContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _install

 private function _install($pluginName, $action)
 {
     $result = array('error' => true);
     if (isset($_POST['mode']) && 'remote' == $_POST['mode']) {
         $pluginsTempFolder = IA_TMP . 'plugins' . IA_DS;
         is_dir($pluginsTempFolder) || mkdir($pluginsTempFolder);
         $filePath = $pluginsTempFolder . $pluginName;
         $fileName = $filePath . '.zip';
         // save remote plugin file
         iaUtil::downloadRemoteContent(iaUtil::REMOTE_TOOLS_URL . 'install/' . $pluginName . IA_URL_DELIMITER . IA_VERSION, $fileName);
         if (file_exists($fileName)) {
             if (is_writable($this->_folder)) {
                 // delete previous folder
                 if (is_dir($this->_folder . $pluginName)) {
                     unlink($this->_folder . $pluginName);
                 }
                 include_once IA_INCLUDES . 'utils' . IA_DS . 'pclzip.lib.php';
                 $pclZip = new PclZip($fileName);
                 $pclZip->extract(PCLZIP_OPT_PATH, IA_PLUGINS . $pluginName);
                 $this->_iaCore->iaCache->remove('subrion_plugins.inc');
             } else {
                 $result['message'] = iaLanguage::get('upload_plugin_error');
             }
         }
     }
     $iaExtra = $this->getHelper();
     $installationFile = $this->_folder . $pluginName . IA_DS . iaExtra::INSTALL_FILE_NAME;
     if (!file_exists($installationFile)) {
         $result['message'] = iaLanguage::get('file_doesnt_exist');
     } else {
         $iaExtra->setXml(file_get_contents($installationFile));
         $result['error'] = false;
     }
     $iaExtra->parse();
     $installationPossible = false;
     $version = explode('-', $iaExtra->itemData['compatibility']);
     if (!isset($version[1])) {
         if (version_compare($version[0], IA_VERSION, '<=')) {
             $installationPossible = true;
         }
     } else {
         if (version_compare($version[0], IA_VERSION, '<=') && version_compare($version[1], IA_VERSION, '>=')) {
             $installationPossible = true;
         }
     }
     if (!$installationPossible) {
         $result['message'] = iaLanguage::get('incompatible');
         $result['error'] = true;
     }
     if (!$result['error']) {
         $iaExtra->doAction(iaExtra::ACTION_INSTALL);
         if ($iaExtra->error) {
             $result['message'] = $iaExtra->getMessage();
             $result['error'] = true;
         } else {
             $iaLog = $this->_iaCore->factory('log');
             if ($iaExtra->isUpgrade) {
                 $result['message'] = iaLanguage::get('plugin_updated');
                 $iaLog->write(iaLog::ACTION_UPGRADE, array('type' => iaExtra::TYPE_PLUGIN, 'name' => $iaExtra->itemData['info']['title'], 'to' => $iaExtra->itemData['info']['version']));
             } else {
                 $result['groups'] = $iaExtra->getMenuGroups();
                 $result['message'] = iaExtra::ACTION_INSTALL == $action ? iaLanguage::getf('plugin_installed', array('name' => $iaExtra->itemData['info']['title'])) : iaLanguage::getf('plugin_reinstalled', array('name' => $iaExtra->itemData['info']['title']));
                 $iaLog->write(iaLog::ACTION_INSTALL, array('type' => iaExtra::TYPE_PLUGIN, 'name' => $iaExtra->itemData['info']['title']));
             }
             empty($iaExtra->itemData['notes']) || ($result['message'][] = $iaExtra->itemData['notes']);
             $this->_iaCore->getConfig(true);
         }
     }
     $result['result'] = !$result['error'];
     unset($result['error']);
     return $result;
 }
开发者ID:bohmszi,项目名称:kdbe_cms,代码行数:72,代码来源:plugins.php

示例2: forceUpgrade

 public static function forceUpgrade($version)
 {
     iaCore::instance()->factory('util');
     $patchUrl = iaUtil::REMOTE_TOOLS_URL . 'get/patch/%s/%s/';
     $patchUrl = sprintf($patchUrl, IA_VERSION, $version);
     $filePath = IA_TMP . 'patch.iap';
     iaUtil::downloadRemoteContent($patchUrl, $filePath);
     if ($contents = file_get_contents($filePath)) {
         require_once IA_HOME . 'install/classes/ia.patch.parser.php';
         require_once IA_HOME . 'install/classes/ia.patch.applier.php';
         try {
             $iaPatchParser = new iaPatchParser($contents);
             $patch = $iaPatchParser->patch;
             $iaPatchApplier = new iaPatchApplier(IA_HOME, array('host' => INTELLI_DBHOST . ':' . INTELLI_DBPORT, 'database' => INTELLI_DBNAME, 'user' => INTELLI_DBUSER, 'password' => INTELLI_DBPASS, 'prefix' => INTELLI_DBPREFIX), true);
             $iaPatchApplier->process($patch, $version);
             $logFile = 'upgrade-log-' . $patch['info']['version_to'] . '_' . date('d-m-y-Hi') . '.txt';
             if ($fh = fopen(IA_UPLOADS . $logFile, 'wt')) {
                 fwrite($fh, $iaPatchApplier->getLog());
                 fclose($fh);
             }
             $logParams = array('type' => 'app-forced', 'from' => IA_VERSION, 'to' => $version, 'file' => $logFile);
             $iaLog = iaCore::instance()->factory('log');
             $iaLog->write(iaLog::ACTION_UPGRADE, $logParams);
             return true;
         } catch (Exception $e) {
             return $e->getMessage();
         }
     }
     return false;
 }
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:30,代码来源:ia.system.php

示例3: _downloadTemplate

 private function _downloadTemplate()
 {
     $templateName = $_POST['download'];
     $templatesTempFolder = IA_TMP . 'templates' . IA_DS;
     if (!is_dir($templatesTempFolder)) {
         mkdir($templatesTempFolder);
     }
     $filePath = $templatesTempFolder . $templateName;
     $fileName = $filePath . '.zip';
     // save remote template file
     iaUtil::downloadRemoteContent(iaUtil::REMOTE_TOOLS_URL . 'install/' . $templateName . IA_URL_DELIMITER . IA_VERSION, $fileName);
     if (file_exists($fileName)) {
         if (is_writable(IA_FRONT_TEMPLATES)) {
             // delete previous folder
             if (is_dir(IA_FRONT_TEMPLATES . $templateName)) {
                 unlink(IA_FRONT_TEMPLATES . $templateName);
             }
             include_once IA_INCLUDES . 'utils' . IA_DS . 'pclzip.lib.php';
             $pclZip = new PclZip($fileName);
             $pclZip->extract(PCLZIP_OPT_PATH, IA_FRONT_TEMPLATES . $templateName);
             $this->addMessage(iaLanguage::getf('template_downloaded', array('name' => $templateName)), false);
             return true;
         } else {
             $this->_error = true;
             $this->addMessage('upload_template_error');
         }
     }
     return false;
 }
开发者ID:kamilklkn,项目名称:subrion,代码行数:29,代码来源:templates.php


注:本文中的iaUtil::downloadRemoteContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。