-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from jackalope/adjust-console-bootstrap-symfo…
…ny-3 adjust console init to symfony 3 and general cleanup
- Loading branch information
Showing
10 changed files
with
99 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.