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


PHP Package::testForInstall方法代码示例

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


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

示例1: do_update

	public function do_update($pkgHandle = false) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			if ($pkgHandle) {
				$tests = Package::testForInstall($pkgHandle, false);
				if (is_array($tests)) {
					$tests = Package::mapError($tests);
					$this->set('error', $tests);
				} else {
					$p = Package::getByHandle($pkgHandle);
					$currentLocale = Localization::activeLocale();
					if ($currentLocale != 'en_US') {
						// Prevent the database records being stored in wrong language
						Localization::changeLocale('en_US');
					}
					try {
						$p->upgradeCoreData();
						if ($currentLocale != 'en_US') {
							Localization::changeLocale($currentLocale);
						}
						$p->upgrade();
						$this->set('message', t('The package has been updated successfully.'));
					} catch(Exception $e) {
						$this->set('error', $e);
					}
				}
			}
		}
		$this->view();
	}
开发者ID:nveid,项目名称:concrete5,代码行数:30,代码来源:update.php

示例2: install_package

 public function install_package($package)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         $p = Loader::package($package);
         if (is_object($p)) {
             if (!$p->showInstallOptionsScreen() || Loader::helper('validation/token')->validate('install_options_selected')) {
                 $tests = Package::testForInstall($package);
                 if (is_array($tests)) {
                     $tests = Package::mapError($tests);
                     $this->set('error', $tests);
                 } else {
                     $currentLocale = Localization::activeLocale();
                     if ($currentLocale != 'en_US') {
                         // Prevent the database records being stored in wrong language
                         Localization::changeLocale('en_US');
                     }
                     try {
                         $u = new User();
                         $pkg = $p->install($this->post());
                         if ($u->isSuperUser() && $p->allowsFullContentSwap() && $this->post('pkgDoFullContentSwap')) {
                             $p->swapContent($this->post());
                         }
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         $pkg = Package::getByHandle($p->getPackageHandle());
                         $this->redirect('/dashboard/extend/install', 'package_installed', $pkg->getPackageID());
                     } catch (Exception $e) {
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         if ($p->showInstallOptionsScreen()) {
                             $this->set('showInstallOptionsScreen', true);
                             $this->set('pkg', $p);
                         }
                         $this->set('error', $e);
                     }
                 }
             } else {
                 $this->set('showInstallOptionsScreen', true);
                 $this->set('pkg', $p);
             }
         } else {
             $msg = t('Install failed - invalid package. Check log for details');
             $this->error->add($msg);
             $this->set('error', $this->error);
         }
     } else {
         $this->error->add(t('You do not have permission to install add-ons.'));
         $this->set('error', $this->error);
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:53,代码来源:install.php

示例3: foreach

            if (is_array($r)) {
                $errors = Package::mapError($r);
                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()) {
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:31,代码来源:download.php

示例4: 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);
         } else {
             if ($file == Package::E_PACKAGE_INVALID_APP_VERSION) {
                 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:ronlobo,项目名称:concrete5-de,代码行数:35,代码来源:marketplace_remote_item.php

示例5: install_package

	public function install_package($package) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			$tests = Package::testForInstall($package);
			if (is_array($tests)) {
				$tests = Package::mapError($tests);
				$this->set('error', $tests);
			} else {
				$p = Loader::package($package);
				try {
					$p->install();
					$this->set('message', t('The package has been installed.'));
				} catch(Exception $e) {
					$this->set('error', $e);
				}
			}
		} else {
			$this->error->add(t('You do not have permission to install add-ons.'));
			$this->set('error', $this->error);
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:21,代码来源:install.php

示例6: install_package

	public function install_package($package) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			$p = Loader::package($package);
			if (is_object($p)) {
				if (
					(!$p->showInstallOptionsScreen()) ||
					Loader::helper('validation/token')->validate('install_options_selected')
				) {
					$tests = Package::testForInstall($package);
					if (is_array($tests)) {
						$tests = Package::mapError($tests);
						$this->set('error', $tests);
					} else {
						try {
							$u = new User();
							$p->install($this->post());
							if ($u->isSuperUser() && $p->allowsFullContentSwap() && $this->post('pkgDoFullContentSwap')) { 
								$p->swapContent($this->post());
							}
							$this->set('message', t('The package has been installed.'));
						} catch(Exception $e) {
							if ($p->showInstallOptionsScreen()) {
								$this->set('showInstallOptionsScreen', true);
								$this->set('pkg', $p);
							}
							$this->set('error', $e);
						}
					}
				} else {
					$this->set('showInstallOptionsScreen', true);
					$this->set('pkg', $p);
				}
			}
		} else {
			$this->error->add(t('You do not have permission to install add-ons.'));
			$this->set('error', $this->error);
		}
	}
开发者ID:nbourguig,项目名称:concrete5,代码行数:39,代码来源:install.php


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