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


PHP modPackageBuilder::pack方法代码示例

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


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

示例1: pack

 public function pack()
 {
     $this->builder->pack();
     if ($this->modx->gitpackagemanagement->getOption('remove_extracted_package')) {
         $this->modx->gitpackagemanagement->deleteDir($this->builder->directory . $this->builder->signature . '/');
     }
 }
开发者ID:hansek,项目名称:Git-Package-Management,代码行数:7,代码来源:gitpackagebuilder.class.php

示例2: array

} else {
    $attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false);
    foreach ($settings as $setting) {
        $vehicle = $builder->createVehicle($setting, $attributes);
        $builder->putVehicle($vehicle);
    }
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
}
unset($settings, $setting, $attributes);
//-- ADD IN THE CONTEXT MENU ITEMS
$modx->log(modX::LOG_LEVEL_INFO, 'Packaging in menu...');
$menu = (include $sources['data'] . 'transport.menu.php');
if (empty($menu)) {
    $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in menu.');
}
$vehicle = $builder->createVehicle($menu, array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'text', xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('Action' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => array('namespace', 'controller')))));
$modx->log(modX::LOG_LEVEL_INFO, 'Adding in PHP resolvers...');
$vehicle->resolve('php', array('source' => $sources['resolvers'] . 'resolve.tables.php'));
$builder->putVehicle($vehicle);
unset($vehicle, $menu);
//-- ADD DOCS (changelog, license) TO THE PACKAGE
$modx->log(modX::LOG_LEVEL_INFO, 'Adding package attributes and setup options...');
$builder->setPackageAttributes(array('license' => file_get_contents($sources['docs'] . 'license.txt'), 'readme' => file_get_contents($sources['docs'] . 'readme.txt'), 'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'), 'setup-options' => array('source' => $sources['build'] . 'setup.options.php')));
/* zip up package */
$modx->log(modX::LOG_LEVEL_INFO, 'Packing up transport package zip...');
$builder->pack();
$tend = explode(" ", microtime());
$tend = $tend[1] + $tend[0];
$totalTime = sprintf("%2.4f s", $tend - $tstart);
$modx->log(modX::LOG_LEVEL_INFO, "\n<br />Package Built.<br />\nExecution time: {$totalTime}\n");
exit;
开发者ID:jpdevries,项目名称:mxCalendar,代码行数:31,代码来源:build.transport.php

示例3: array

    $modx->log(modX::LOG_LEVEL_ERROR, 'No settings defined.');
} else {
    $attr = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => TRUE, xPDOTransport::UPDATE_OBJECT => FALSE);
    foreach ($settings as $setting) {
        $vehicle = $builder->createVehicle($setting, $attr);
        $builder->putVehicle($vehicle);
    }
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
}
unset($settings, $setting, $attr);
/* now pack in the license file, readme and changelog */
$modx->log(modX::LOG_LEVEL_INFO, 'Added package attributes and setup options.');
$builder->setPackageAttributes(array('license' => file_get_contents($sources['docs'] . 'license.txt'), 'readme' => file_get_contents($sources['docs'] . 'readme.txt'), 'changelog' => file_get_contents($sources['docs'] . 'changelog.txt')));
/* zip up package */
$modx->log(modX::LOG_LEVEL_INFO, 'Packing up transport package zip ...');
$built = $builder->pack();
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
$totalTime = $tend - $tstart;
$totalTime = sprintf("%2.4f s", $totalTime);
if ($built) {
    $modx->log(modX::LOG_LEVEL_INFO, "\n<br />Package Built.<br />\nExecution time: {$totalTime}\n");
    ob_end_clean();
    $filename = $builder->filename;
    $directory = $builder->directory;
    header('Pragma: no-cache');
    header('Expires: 0');
    header('Content-type: application/zip');
    header('Content-Disposition: attachment; filename=' . $filename);
开发者ID:vgrish,项目名称:AjaxUpload,代码行数:31,代码来源:build.transport.php

示例4: build

 /**
  * Unified build script: build a MODX transport package from files contained
  * inside $pkg_root_dir
  *
  * @param string $pkg_root_dir path to local package root (w trailing slash)
  *
  * @throws Exception
  */
 public function build($pkg_root_dir)
 {
     $pkg_root_dir = self::get_dir($pkg_root_dir);
     $this->build_prep($pkg_root_dir);
     $this->config['is_build'] = true;
     // TODO
     $this->config['force_static'] = false;
     // TODO
     $required = array('package_name', 'namespace', 'version', 'release');
     foreach ($required as $k) {
         if (!$this->get($k)) {
             throw new Exception('Missing required configuration parameter: ' . $k);
         }
     }
     $this->modx->log(modX::LOG_LEVEL_INFO, 'Beginning build of package "' . $this->get('package_name') . '"');
     $this->modx->loadClass('transport.modPackageBuilder', '', false, true);
     $builder = new modPackageBuilder($this->modx);
     $sanitized_package_name = $this->get('package_name');
     $builder->createPackage($sanitized_package_name, $this->get('version'), $this->get('release'));
     $builder->registerNamespace($this->get('namespace'), false, true, '{core_path}components/' . $this->get('namespace') . '/');
     // Tests (Validators): this is run BEFORE your package code is in place
     // so you cannot reference/include package files from your validator! They won't exist when the code is run.
     $validator_file = $this->get_core_path($pkg_root_dir) . rtrim($this->get('validators_dir'), '/') . '/install.php';
     if (file_exists($validator_file)) {
         $this->modx->log(modX::LOG_LEVEL_INFO, 'Packaging validator ' . $validator_file);
         $config = $this->config;
         $config['source'] = $validator_file;
         $validator_attributes = array('vehicle_class' => 'xPDOScriptVehicle', 'source' => $validator_file, xPDOTransport::ABORT_INSTALL_ON_VEHICLE_FAIL => $this->get('abort_install_on_fail'));
         $vehicle = $builder->createVehicle($config, $validator_attributes);
         $builder->putVehicle($vehicle);
     } else {
         $this->modx->log(modX::LOG_LEVEL_DEBUG, 'No validator detected at ' . $validator_file);
     }
     $Category = $this->modx->newObject('modCategory');
     $Category->set('category', $this->get('category'));
     // Import Elements
     $chunks = self::_get_elements('modChunk', $pkg_root_dir);
     $plugins = self::_get_elements('modPlugin', $pkg_root_dir);
     $snippets = self::_get_elements('modSnippet', $pkg_root_dir);
     $tvs = self::_get_elements('modTemplateVar', $pkg_root_dir);
     $templates = self::_get_elements('modTemplate', $pkg_root_dir);
     if ($chunks) {
         $Category->addMany($chunks);
     }
     if ($plugins) {
         $Category->addMany($plugins);
     }
     if ($snippets) {
         $Category->addMany($snippets);
     }
     if ($templates) {
         $Category->addMany($templates);
     }
     if ($tvs) {
         $Category->addMany($tvs);
     }
     // TODO: skip this if there are no elements
     //if (empty($chunks) && empty($plugins) && empty($snippets) && empty($templates) && empty($tvs)) {
     $build_attributes = array();
     $build_attributes = $this->get_build_attributes($Category, 'modCategory');
     $this->modx->log(modX::LOG_LEVEL_DEBUG, 'build_attributes for ' . $Category->_class . "\n" . print_r($build_attributes, true));
     $vehicle = $builder->createVehicle($Category, $build_attributes);
     //}
     //$builder->putVehicle($vehicle);
     // Files...: TODO: these need their own builder
     // We package these from the temporary copies inside of repoman's cache.
     // Assets
     if (file_exists($this->build_assets_path) && is_dir($this->build_assets_path)) {
         $this->modx->log(modX::LOG_LEVEL_INFO, 'Packing assets from ' . $this->build_assets_path);
         $vehicle->resolve('file', array('source' => rtrim($this->build_assets_path, '/'), 'target' => "return MODX_ASSETS_PATH . 'components/';"));
     }
     // Core
     if (file_exists($this->build_core_path) && is_dir($this->build_core_path)) {
         $this->modx->log(modX::LOG_LEVEL_INFO, 'Packing core files from ' . $this->build_core_path);
         $vehicle->resolve('file', array('source' => rtrim($this->build_core_path, '/'), 'target' => "return MODX_CORE_PATH . 'components/';"));
     }
     $builder->putVehicle($vehicle);
     // Migrations: we attach our all-purpose resolver to handle migrations
     $config = $this->config;
     $config['source'] = dirname(__FILE__) . '/resolver.php';
     $attributes = array('vehicle_class' => 'xPDOScriptVehicle');
     $vehicle = $builder->createVehicle($config, $attributes);
     $builder->putVehicle($vehicle);
     // Add Version Setting
     $repoman_version_build_attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true);
     $VersionSetting = $this->modx->newObject('modSystemSetting');
     $VersionSetting->set('key', $this->get('namespace') . '.version');
     $VersionSetting->set('value', $this->get('version'));
     $VersionSetting->set('xtype', 'textfield');
     $VersionSetting->set('namespace', $this->get('namespace'));
     $VersionSetting->set('area', $this->get('namespace') . ':default');
     $vehicle = $builder->createVehicle($VersionSetting, $repoman_version_build_attributes);
//.........这里部分代码省略.........
开发者ID:carnevlu,项目名称:repoman,代码行数:101,代码来源:repoman.class.php


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