PHPCR, eksport węzła

Przykładowy skrypty PHP (PHPCR - Jackalope Jackrabbit) do eksportu wybranego węzła z repozytorium JCR (Adobe AEM)

Eksport wybranego węzła:

<?php
date_default_timezone_set('Europe/Warsaw');

require("/phpcr/jackalope-jackrabbit/vendor/autoload.php");

$factoryclass = '\Jackalope\RepositoryFactoryJackrabbit';
$parameters = array('jackalope.jackrabbit_uri' = 'http://localhost:4502/crx/server');

$factory = new $factoryclass();
$repository = $factory->getRepository($parameters);
$credentials = new \PHPCR\SimpleCredentials('admin','admin');
$session = $repository->login($credentials, 'crx.default');
$workspace = $session->getWorkspace();

// export data from path

$file = fopen('export.xml', 'w+');
$session->exportSystemView(
    '/etc/commerce',
    $file,
    false, // do not skip binary properties
    false
);

fclose($file);