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


PHP eZPackage::systemRepositoryInformation方法代码示例

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


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

示例1: retrieveRemotePackagesList

 /**
  * Retrieve list of packages available to download.
  *
  * Example of return value:
  * array(
  *  'packages' => array(
  *                      '<package_name1>' => array( "name" =>... , "version" =>... , "summary" => ... "url" =>... ),
  *                      '<package_name2>' => array( "name" =>... , "version" =>... , "summary" => ... "url" =>... )
  *                     )
  *      );
  *
  */
 function retrieveRemotePackagesList($onlySitePackages = false)
 {
     // Download index file.
     $idxFileName = $this->downloadFile($this->XMLIndexURL, eZStepSiteTypes::tempDir(), 'index.xml');
     if ($idxFileName === false) {
         // Searching for a local index.xml file to use for offline installation
         $destIndexPath = eZStepSiteTypes::tempDir() . DIRECTORY_SEPARATOR . 'index.xml';
         $repo = eZPackage::systemRepositoryInformation();
         if ($repo) {
             $sourceIndexPath = $repo['path'] . DIRECTORY_SEPARATOR . 'index.xml';
             if (file_exists($sourceIndexPath)) {
                 eZFileHandler::copy($sourceIndexPath, $destIndexPath);
                 $idxFileName = $destIndexPath;
                 // Removing error message from downloadFile
                 $this->ErrorMsg = false;
             }
         }
     }
     if ($idxFileName === false) {
         $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Retrieving remote site packages list failed. ' . 'You may upload packages manually.');
         eZDebug::writeNotice("Cannot download remote packages index file from '{$this->XMLIndexURL}'.");
         return false;
     }
     // Parse it.
     $dom = new DOMDocument('1.0', 'utf-8');
     $dom->preserveWhiteSpace = false;
     $success = $dom->load(realpath($idxFileName));
     @unlink($idxFileName);
     if (!$success) {
         eZDebug::writeError("Unable to open index file.");
         return false;
     }
     $root = $dom->documentElement;
     if ($root->localName != 'packages') {
         eZDebug::writeError("Malformed index file.");
         return false;
     }
     $packageList = array();
     foreach ($root->childNodes as $packageNode) {
         if ($packageNode->localName != 'package') {
             // skip unwanted chilren
             continue;
         }
         if ($onlySitePackages && $packageNode->getAttribute('type') != 'site') {
             // skip non-site packages
             continue;
         }
         $packageAttributes = array();
         foreach ($packageNode->attributes as $attributeNode) {
             $packageAttributes[$attributeNode->localName] = $attributeNode->value;
         }
         $packageList[$packageAttributes['name']] = $packageAttributes;
     }
     return $packageList;
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:67,代码来源:ezstep_site_types.php


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