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


PHP Marketplace::downloadRemoteFile方法代码示例

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


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

示例1: download

	public function download() {
		$file = Marketplace::downloadRemoteFile($this->getRemoteFileURL());
		if (empty($file) || $file == Package::E_PACKAGE_DOWNLOAD) {
			return array(Package::E_PACKAGE_DOWNLOAD);
		} else if ($file == Package::E_PACKAGE_SAVE) {
			return array($file);
		}
	
		try {
			Loader::model('package_archive');
			$am = new PackageArchive($this->getHandle());
			$am->install($file, true);
		} catch (Exception $e) {
			return array($e->getMessage());
		}
	
		if ($install) {
			$tests = Package::testForInstall($this->getHandle());
			if (is_array($tests)) {
				return $tests;
			} else {
				$p = Loader::package($this->getHandle());
				try {
					$p->install();
				} catch(Exception $e) {
					return array(Package::E_PACKAGE_INSTALL);
				}
			}
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:30,代码来源:marketplace_remote_item.php

示例2: download_update

 public function download_update()
 {
     if (MULTI_SITE == 1) {
         return false;
     }
     $vt = Loader::helper('validation/token');
     if (!$vt->validate('download_update')) {
         $this->error->add($vt->getErrorMessage());
     }
     if (!is_dir(DIR_APP_UPDATES)) {
         $this->error->add(t('The directory %s does not exist.', DIR_APP_UPDATES));
     } else {
         if (!is_writable(DIR_APP_UPDATES)) {
             $this->error->add(t('The directory %s must be writable by the web server.', DIR_APP_UPDATES));
         }
     }
     if (!$this->error->has()) {
         $remote = Update::getApplicationUpdateInformation();
         if (is_object($remote)) {
             // try to download
             Loader::library("marketplace");
             $r = Marketplace::downloadRemoteFile($remote->url);
             if (empty($r) || $r == Package::E_PACKAGE_DOWNLOAD) {
                 $response = array(Package::E_PACKAGE_DOWNLOAD);
             } else {
                 if ($r == Package::E_PACKAGE_SAVE) {
                     $response = array($r);
                 }
             }
             if (isset($response)) {
                 $errors = Package::mapError($response);
                 foreach ($errors as $e) {
                     $this->error->add($e);
                 }
             }
             if (!$this->error->has()) {
                 // the file exists in the right spot
                 Loader::library('archive');
                 $ar = new UpdateArchive();
                 try {
                     $ar->install($r);
                 } catch (Exception $e) {
                     $this->error->add($e->getMessage());
                 }
             }
         } else {
             $this->error->add(t('Unable to retrieve software from update server.'));
         }
     }
     $this->view();
 }
开发者ID:rmxdave,项目名称:concrete5,代码行数:51,代码来源:update.php

示例3: download_update

 public function download_update()
 {
     $p = new \Permissions();
     if (!$p->canUpgrade()) {
         return false;
     }
     $vt = Loader::helper('validation/token');
     if (!$vt->validate('download_update')) {
         $this->error->add($vt->getErrorMessage());
     }
     if (!is_dir(DIR_CORE_UPDATES)) {
         $this->error->add(t('The directory %s does not exist.', DIR_CORE_UPDATES));
     } else {
         if (!is_writable(DIR_CORE_UPDATES)) {
             $this->error->add(t('The directory %s must be writable by the web server.', DIR_CORE_UPDATES));
         }
     }
     if (!$this->error->has()) {
         $remote = \Concrete\Core\Updater\Update::getApplicationUpdateInformation();
         if (is_object($remote)) {
             // try to download
             $r = \Marketplace::downloadRemoteFile($remote->getDirectDownloadURL());
             if (empty($r) || $r == \Package::E_PACKAGE_DOWNLOAD) {
                 $response = array(\Package::E_PACKAGE_DOWNLOAD);
             } else {
                 if ($r == \Package::E_PACKAGE_SAVE) {
                     $response = array($r);
                 }
             }
             if (isset($response)) {
                 $errors = \Package::mapError($response);
                 foreach ($errors as $e) {
                     $this->error->add($e);
                 }
             }
             if (!$this->error->has()) {
                 // the file exists in the right spot
                 $ar = new UpdateArchive();
                 try {
                     $ar->install($r);
                 } catch (Exception $e) {
                     $this->error->add($e->getMessage());
                 }
             }
         } else {
             $this->error->add(t('Unable to retrieve software from update server.'));
         }
     }
     $this->view();
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:50,代码来源:update.php


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