本文整理汇总了PHP中Mage_Connect_Package::checkPhpDependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Connect_Package::checkPhpDependencies方法的具体用法?PHP Mage_Connect_Package::checkPhpDependencies怎么用?PHP Mage_Connect_Package::checkPhpDependencies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Connect_Package
的用法示例。
在下文中一共展示了Mage_Connect_Package::checkPhpDependencies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doInstall
/**
* Install action callback
* @param string $command
* @param array $options
* @param array $params
* @return void
*/
public function doInstall($command, $options, $params, $objects = array())
{
$this->cleanupParams($params);
$installFileMode = $command === 'install-file';
try {
$packager = $this->getPackager();
$forceMode = isset($options['force']);
$upgradeAllMode = $command == 'upgrade-all';
$upgradeMode = $command == 'upgrade' || $command == 'upgrade-all';
$noFilesInstall = isset($options['nofiles']);
$withDepsMode = !isset($options['nodeps']);
$ignoreModifiedMode = true || !isset($options['ignorelocalmodification']);
$rest = $this->rest();
$ftp = empty($options['ftp']) ? false : $options['ftp'];
if ($ftp) {
list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
} else {
$config = $this->config();
$cache = $this->getSconfig();
}
if ($installFileMode) {
if (count($params) < 1) {
throw new Exception("Argument should be: filename");
}
$filename = $params[0];
if (!@file_exists($filename)) {
throw new Exception("File '{$filename}' not found");
}
if (!@is_readable($filename)) {
throw new Exception("File '{$filename}' is not readable");
}
$package = new Mage_Connect_Package($filename);
$package->validate();
$errors = $package->getErrors();
if (count($errors)) {
throw new Exception("Package file is invalid\n" . implode("\n", $errors));
}
$pChan = $package->getChannel();
$pName = $package->getName();
$pVer = $package->getVersion();
if (!$cache->isChannel($pChan)) {
throw new Exception("'{$pChan}' is not installed channel");
}
$conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
if (false !== $conflicts) {
$conflicts = implode(", ", $conflicts);
if ($forceMode) {
$this->doError($command, "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
} else {
throw new Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
}
}
$conflicts = $package->checkPhpDependencies();
if (true !== $conflicts) {
$confilcts = implode(",", $conflicts);
$err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
if ($forceMode) {
$this->doError($command, $err);
} else {
throw new Exception($err);
}
}
$conflicts = $package->checkPhpVersion();
if (true !== $conflicts) {
$err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
if ($forceMode) {
$this->doError($command, $err);
} else {
throw new Exception($err);
}
}
if (!$noFilesInstall) {
if ($ftp) {
$packager->processInstallPackageFtp($package, $filename, $config, $ftpObj);
} else {
$packager->processInstallPackage($package, $filename, $config);
}
}
$cache->addPackage($package);
$installedDeps = array();
$installedDepsAssoc = array();
$installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
$installedDeps[] = array($pChan, $pName, $pVer);
$title = isset($options['title']) ? $options['title'] : "Package installed: ";
$out = array($command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title));
if ($ftp) {
$packager->writeToRemoteCache($cache, $ftpObj);
@unlink($config->getFilename());
}
$this->ui()->output($out);
return $out[$command]['data'];
}
if (!$upgradeAllMode) {
//.........这里部分代码省略.........
示例2: doInstall
//.........这里部分代码省略.........
if ($installFileMode) {
if (count($params) < 1) {
throw new Exception("Argument should be: filename");
}
$filename = $params[0];
if (!@file_exists($filename)) {
throw new Exception("File '{$filename}' not found");
}
if (!@is_readable($filename)) {
throw new Exception("File '{$filename}' is not readable");
}
$package = new Mage_Connect_Package($filename);
$package->setConfig($config);
$package->validate();
$errors = $package->getErrors();
if (count($errors)) {
throw new Exception("Package file is invalid\n" . implode("\n", $errors));
}
$pChan = $package->getChannel();
$pName = $package->getName();
$pVer = $package->getVersion();
if (!($cache->isChannelName($pChan) || $cache->isChannelAlias($pChan))) {
throw new Exception("The '{$pChan}' channel is not installed. Please use the MAGE shell " . "script to install the '{$pChan}' channel.");
}
$conflicts = $cache->hasConflicts($pChan, $pName, $pVer);
if (false !== $conflicts) {
$conflicts = implode(", ", $conflicts);
if ($forceMode) {
$this->doError($command, "Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
} else {
throw new Exception("Package {$pChan}/{$pName} {$pVer} conflicts with: " . $conflicts);
}
}
$conflicts = $package->checkPhpDependencies();
if (true !== $conflicts) {
$conflicts = implode(",", $conflicts);
$err = "Package {$pChan}/{$pName} {$pVer} depends on PHP extensions: " . $conflicts;
if ($forceMode) {
$this->doError($command, $err);
} else {
throw new Exception($err);
}
}
$conflicts = $package->checkPhpVersion();
if (true !== $conflicts) {
$err = "Package {$pChan}/{$pName} {$pVer}: " . $conflicts;
if ($forceMode) {
$this->doError($command, $err);
} else {
throw new Exception($err);
}
}
if (!$noFilesInstall) {
if ($ftp) {
$packager->processInstallPackageFtp($package, $filename, $config, $ftpObj);
} else {
$packager->processInstallPackage($package, $filename, $config);
}
}
$cache->addPackage($package);
$installedDeps = array();
$installedDepsAssoc = array();
$installedDepsAssoc[] = array('channel' => $pChan, 'name' => $pName, 'version' => $pVer);
$installedDeps[] = array($pChan, $pName, $pVer);
$title = isset($options['title']) ? $options['title'] : "Package installed: ";
$out = array($command => array('data' => $installedDeps, 'assoc' => $installedDepsAssoc, 'title' => $title));