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


PHP modPackageBuilder::putVehicle方法代码示例

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


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

示例1: array

$category->addMany($snippets);
/* add chunks */
$chunks = (include $sources['data'] . 'transport.chunks.php');
if (is_array($chunks)) {
    $category->addMany($chunks);
} else {
    $modx->log(modX::LOG_LEVEL_ERROR, 'Adding chunks failed.');
}
/* create category vehicle */
$attr = array(xPDOTransport::UNIQUE_KEY => 'category', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('Snippets' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name'), 'Chunks' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name')));
$vehicle = $builder->createVehicle($category, $attr);
//-- Add file resolvers to get actual files added to the category
$modx->log(modX::LOG_LEVEL_INFO, 'Adding file resolvers to category...');
$vehicle->resolve('file', array('source' => $sources['source_assets'], 'target' => "return MODX_ASSETS_PATH . 'components/';"));
$vehicle->resolve('file', array('source' => $sources['source_core'], 'target' => "return MODX_CORE_PATH . 'components/';"));
$builder->putVehicle($vehicle);
/* Settings */
$settings = (include $sources['data'] . 'transport.settings.php');
if (!is_array($settings)) {
    $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
} 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...');
开发者ID:jpdevries,项目名称:mxCalendar,代码行数:31,代码来源:build.transport.php

示例2: modPackageBuilder

define('PKG_RELEASE', VirtuNewsletter::RELEASE);
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/');
/**
 * MENU & ACTION
 */
$menu = (include $sources['data'] . 'transport.menu.php');
if (empty($menu)) {
    $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in menu.');
} else {
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaging in menu...');
    $menuVehicle = $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 Menu & Action done.');
    $builder->putVehicle($menuVehicle);
    unset($menuVehicle, $menu);
}
/**
 * SYSTEM SETTINGS
 */
$settings = (include $sources['data'] . 'transport.settings.php');
if (!is_array($settings)) {
    $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
} else {
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaging in System Settings...');
    $settingAttributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false);
    foreach ($settings as $setting) {
        $settingVehicle = $builder->createVehicle($setting, $settingAttributes);
        $builder->putVehicle($settingVehicle);
    }
开发者ID:ksneo,项目名称:virtuNewsletter,代码行数:31,代码来源:build.transport.php

示例3: array

$modx->log(MODX_LOG_LEVEL_INFO, 'Creating a new package: ' . $_PACKAGE['name'] . '-' . $_PACKAGE['version'] . '-' . $_PACKAGE['release']);
$builder->createPackage($_PACKAGE['name'], $_PACKAGE['version'], $_PACKAGE['release']);
$builder->registerNamespace($_PACKAGE['namespace'], $_PACKAGE['autoselects']);
/* define some locations for file resources */
$sources = array('root' => dirname(dirname(__FILE__)) . '/', 'assets' => dirname(dirname(__FILE__)) . '/assets/');
/* set up some default attributes that define install behavior */
$attributes = array(xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RESOLVE_FILES => true, xPDOTransport::RESOLVE_PHP => true);
$modx->log(modX::LOG_LEVEL_INFO, 'Loading vehicles into package.');
foreach ($_PACKAGE['vehicles'] as $vehicle) {
    $c = $modx->getObject($vehicle['class_key'], $vehicle['object']);
    if ($c == null) {
        continue;
    }
    if (!isset($vehicle['attributes'])) {
        $vehicle['attributes'] = array();
    }
    $attr = array_merge($attributes, $vehicle['attributes']);
    $v = $builder->createVehicle($c, $attr);
    if (isset($vehicle['resolvers']) && !empty($vehicle['resolvers'])) {
        foreach ($vehicle['resolvers'] as $resolver) {
            $v->resolve($resolver['type'], $resolver);
        }
    }
    $builder->putVehicle($v);
}
/* zip up the package */
$modx->log(modX::LOG_LEVEL_INFO, 'Attempting to pack package.');
$builder->pack();
$filename = $modx->getOption('core_path') . 'packages/' . $_PACKAGE['name'] . '-' . $_PACKAGE['version'] . '-' . $_PACKAGE['release'] . '.transport.zip';
$modx->log(modX::LOG_LEVEL_WARN, $modx->lexicon('package_built') . ' - ' . $filename);
return $modx->error->success($modx->lexicon('package_built') . ' - ' . $filename);
开发者ID:JoeBlow,项目名称:revolution,代码行数:31,代码来源:build.php

示例4: putVehicle

 public function putVehicle(GitPackageVehicle $vehicle)
 {
     $this->builder->putVehicle($vehicle->getVehicle());
 }
开发者ID:hansek,项目名称:Git-Package-Management,代码行数:4,代码来源:gitpackagebuilder.class.php

示例5: 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

示例6: plugins

    }
    $modx->log(modX::LOG_LEVEL_INFO, 'Packed plugins(s) ' . count($plugins) . ' into category.');
} else {
    $modx->log(modX::LOG_LEVEL_INFO, 'No plugins(s) to pack...');
}
if (file_exists($sources['data'] . 'transport.snippets.php')) {
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaging in snippet(s) into category...');
    $snippets = (include $sources['data'] . 'transport.snippets.php');
    foreach ($snippets as $snippet) {
        $category->addMany($snippet);
    }
    $modx->log(modX::LOG_LEVEL_INFO, 'Packed snippet(s) ' . count($snippets) . ' into category.');
} else {
    $modx->log(modX::LOG_LEVEL_INFO, 'No snippet(s) to pack...');
}
$builder->putVehicle($builder->createVehicle($category, array(xPDOTransport::UNIQUE_KEY => 'category', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('Chunks' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name'), 'Plugins' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name'), 'PluginEvents' => array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false, xPDOTransport::UNIQUE_KEY => array('pluginid', 'event')), 'Snippets' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name')))));
if (file_exists($sources['data'] . 'transport.settings.php')) {
    $settings = (include $sources['data'] . 'transport.settings.php');
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaging in systemsetting(s) into category...');
    foreach ($settings as $key => $value) {
        $builder->putVehicle($builder->createVehicle($value, array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false)));
    }
    $modx->log(modX::LOG_LEVEL_INFO, 'Packed systemsetting(s) ' . count($settings) . ' into category.');
} else {
    $modx->log(modX::LOG_LEVEL_INFO, 'No systemsetting(s) to pack...');
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packed category.');
if (file_exists($sources['data'] . 'transport.menu.php')) {
    $menu = (include $sources['data'] . 'transport.menu.php');
    $modx->log(modX::LOG_LEVEL_INFO, 'Packaging in menu...');
    if (null === $menu) {
开发者ID:Oetzie,项目名称:TinyMCE,代码行数:31,代码来源:build.transport.php


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