Skip to content

Instantly share code, notes, and snippets.

@alanpich
Last active December 1, 2016 15:48
Show Gist options
  • Save alanpich/5759560 to your computer and use it in GitHub Desktop.
Save alanpich/5759560 to your computer and use it in GitHub Desktop.
Rough outline of installing transport packages via the CLI
<?php
$path_to_modx = '/var/www/modx';
define('MODX_API_MODE',true);
require $path_to_modx."/index.php";
/** @var \modX $modx */
// Download Details
/** @var string $package_url - URL from the orange 'Download' button on the MODx Extras website */
$package_url = 'http://modx.com/extras/download/?id=512403a2f245547611000025'
$package_signature = 'getresources-1.6.0-pl'
// Download the package
$modx->runProcessor('workspace/packages/rest/download',array(
'info' => $package_url.'::'.$package_signature
));
// Create modTransportPackage object in new modx install
$scan = $modx->runProcessor('workspace/packages/scanlocal');
// Run install command
$response = $modx->runProcessor('workspace/packages/install',array(
'signature' => $package_signature
));
@carnevlu
Copy link

Hi @alanpich, thx for that snippet of code, it was useful ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment