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


PHP eZPackage::create方法代码示例

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


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

示例1: createPackage

 function createPackage(&$package, $http, &$persistentData, &$cleanupFiles, $storePackage = true)
 {
     $createdPackage = false;
     if (!$package instanceof eZPackage) {
         $package = eZPackage::create($persistentData['name'], array('summary' => $persistentData['summary']));
         $createdPackage = true;
     } else {
         $package->setAttribute('summary', $persistentData['summary']);
     }
     $package->setAttribute('is_active', false);
     $package->setAttribute('type', $this->packageType($package, $persistentData));
     $package->setRelease($persistentData['version'], '1', false, $persistentData['licence'], $this->packageInitialState($package, $persistentData));
     $package->setAttribute('description', $persistentData['description']);
     $package->setAttribute('install_type', $this->packageInstallType($package, $persistentData));
     $package->setAttribute('packaging-host', $persistentData['host']);
     $package->setAttribute('packaging-packager', $persistentData['packager']);
     $changelogPerson = $persistentData['changelog_person'];
     $changelogEmail = $persistentData['changelog_email'];
     $changelogEntries = $persistentData['changelog_entries'];
     $maintainerPerson = $persistentData['maintainer_person'];
     $maintainerEmail = $persistentData['maintainer_email'];
     $maintainerRole = $persistentData['maintainer_role'];
     if ($maintainerPerson) {
         $package->appendMaintainer($maintainerPerson, $maintainerEmail, $maintainerRole);
     }
     if ($changelogPerson) {
         $package->appendChange($changelogPerson, $changelogEmail, $changelogEntries);
     }
     if ($persistentData['licence'] == 'GPL') {
         eZPackageCreationHandler::appendLicence($package);
     }
     $collections = array();
     $cleanupFiles = array();
     if (isset($persistentData['thumbnail']) and $persistentData['thumbnail']) {
         $thumbnail = $persistentData['thumbnail'];
         $fileItem = array('file' => $thumbnail['filename'], 'type' => 'thumbnail', 'role' => false, 'design' => false, 'path' => $thumbnail['url'], 'collection' => 'default', 'file-type' => false, 'role-value' => false, 'variable-name' => 'thumbnail');
         $package->appendFile($fileItem['file'], $fileItem['type'], $fileItem['role'], $fileItem['design'], $fileItem['path'], $fileItem['collection'], null, null, true, null, $fileItem['file-type'], $fileItem['role-value'], $fileItem['variable-name']);
         $cleanupFiles[] = $fileItem['path'];
         if (!in_array($fileItem['collection'], $collections)) {
             $collections[] = $fileItem['collection'];
         }
     }
     foreach ($collections as $collection) {
         $installItems = $package->installItemsList('ezfile', false, $collection, true);
         if (count($installItems) == 0) {
             $package->appendInstall('ezfile', false, false, true, false, false, array('collection' => $collection));
         }
         $dependencyItems = $package->dependencyItems('provides', array('type' => 'ezfile', 'name' => 'collection', 'valiue' => $collection));
         if (count($dependencyItems) == 0) {
             $package->appendDependency('provides', array('type' => 'ezfile', 'name' => 'collection', 'value' => $collection));
         }
         $installItems = $package->installItemsList('ezfile', false, $collection, false);
         if (count($installItems) == 0) {
             $package->appendInstall('ezfile', false, false, false, false, false, array('collection' => $collection));
         }
     }
     $package->setAttribute('is_active', true);
     if ($storePackage) {
         $package->store();
     }
     return $createdPackage;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:62,代码来源:ezpackagecreationhandler.php

示例2: array

                 $package->exportToArchive($exportDirectory . eZSys::fileSeparator() . $package->exportName());
                 $cli->output("Package " . $cli->stylize('symbol', $package->attribute('name')) . " exported to directory " . $cli->stylize('dir', $exportDirectory));
             }
         } else {
             $exportPath = $package->exportToArchive($package->exportName());
             $cli->output("Package " . $cli->stylize('symbol', $package->attribute('name')) . " exported to file " . $cli->stylize('file', $exportPath));
         }
     } else {
         $cli->error("Could not locate package " . $cli->stylize('emphasize', $commandItem['name']));
     }
 } else {
     if ($command == 'create') {
         if ($alreadyCreated) {
             $cli->output();
         }
         $package = eZPackage::create($commandItem['name'], array('summary' => $commandItem['summary']), false, $repositoryID);
         $user = eZUser::currentUser();
         $userObject = $user->attribute('contentobject');
         $commandItem['licence'] = 'GPL';
         if (!in_array($commandItem['installtype'], array('install', 'import'))) {
             $commandItem['installtype'] = 'install';
         }
         if (!$commandItem['version']) {
             $commandItem['version'] = '1.0';
         }
         $package->setRelease($commandItem['version'], '1', false, $commandItem['licence'], 'alpha');
         $package->setAttribute('install_type', $commandItem['installtype']);
         if ($userObject) {
             $package->appendMaintainer($userObject->attribute('name'), $user->attribute('email'), 'lead');
         }
         eZPackageCreationHandler::appendLicence($package);
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:ezpm.php


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