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


PHP Package::mapError方法代码示例

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


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

示例1: prepare_remote_upgrade

    public function prepare_remote_upgrade($remoteMPID = 0){
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			Loader::model('marketplace_remote_item');
			$mri = MarketplaceRemoteItem::getByID($remoteMPID);
	
			if (!is_object($mri)) {
				$this->set('error', array(t('Invalid marketplace item ID.')));
				return;
			}
			
			$local = Package::getbyHandle($mri->getHandle());
			if (!is_object($local) || $local->isPackageInstalled() == false) {
				$this->set('error', array(Package::E_PACKAGE_NOT_FOUND));
				return;
			}		
			
			$r = $mri->downloadUpdate();
	
			if ($r != false) {
				if (!is_array($r)) {
					$this->set('error', array($r));
				} else {
					$errors = Package::mapError($r);
					$this->set('error', $errors);
				}
			} else {
				$this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle());
			}
		}
    }
开发者ID:nveid,项目名称:concrete5,代码行数:31,代码来源:update.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:homer6,项目名称:concrete5-mirror,代码行数: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

示例4: foreach

                foreach ($errors as $e) {
                    $error->add($e);
                }
            } else {
                $error->add($r);
            }
        }
    }
}
if (!is_object($mri)) {
    $error->add(t('Invalid package or no package specified.'));
}
if (!$error->has() && $install) {
    $tests = Package::testForInstall($mri->getHandle());
    if (is_array($tests)) {
        $results = Package::mapError($tests);
        foreach ($results as $te) {
            $error->add($te);
        }
    } else {
        $p = Loader::package($mri->getHandle());
        try {
            $p->install();
        } catch (Exception $e) {
            $error->add($e->getMessage());
        }
    }
}
if (!$error->has()) {
    ?>
	<p>
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:31,代码来源:download.php

示例5: download

 public function download($remoteMPID = null)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         Loader::model('marketplace_remote_item');
         $mri = MarketplaceRemoteItem::getByID($remoteMPID);
         if (!is_object($mri)) {
             $this->set('error', array(t('Invalid marketplace item ID.')));
             return;
         }
         $r = $mri->download();
         if ($r != false) {
             if (!is_array($r)) {
                 $this->set('error', array($r));
             } else {
                 $errors = Package::mapError($r);
                 $this->set('error', $errors);
             }
         } else {
             $this->set('message', t('Marketplace item %s downloaded successfully.', $mri->getName()));
         }
     } else {
         $this->error->add(t('You do not have permission to download add-ons.'));
         $this->set('error', $this->error);
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:26,代码来源:install.php


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