本文整理汇总了PHP中modPackageBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP modPackageBuilder类的具体用法?PHP modPackageBuilder怎么用?PHP modPackageBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了modPackageBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
// Prevent global PHP settings from interrupting
set_time_limit(0);
echo 'Creating Package...';
// fire up MODX
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modx();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
echo '<pre>';
flush();
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/');
//------------------------------------------------------------------------------
//! Categories
//------------------------------------------------------------------------------
$cat_attributes = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false, xPDOTransport::UNIQUE_KEY => array('category'), 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'), 'Plugins' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('PluginEvents' => array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false, xPDOTransport::UNIQUE_KEY => array('pluginid', 'event'))))));
$Category = $modx->newObject('modCategory');
$Category->set('category', PKG_NAME);
$vehicle = $builder->createVehicle($Category, $cat_attributes);
$builder->putVehicle($vehicle);
//------------------------------------------------------------------------------
//! Snippets
//------------------------------------------------------------------------------
// Not used: see $cat_attributes
$attributes = array(xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => $cat_attributes);
示例2: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'chunks' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/chunks/', 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/', 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'pages' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/pages/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->getService('error', 'error.modError');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, PKG_NAMESPACE_PATH);
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
/* load system settings */
if (defined('BUILD_SETTING_UPDATE')) {
$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 => BUILD_SETTING_UPDATE);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
示例3: dirname
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
print '<pre>';
require_once dirname(__FILE__) . '/build.config.php';
/*
* Set log Params
*/
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
echo '<pre>';
flush();
/*
* Create Builder
*/
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
/*
* Create Package
*/
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/');
/*
* Load lexicon
*/
# include_once $sources['builder_includes'] . 'lexicon.php';
/*
* Add Namespace
*/
include_once $sources['builder_includes'] . 'namespace.php';
/*
* Add mediasources
示例4: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'resolvers' => $root . '_build/resolvers/', 'validators' => $root . '_build/validators/', 'data' => $root . '_build/data/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'install_options' => $root . '_build/install.options/', 'packages' => $root . 'core/packages');
unset($root);
/* Instantiate MODx -- if this require fails, check your
* _build/build.config.php file
*/
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* load builder */
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_CATEGORY, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/');
/* Transport Resources */
if ($hasResources) {
$resources = (include $sources['data'] . 'transport.resources.php');
if (!is_array($resources)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in resources.');
} else {
$attributes = array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'pagetitle', xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('ContentType' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name')));
foreach ($resources as $resource) {
$vehicle = $builder->createVehicle($resource, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($resources) . ' resources.');
}
示例5: microtime
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
set_time_limit(0);
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'elements' => $root . 'core/components/debugtoolbar/elements/', 'data' => $root . '_build/data/', 'source_core' => $root . 'core/components/debugtoolbar', 'source_assets' => $root . 'assets/components/debugtoolbar');
unset($root);
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage('debugtoolbar', '0.1', 'alpha');
$builder->registerNamespace('debugtoolbar', false, true, '{core_path}components/debugtoolbar/');
$settings = (include $sources['data'] . 'transport.settings.php');
$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);
}
unset($settings, $setting, $attributes);
$category = $modx->newObject('modCategory');
$category->set('category', 'DebugToolbar');
$plugins = (include $sources['data'] . 'transport.plugins.php');
if (!is_array($plugins)) {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding plugins failed.');
}
示例6: dirname
require_once dirname(__FILE__) . '/build.config.php';
/* define sources */
$root = MODX_ADDON_PATH;
$build = MODX_ADDON_PATH . '_build/';
$sources = array('root' => $root, 'build' => $build, 'data' => $build . 'data/', 'resolvers' => $build . 'resolvers/', 'chunks' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/chunks/', 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/', 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'pages' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/pages/', 'templates' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/templates/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 'model' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/');
unset($root);
unset($build);
/* override with your own defines here (see build.config.sample.php) */
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$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 . '/', '{assets_path}components/' . PKG_NAME_LOWER . '/');
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
// Create category
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', PKG_NAME);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in "' . PKG_NAME . '" category.');
flush();
// Add Elements to Category
foreach (array('Snippets', 'Chunks', 'TemplateVars', 'Plugins') as $mycat) {
$c_file = $sources['data'] . 'transport.' . strtolower($mycat) . '.php';
if (file_exists($c_file)) {
$cat_element = (include $c_file);
if (is_array($cat_element)) {
示例7: realpath
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modxDatabase = $modx->getOption('dbname', $options, $modx->getOption('database', $options));
$modxTablePrefix = $modx->getOption('table_prefix', $options, '');
$core_path = realpath($modx->getOption('core_path', $options, MODX_CORE_PATH)) . '/';
$assets_path = realpath($modx->getOption('assets_path', $options, MODX_ASSETS_PATH)) . '/';
$manager_path = realpath($modx->getOption('manager_path', $options, MODX_MANAGER_PATH)) . '/';
$base_path = realpath($modx->getOption('base_path', $options, MODX_BASE_PATH)) . '/';
$modx->log(modX::LOG_LEVEL_INFO, "core_path=" . $core_path);
$modx->log(modX::LOG_LEVEL_INFO, "assets_path=" . $assets_path);
$modx->log(modX::LOG_LEVEL_INFO, "manager_path=" . $manager_path);
$modx->log(modX::LOG_LEVEL_INFO, "base_path=" . $base_path);
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
/** @var modWorkspace $workspace */
$workspace = $modx->getObject('modWorkspace', 1);
if (!$workspace) {
$modx->log(modX::LOG_LEVEL_FATAL, "no workspace!");
}
if (!defined('PKG_NAME')) {
define('PKG_NAME', $modx->getOption('http_host', $options, 'cloud_import'));
}
define('PKG_VERSION', strftime("%y%m%d.%H%M.%S", $startTime));
define('PKG_RELEASE', $modxVersion);
$package = $builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
/* Defines the classes to extract (also used for truncation) */
$classes = array('modAccessAction', 'modAccessActionDom', 'modAccessCategory', 'modAccessContext', 'modAccessElement', 'modAccessMenu', 'modAccessPermission', 'modAccessPolicy', 'modAccessPolicyTemplate', 'modAccessPolicyTemplateGroup', 'modAccessResource', 'modAccessResourceGroup', 'modAccessTemplateVar', 'modAction', 'modActionDom', 'modActionField', 'modActiveUser', 'modCategory', 'modCategoryClosure', 'modChunk', 'modClassMap', 'modContentType', 'modContext', 'modContextResource', 'modContextSetting', 'modElementPropertySet', 'modEvent', 'modFormCustomizationProfile', 'modFormCustomizationProfileUserGroup', 'modFormCustomizationSet', 'modLexiconEntry', 'modManagerLog', 'modMenu', 'modNamespace', 'modPlugin', 'modPluginEvent', 'modPropertySet', 'modResource', 'modResourceGroup', 'modResourceGroupResource', 'modSession', 'modSnippet', 'modSystemSetting', 'modTemplate', 'modTemplateVar', 'modTemplateVarResource', 'modTemplateVarResourceGroup', 'modTemplateVarTemplate', 'modUser', 'modUserProfile', 'modUserGroup', 'modUserGroupMember', 'modUserGroupRole', 'modUserMessage', 'modUserSetting', 'modWorkspace', 'registry.db.modDbRegisterMessage', 'registry.db.modDbRegisterTopic', 'registry.db.modDbRegisterQueue', 'transport.modTransportProvider', 'transport.modTransportPackage');
if (version_compare($modxVersion, '2.2.0', '>=')) {
array_push($classes, 'modDashboard', 'modDashboardWidget', 'modDashboardWidgetPlacement', 'sources.modAccessMediaSource', 'sources.modMediaSource', 'sources.modMediaSourceElement', 'sources.modMediaSourceContext');
示例8: set_time_limit
set_time_limit(0);
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setDebug(false);
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
echo '<pre>';
$modx->setLogTarget('ECHO');
error_reporting(E_ALL);
ini_set('display_errors', true);
$name = 'provisioner';
$version = '1.1.0';
$release = 'pl';
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage($name, $version, $release);
$builder->registerNamespace('provisioner', false, true, '{core_path}components/provisioner/');
$base = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $base, 'assets' => $base . 'assets/components/provisioner/', 'docs' => $base . 'assets/components/provisioner/docs/', 'core' => $base . 'core/components/provisioner/', 'lexicon' => $base . 'core/components/provisioner/lexicon/', 'model' => $base . 'core/components/provisioner/model/', 'templates' => $base . 'core/components/provisioner/templates/', 'build' => $base . '_build/', 'data' => $base . '_build/data/', 'resolvers' => $base . '_build/resolvers/', 'source_core' => $base . 'core/components/provisioner', 'source_assets' => $base . 'assets/components/provisioner');
unset($base);
$vehicles = array();
/* ACTIONS */
$menu = (require_once $sources['data'] . 'actions.data.php');
if (!$menu) {
$modx->log(xPDO::LOG_LEVEL_FATAL, 'Menu not found!');
}
$attr = 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'))));
$vehicle = $builder->createVehicle($menu, $attr);
$vehicles[] = $vehicle;
/* SETTINGS */
示例9: explode
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
set_time_limit(0);
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'lexicon' => $root . '_build/lexicon/', 'resolvers' => $root . '_build/resolvers/', 'data' => $root . '_build/data/', 'source_core' => $root . 'core/components/xflickr', 'source_assets' => $root . 'assets/components/xflickr', 'docs' => $root . 'core/components/xflickr/docs/');
unset($root);
/* override with your own defines here (see build.config.sample.php) */
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(MODX_LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage('xflickr', '0.1', 'alpha1');
$builder->registerNamespace('xflickr', false, true, '{core_path}components/xflickr/');
/* load action/menu */
$menu = (include $sources['data'] . 'transport.menu.php');
$vehicle = $builder->createVehicle($menu, array(XPDO_TRANSPORT_PRESERVE_KEYS => true, XPDO_TRANSPORT_UPDATE_OBJECT => true, XPDO_TRANSPORT_UNIQUE_KEY => 'text', XPDO_TRANSPORT_RELATED_OBJECTS => true, XPDO_TRANSPORT_RELATED_OBJECT_ATTRIBUTES => array('Action' => array(XPDO_TRANSPORT_PRESERVE_KEYS => false, XPDO_TRANSPORT_UPDATE_OBJECT => true, XPDO_TRANSPORT_UNIQUE_KEY => array('namespace', 'controller')))));
$builder->putVehicle($vehicle);
unset($vehicle, $action);
/* load system settings */
$settings = array();
include_once $sources['data'] . 'transport.settings.php';
$attributes = array(XPDO_TRANSPORT_UNIQUE_KEY => 'key', XPDO_TRANSPORT_PRESERVE_KEYS => true, XPDO_TRANSPORT_UPDATE_OBJECT => false);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
示例10: define
define('PKG_VERSION', '4.1.2');
define('PKG_RELEASE', 'rc1');
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'resolvers' => $root . '_build/resolvers/', 'data' => $root . '_build/data/', 'docs' => $root . 'core/components/' . PKG_NAMESPACE . '/docs/', 'lexicon' => $root . 'core/components/' . PKG_NAMESPACE . '/lexicon/', 'source_assets' => $root . 'assets/components/' . PKG_NAMESPACE, 'source_core' => $root . 'core/components/' . PKG_NAMESPACE);
/* load modx */
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
echo XPDO_CLI_MODE ? '' : '<pre>';
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAMESPACE, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAMESPACE, false, true, '{core_path}components/' . PKG_NAMESPACE . '/');
/* create the plugin object */
$plugin = $modx->newObject('modPlugin');
$plugin->set('id', 1);
$plugin->set('name', PKG_NAME);
$plugin->set('description', PKG_NAME . ' ' . PKG_VERSION . '-' . PKG_RELEASE . ' plugin for MODx Revolution');
$plugin->set('plugincode', getSnippetContent($sources['source_core'] . '/tinymce.plugin.php'));
$plugin->set('category', 0);
/* add plugin events */
$events = (include $sources['data'] . 'transport.plugin.events.php');
if (is_array($events) && !empty($events)) {
$plugin->addMany($events);
$modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events.');
flush();
示例11: define
/* Definire i nomi */
define('PKG_NAME', 'HTML-Library');
define('PKG_NAME_LOWER', 'html-library');
define('PKG_VERSION', '1.0');
define('PKG_RELEASE', 'beta');
/* Definire i percorsi */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'chunks' => $root . 'core/components/' . PKG_NAME_LOWER . '/chunks/', 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'elements' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
/* override with your own defines here (see build.config.sample.php) */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
echo '<pre>';
/* used for nice formatting of log messages */
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$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 . '/');
/* Comprimere il 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");
session_write_close();
exit;
示例12: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'properties' => $root . '_build/properties/', 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->getService('error', 'error.modError');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, PKG_NAMESPACE_PATH);
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
/* create snippet object */
$snippet = $modx->newObject('modSnippet');
$snippet->fromArray(array('name' => PKG_NAME, 'description' => 'Markdown for MODX Revolution', 'category' => 0, 'snippet' => file_get_contents($sources['source_core'] . '/elements/snippets/snippet.' . PKG_NAME_LOWER . '.php'), 'source' => 1, 'static' => 0, 'static_file' => 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/snippet.' . PKG_NAME_LOWER . '.php'));
$properties = (include $sources['properties'] . 'properties.' . PKG_NAME_LOWER . '.php');
$snippet->setProperties($properties);
/* package in snippet */
$attributes = array(xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true);
$vehicle = $builder->createVehicle($snippet, $attributes);
$vehicle->resolve('file', array('source' => $sources['source_core'], 'target' => "return MODX_CORE_PATH . 'components/';"));
$builder->putVehicle($vehicle);
unset($properties, $snippet, $vehicle);
/* now pack in the license file, readme and setup options */
示例13: define
define('MODX_ASSETS_URL', '');
define('MODX_CONNECTORS_URL', '');
/* instantiate MODx */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* set package info */
define('PKG_NAME', 'Personalize');
define('PKG_VERSION', '3.7.0');
define('PKG_RELEASE', 'pl');
/* load builder */
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('personalize', false, true, '{core_path}components/personalize/');
/* create snippet objects */
/* create category */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', 'personalize');
/* add snippets */
$modx->log(modX::LOG_LEVEL_INFO, 'Adding in snippets.');
$snippets = (include $sources['data'] . 'transport.snippets.php');
if (is_array($snippets)) {
$category->addMany($snippets);
} else {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding snippets failed.');
}
示例14: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'pages' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/pages/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->getService('error', 'error.modError');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
//$builder->registerNamespace(PKG_NAME_LOWER, false, true, PKG_NAMESPACE_PATH);
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
$attr = array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name');
$snippet = $modx->newObject('modSnippet');
$snippet->fromArray(array('name' => "extLinkRedirector", 'description' => '', 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.extlinkredirector.php')), '', true, true);
$vehicle = $builder->createVehicle($snippet, $attr);
flush();
$builder->putVehicle($vehicle);
/* create the plugin object */
$plugin = $modx->newObject('modPlugin');
$plugin->set('id', 1);
$plugin->set('name', 'extLinkRedirector');
$plugin->set('description', 'External Link Redirector plugin');
$plugin->set('plugincode', getSnippetContent($sources['source_core'] . '/elements/plugins/plugin.extlinkredirector.php'));
示例15: set_time_limit
$tstart = $mtime;
/* get rid of time limit */
set_time_limit(0);
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'docs' => $root . 'core/components/wayfinder/docs/', 'source_core' => $root . 'core/components/wayfinder');
/* override with your own defines here (see build.config.sample.php) */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
echo '<pre>';
/* used for nice formatting of log messages */
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage('wayfinder', '2.1.1', 'rc1');
$builder->registerNamespace('wayfinder', false, true, '{core_path}components/wayfinder/');
/* get the source from the actual snippet in your database
* [alternative] you could also manually create the object, grabbing the source
* from a file
*/
$c = $modx->newObject('modSnippet');
$c->set('id', 1);
$c->set('name', 'Wayfinder');
$c->set('description', 'Wayfinder for MODx Revolution 2.0.0-beta-5 and later.');
$c->set('snippet', file_get_contents($sources['source_core'] . '/wayfinder.snippet.php'));
$c->set('category', 0);
$properties = (include $sources['data'] . 'properties.inc.php');
$c->setProperties($properties, true);
$attributes = array(xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true);