Exemplo n.º 1
0
$directory = $root . '_packages/';
//$directory = __DIR__ . '/../../../core/packages/'; // local place
$filename = $directory . $signature . '.transport.zip';
if (file_exists($filename)) {
    unlink($filename);
}
if (file_exists($directory . $signature) && is_dir($directory . $signature)) {
    $cacheManager = $xpdo->getCacheManager();
    if ($cacheManager) {
        $cacheManager->deleteTree($directory . $signature, true, false, []);
    }
}
$package = new xPDOTransport($xpdo, $signature, $directory);
$namespace = new modNamespace($xpdo);
$namespace->fromArray(['id' => PKG_NAME_LOWER, 'name' => PKG_NAME_LOWER, 'path' => '{core_path}components/' . PKG_NAME_LOWER . '/']);
$package->put($namespace, [xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RESOLVE_FILES => true, xPDOTransport::RESOLVE_PHP => true, xPDOTransport::NATIVE_KEY => PKG_NAME_LOWER, 'namespace' => PKG_NAME_LOWER, 'package' => 'modx', 'resolve' => null, 'validate' => null]);
$settings = (include $sources['data'] . 'transport.settings.php');
foreach ($settings as $setting) {
    $package->put($setting, [xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true, 'class' => 'modSystemSetting', 'resolve' => null, 'validate' => null, 'package' => 'modx']);
}
$validators = [];
array_push($validators, ['type' => 'php', 'source' => $sources['validators'] . 'validate.phpversion.php']);
$resolvers = [];
foreach ($sources['core'] as $file) {
    $directory = dirname($file);
    array_push($resolvers, ['type' => 'file', 'source' => $root . 'core/' . $file, 'target' => "return MODX_CORE_PATH . '{$directory}/';"]);
}
array_push($resolvers, ['type' => 'php', 'source' => $sources['resolvers'] . 'resolve.extension.php'], ['type' => 'php', 'source' => $sources['resolvers'] . 'resolve.settings.php']);
$category = new modCategory($xpdo);
$category->fromArray(['id' => 1, 'category' => PKG_NAME, 'parent' => 0]);
$plugins = (include $sources['data'] . 'transport.plugins.php');
Exemplo n.º 2
0
}
/* create core transport package */
$package = new xPDOTransport($xpdo, 'core', $packageDirectory);
unset($packageDirectory);
$xpdo->setPackage('modx', MODX_CORE_PATH . 'model/');
$xpdo->loadClass('modAccess');
$xpdo->loadClass('modAccessibleObject');
$xpdo->loadClass('modAccessibleSimpleObject');
$xpdo->loadClass('modPrincipal');
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Core transport package created.');
flush();
/* core namespace */
$namespace = $xpdo->newObject('modNamespace');
$namespace->set('name', 'core');
$namespace->set('path', '{core_path}');
$package->put($namespace, array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true));
unset($namespace);
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Core Namespace packaged.');
flush();
/* modWorkspace */
$collection = array();
$collection['1'] = $xpdo->newObject('modWorkspace');
$collection['1']->fromArray(array('id' => 1, 'name' => 'Default MODx workspace', 'active' => 1), '', true, true);
$attributes = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false);
foreach ($collection as $c) {
    $package->put($c, $attributes);
}
unset($collection, $c, $attributes);
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Default workspace packaged.');
flush();
/* modxcms.com extras provisioner */
Exemplo n.º 3
0
/* create core transport package */
$package = new xPDOTransport($xpdo, 'core', $packageDirectory);
unset($packageDirectory);
$xpdo->setPackage('modx', MODX_CORE_PATH . 'model/');
$xpdo->loadClass('modAccess');
$xpdo->loadClass('modAccessibleObject');
$xpdo->loadClass('modAccessibleSimpleObject');
$xpdo->loadClass('modPrincipal');
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Core transport package created.');
flush();
/* core namespace */
$namespace = $xpdo->newObject('modNamespace');
$namespace->set('name', 'core');
$namespace->set('path', '{core_path}');
$namespace->set('assets_path', '{assets_path}');
$package->put($namespace, array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true));
unset($namespace);
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Core Namespace packaged.');
flush();
/* modWorkspace */
$collection = array();
$collection['1'] = $xpdo->newObject('modWorkspace');
$collection['1']->fromArray(array('id' => 1, 'name' => 'Default MODX workspace', 'path' => '{core_path}', 'active' => 1), '', true, true);
$attributes = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false);
foreach ($collection as $c) {
    $package->put($c, $attributes);
}
unset($collection, $c, $attributes);
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Default workspace packaged.');
flush();
/* modx.com extras provisioner */
Exemplo n.º 4
0
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'validators' => $root . '_build/validators/', '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/', '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);
$modx->loadClass('transport.xPDOTransport', XPDO_CORE_PATH, true, true);
/** @var xPDOTransport $package */
$package = new xPDOTransport($modx, PKG_NAME_LOWER, $targetDirectory);
$package->signature = PKG_NAME_LOWER . '-' . PKG_VERSION . '-' . PKG_RELEASE;
$modx->log(xPDO::LOG_LEVEL_INFO, 'Creating transport package for ' . PKG_NAME);
flush();
/* include namespace */
$namespace = $modx->newObject('modNamespace');
$namespace->set('name', PKG_NAME_LOWER);
$namespace->set('path', '{core_path}components/' . PKG_NAME_LOWER . '/');
$namespace->set('assets_path', '{assets_path}components/' . PKG_NAME_LOWER . '/');
$attributes = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true);
$package->put($namespace, $attributes);
$modx->log(xPDO::LOG_LEVEL_INFO, 'Added namespace ' . PKG_NAME_LOWER);
flush();
/** @var array $attributes */
$attributes = array('vehicle_class' => 'xPDOFileVehicle');
$files = array();
$files[] = array('source' => $sources['source_core'], 'target' => "return MODX_CORE_PATH . 'components/';");
/*$files[] = array(
    'source' => $sources['source_assets'],
    'target' => "return MODX_ASSETS_PATH . 'components/';",
);*/
foreach ($files as $fileset) {
    $package->put($fileset, $attributes);
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Added ' . count($files) . ' file locations.');
flush();