-
Notifications
You must be signed in to change notification settings - Fork 27
/
cli-config.dist.php
56 lines (49 loc) · 1.71 KB
/
cli-config.dist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
use Jackalope\RepositoryFactoryJackrabbit;
use PHPCR\SimpleCredentials;
use PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper;
use PHPCR\Util\Console\Helper\PhpcrHelper;
use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
/**
* Bootstrapping the repository implementation for the stand-alone cli application.
*
* Copy this file to cli-config.php and adjust the configuration parts to your need.
*/
/*
* Configuration
*/
$workspace = 'default'; // phpcr workspace to use
$user = 'admin'; // jackrabbit username
$pass = 'admin'; // jackrabbit password
function bootstrapJackrabbit()
{
/*
* Additional jackrabbit configuration
*/
$jackrabbitUrl = 'http://127.0.0.1:8080/server';
// bootstrap jackrabbit
return (new RepositoryFactoryJackrabbit())->getRepository([
"jackalope.jackrabbit_uri" => $jackrabbitUrl,
]);
}
/* Only create a session if this is not about the jackrabbit server startup command */
if (!array_key_exists(1, $argv[1])) {
return;
}
if(!in_array($argv[1], ['jackalope:run:jackrabbit', 'list', 'help'], true)) {
$repository = bootstrapJackrabbit();
$credentials = new SimpleCredentials($user, $pass);
$session = $repository->login($credentials, $workspace);
$helperSet = new HelperSet(array(
'phpcr' => new PhpcrHelper($session),
'phpcr_console_dumper' => new PhpcrConsoleDumperHelper(),
));
if (class_exists(QuestionHelper::class)) {
$helperSet->set(new QuestionHelper(), 'question');
} else {
// legacy support for old Symfony versions
$helperSet->set(new DialogHelper(), 'dialog');
}
}