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


PHP Mage_Connect_Package::setConfig方法代码示例

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


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

示例1: doInstall

 /**
  * Install action callback
  *
  * @throws Exception
  * @param string $command
  * @param array $options
  * @param array $params
  * @param array $objects
  * @return array|null
  */
 public function doInstall($command, $options, $params, $objects = array())
 {
     $this->cleanupParams($params);
     $installFileMode = $command === 'install-file';
     /** @var $ftpObj Mage_Connect_Ftp */
     $ftpObj = null;
     $ftp = empty($options['ftp']) ? false : $options['ftp'];
     /** @var $packager Mage_Connect_Packager */
     $packager = $this->getPackager();
     /** @var $cache Mage_Connect_Singleconfig */
     /** @var $config Mage_Connect_Config */
     if ($ftp) {
         list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
     } else {
         $cache = $this->getSconfig();
         $config = $this->config();
     }
     try {
         $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']);
         $clearInstallMode = $command == 'install' && !$forceMode;
         $installAll = isset($options['install_all']);
         $channelAuth = isset($options['auth']) ? $options['auth'] : array();
         $rest = $this->rest();
         if (empty($config->magento_root)) {
             $config->magento_root = dirname(dirname($_SERVER['SCRIPT_FILENAME']));
         }
         chdir($config->magento_root);
         $dirCache = DIRECTORY_SEPARATOR . $config->downloader_path . DIRECTORY_SEPARATOR . Mage_Connect_Config::DEFAULT_CACHE_PATH;
         $dirTmp = DIRECTORY_SEPARATOR . Mage_Connect_Package_Reader::PATH_TO_TEMPORARY_DIRECTORY;
         $dirMedia = DIRECTORY_SEPARATOR . 'media';
         $isWritable = true;
         if ($ftp) {
             $cwd = $ftpObj->getcwd();
             $ftpObj->mkdirRecursive($cwd . $dirCache, 0777);
             $ftpObj->chdir($cwd);
             $ftpObj->mkdirRecursive($cwd . $dirTmp, 0777);
             $ftpObj->chdir($cwd);
             $ftpObj->mkdirRecursive($cwd . $dirMedia, 0777);
             $ftpObj->chdir($cwd);
             $err = "Please check for sufficient ftp write file permissions.";
         } else {
             @mkdir($config->magento_root . $dirCache, 0777, true);
             @mkdir($config->magento_root . $dirTmp, 0777, true);
             @mkdir($config->magento_root . $dirMedia, 0777, true);
             $isWritable = is_writable($config->magento_root) && is_writable($config->magento_root . DIRECTORY_SEPARATOR . $config->downloader_path) && is_writable($config->magento_root . $dirCache) && is_writable($config->magento_root . $dirTmp) && is_writable($config->magento_root . $dirMedia);
             $err = "Please check for sufficient write file permissions.";
         }
         $isWritable = $isWritable && is_writable($config->magento_root . $dirMedia) && is_writable($config->magento_root . $dirCache) && is_writable($config->magento_root . $dirTmp);
         if (!$isWritable) {
             $this->doError($command, $err);
             throw new Exception('Your Magento folder does not have sufficient write permissions, which downloader requires.');
         }
         if (!empty($channelAuth)) {
             $rest->getLoader()->setCredentials($channelAuth['username'], $channelAuth['password']);
         }
         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 {
//.........这里部分代码省略.........
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:101,代码来源:Install.php


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