From 261c4de2d341da2b464123d617ffb6a9385c6dfd Mon Sep 17 00:00:00 2001 From: dantleech Date: Sun, 23 Mar 2014 10:39:37 +0100 Subject: [PATCH 1/2] Support for deactivating commands if they are not supported --- features/repository_descriptor_list.feature | 6 +- .../Console/Application/ShellApplication.php | 21 +++--- .../Shell/Console/Command/LockInfoCommand.php | 8 +- .../Shell/Console/Command/LockLockCommand.php | 6 +- .../Console/Command/LockRefreshCommand.php | 5 +- .../Console/Command/LockTokenAddCommand.php | 5 +- .../Console/Command/LockTokenListCommand.php | 5 +- .../Command/LockTokenRemoveCommand.php | 5 +- .../Console/Command/LockUnlockCommand.php | 4 +- .../Command/NodeLifecycleFollowCommand.php | 5 +- .../Command/NodeLifecycleListCommand.php | 5 +- .../Command/NodeSharedRemoveCommand.php | 7 +- .../Console/Command/NodeSharedShowCommand.php | 5 +- .../Console/Command/PhpcrShellCommand.php | 41 ++++++++++ .../RepositoryDescriptorListCommand.php | 20 ++++- .../Command/RetentionHoldAddCommand.php | 5 +- .../Command/RetentionHoldListCommand.php | 5 +- .../Command/RetentionHoldRemoveCommand.php | 5 +- .../Command/RetentionPolicyGetCommand.php | 5 +- .../Command/RetentionPolicyRemoveCommand.php | 5 +- .../Shell/Console/Helper/RepositoryHelper.php | 75 +++++++++++++++++++ 21 files changed, 214 insertions(+), 34 deletions(-) create mode 100644 src/PHPCR/Shell/Console/Command/PhpcrShellCommand.php create mode 100644 src/PHPCR/Shell/Console/Helper/RepositoryHelper.php diff --git a/features/repository_descriptor_list.feature b/features/repository_descriptor_list.feature index aafe3579..f7611f60 100644 --- a/features/repository_descriptor_list.feature +++ b/features/repository_descriptor_list.feature @@ -8,6 +8,6 @@ Feature: List Repository Descriptors And I execute the "repository:descriptor:list" command Then the command should not fail And I should see a table containing the following rows: - | Key | Value | - | jcr.repository.name | Jackrabbit | - | jcr.repository.vendor | Apache Software Foundation | + | Key | Value | Standard? | + | jcr.repository.name | Jackrabbit | yes | + | jcr.repository.vendor | Apache Software Foundation | yes | diff --git a/src/PHPCR/Shell/Console/Application/ShellApplication.php b/src/PHPCR/Shell/Console/Application/ShellApplication.php index c2209bd1..abbea9f6 100644 --- a/src/PHPCR/Shell/Console/Application/ShellApplication.php +++ b/src/PHPCR/Shell/Console/Application/ShellApplication.php @@ -95,6 +95,8 @@ use Jackalope\NotImplementedException; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Formatter\OutputFormatter; +use PHPCR\Shell\Console\Helper\RepositoryHelper; +use PHPCR\Shell\Console\Command\PhpcrShellCommand; class ShellApplication extends Application { @@ -136,6 +138,16 @@ public function init() $this->transports[$transport->getName()] = $transport;; } + $session = $this->getSession($this->sessionInput); + + $this->getHelperSet()->set(new EditorHelper($session)); + $this->getHelperSet()->set(new PhpcrConsoleDumperHelper()); + $this->getHelperSet()->set(new PhpcrHelper($session)); + $this->getHelperSet()->set(new ResultFormatterHelper()); + $this->getHelperSet()->set(new TextHelper()); + $this->getHelperSet()->set(new NodeHelper($session)); + $this->getHelperSet()->set(new RepositoryHelper($session->getRepository())); + // add new commands $this->add(new AccessControlPrivilegeListCommand()); $this->add(new RepositoryDescriptorListCommand()); @@ -239,15 +251,6 @@ public function init() ->setName('workspace-purge') ); - $this->initSession(); - - $this->getHelperSet()->set(new EditorHelper($this->session)); - $this->getHelperSet()->set(new PhpcrConsoleDumperHelper()); - $this->getHelperSet()->set(new PhpcrHelper($this->session)); - $this->getHelperSet()->set(new ResultFormatterHelper()); - $this->getHelperSet()->set(new TextHelper()); - $this->getHelperSet()->set(new NodeHelper($this->session)); - $this->initialized = true; } diff --git a/src/PHPCR/Shell/Console/Command/LockInfoCommand.php b/src/PHPCR/Shell/Console/Command/LockInfoCommand.php index f31b4c3f..28a95ad8 100644 --- a/src/PHPCR/Shell/Console/Command/LockInfoCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockInfoCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockInfoCommand extends Command +class LockInfoCommand extends PhpcrShellCommand { protected function configure() { @@ -22,7 +23,10 @@ protected function configure() This may be either of the lock on that node itself or a deep lock on a node above that node. HERE - ); + ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); + $this->dequiresDescriptor('jackalope.not_implemented.lock.get'); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockLockCommand.php b/src/PHPCR/Shell/Console/Command/LockLockCommand.php index 931d792f..ea0d741b 100644 --- a/src/PHPCR/Shell/Console/Command/LockLockCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockLockCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockLockCommand extends Command +class LockLockCommand extends PhpcrShellCommand { protected function configure() { @@ -50,7 +51,8 @@ protected function configure() It is possible to lock a node even if it is checked-in. HERE - ); + ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockRefreshCommand.php b/src/PHPCR/Shell/Console/Command/LockRefreshCommand.php index 04ca8a90..28b86cb7 100644 --- a/src/PHPCR/Shell/Console/Command/LockRefreshCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockRefreshCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockRefreshCommand extends Command +class LockRefreshCommand extends PhpcrShellCommand { protected function configure() { @@ -23,6 +24,8 @@ protected function configure() has no effect. HERE ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); + $this->dequiresDescriptor('jackalope.not_implemented.lock.refresh'); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockTokenAddCommand.php b/src/PHPCR/Shell/Console/Command/LockTokenAddCommand.php index 3b5e248b..ae189c2c 100644 --- a/src/PHPCR/Shell/Console/Command/LockTokenAddCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockTokenAddCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockTokenAddCommand extends Command +class LockTokenAddCommand extends PhpcrShellCommand { protected function configure() { @@ -22,6 +23,8 @@ protected function configure() specified by that particular lock token. HERE ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); + $this->dequiresDescriptor('jackalope.not_implemented.lock.token'); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockTokenListCommand.php b/src/PHPCR/Shell/Console/Command/LockTokenListCommand.php index d7c04720..fcee7b74 100644 --- a/src/PHPCR/Shell/Console/Command/LockTokenListCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockTokenListCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockTokenListCommand extends Command +class LockTokenListCommand extends PhpcrShellCommand { protected function configure() { @@ -22,6 +23,8 @@ protected function configure() locks, since session-scoped locks do not have tokens. HERE ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); + $this->dequiresDescriptor('jackalope.not_implemented.lock.token'); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockTokenRemoveCommand.php b/src/PHPCR/Shell/Console/Command/LockTokenRemoveCommand.php index f156205e..b20e3bbd 100644 --- a/src/PHPCR/Shell/Console/Command/LockTokenRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockTokenRemoveCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockTokenRemoveCommand extends Command +class LockTokenRemoveCommand extends PhpcrShellCommand { protected function configure() { @@ -19,6 +20,8 @@ protected function configure() Removes the specified lock token from the current Session. HERE ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); + $this->dequiresDescriptor('jackalope.not_implemented.lock.token'); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/LockUnlockCommand.php b/src/PHPCR/Shell/Console/Command/LockUnlockCommand.php index 8b8351db..c43a26a8 100644 --- a/src/PHPCR/Shell/Console/Command/LockUnlockCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockUnlockCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class LockUnlockCommand extends Command +class LockUnlockCommand extends PhpcrShellCommand { protected function configure() { @@ -35,6 +36,7 @@ protected function configure() lock-related properties will be changed despite the checked-in status). HERE ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/NodeLifecycleFollowCommand.php b/src/PHPCR/Shell/Console/Command/NodeLifecycleFollowCommand.php index 26cd5d1d..7b623711 100644 --- a/src/PHPCR/Shell/Console/Command/NodeLifecycleFollowCommand.php +++ b/src/PHPCR/Shell/Console/Command/NodeLifecycleFollowCommand.php @@ -10,8 +10,9 @@ use PHPCR\NodeType\NoSuchNodeTypeException; use PHPCR\Util\CND\Parser\CndParser; use PHPCR\NamespaceException; +use PHPCR\RepositoryInterface; -class NodeLifecycleFollowCommand extends Command +class NodeLifecycleFollowCommand extends PhpcrShellCommand { protected function configure() { @@ -30,6 +31,8 @@ protected function configure() need to call save. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_LIFECYCLE_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/NodeLifecycleListCommand.php b/src/PHPCR/Shell/Console/Command/NodeLifecycleListCommand.php index 8e88aee1..b4e79bca 100644 --- a/src/PHPCR/Shell/Console/Command/NodeLifecycleListCommand.php +++ b/src/PHPCR/Shell/Console/Command/NodeLifecycleListCommand.php @@ -10,8 +10,9 @@ use PHPCR\NodeType\NoSuchNodeTypeException; use PHPCR\Util\CND\Parser\CndParser; use PHPCR\NamespaceException; +use PHPCR\RepositoryInterface; -class NodeLifecycleListCommand extends Command +class NodeLifecycleListCommand extends PhpcrShellCommand { protected function configure() { @@ -21,6 +22,8 @@ protected function configure() Returns the list of valid state transitions for this node. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_LIFECYCLE_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/NodeSharedRemoveCommand.php b/src/PHPCR/Shell/Console/Command/NodeSharedRemoveCommand.php index f61fde9f..c9536c54 100644 --- a/src/PHPCR/Shell/Console/Command/NodeSharedRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/NodeSharedRemoveCommand.php @@ -11,8 +11,9 @@ use PHPCR\Util\CND\Parser\CndParser; use PHPCR\NamespaceException; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class NodeSharedRemoveCommand extends Command +class NodeSharedRemoveCommand extends PhpcrShellCommand { protected function configure() { @@ -27,7 +28,9 @@ protected function configure() If this node is not shared this method removes only this node. HERE - ); + ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_SHAREABLE_NODES_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/NodeSharedShowCommand.php b/src/PHPCR/Shell/Console/Command/NodeSharedShowCommand.php index 8bf20bfe..e03a53ac 100644 --- a/src/PHPCR/Shell/Console/Command/NodeSharedShowCommand.php +++ b/src/PHPCR/Shell/Console/Command/NodeSharedShowCommand.php @@ -11,8 +11,9 @@ use PHPCR\Util\CND\Parser\CndParser; use PHPCR\NamespaceException; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class NodeSharedShowCommand extends Command +class NodeSharedShowCommand extends PhpcrShellCommand { protected function configure() { @@ -27,6 +28,8 @@ protected function configure() If this node is not shared then only this node is shown. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_SHAREABLE_NODES_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/PhpcrShellCommand.php b/src/PHPCR/Shell/Console/Command/PhpcrShellCommand.php new file mode 100644 index 00000000..b682b8cd --- /dev/null +++ b/src/PHPCR/Shell/Console/Command/PhpcrShellCommand.php @@ -0,0 +1,41 @@ +descriptorRequires[$descriptorKey] = $value; + } + + public function dequiresDescriptor($descriptorKey, $value = null) + { + $this->descriptorDequires[$descriptorKey] = $value; + } + + public function isEnabled() + { + foreach ($this->descriptorRequires as $key => $value) { + $has = $this->getHelper('repository')->hasDescriptor($key, $value); + if (!$has) { + return false; + } + } + + foreach ($this->descriptorDequires as $key => $value) { + $has = $this->getHelper('repository')->hasDescriptor($key, $value); + + if ($has) { + return false; + } + } + + return true; + } +} diff --git a/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php b/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php index 7bfcf058..6d7bc174 100644 --- a/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php +++ b/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php @@ -26,16 +26,30 @@ public function execute(InputInterface $input, OutputInterface $output) $keys = $repository->getDescriptorKeys(); $table = clone $this->getHelper('table'); - $table->setHeaders(array('Key', 'Value')); + $table->setHeaders(array('Key', 'Value', 'Standard?')); foreach ($keys as $key) { $descriptor = $repository->getDescriptor($key); + $isStandard = $repository->isStandardDescriptor($key); if (is_array($descriptor)) { - $descriptor = implode(', ', $descriptor); + $descriptor = implode(', ', $this->getDescriptorValue($descriptor)); } - $table->addRow(array($key, $descriptor)); + $table->addRow(array( + $key, + $this->getDescriptorValue($descriptor), + $isStandard ? 'yes' : 'no', + )); } $table->render($output); } + + private function getDescriptorValue($v) + { + if (is_bool($v)) { + return $v ? 'true' : 'false'; + } + + return $v; + } } diff --git a/src/PHPCR/Shell/Console/Command/RetentionHoldAddCommand.php b/src/PHPCR/Shell/Console/Command/RetentionHoldAddCommand.php index f6871ea4..b9f00324 100644 --- a/src/PHPCR/Shell/Console/Command/RetentionHoldAddCommand.php +++ b/src/PHPCR/Shell/Console/Command/RetentionHoldAddCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class RetentionHoldAddCommand extends Command +class RetentionHoldAddCommand extends PhpcrShellCommand { protected function configure() { @@ -26,6 +27,8 @@ protected function configure() specified. They are application-dependent. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_RETENTION_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/RetentionHoldListCommand.php b/src/PHPCR/Shell/Console/Command/RetentionHoldListCommand.php index f23df924..45793aa3 100644 --- a/src/PHPCR/Shell/Console/Command/RetentionHoldListCommand.php +++ b/src/PHPCR/Shell/Console/Command/RetentionHoldListCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class RetentionHoldListCommand extends Command +class RetentionHoldListCommand extends PhpcrShellCommand { protected function configure() { @@ -20,6 +21,8 @@ protected function configure() existing node at absPath. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_RETENTION_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/RetentionHoldRemoveCommand.php b/src/PHPCR/Shell/Console/Command/RetentionHoldRemoveCommand.php index 7c74b9f5..d76277b4 100644 --- a/src/PHPCR/Shell/Console/Command/RetentionHoldRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/RetentionHoldRemoveCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class RetentionHoldRemoveCommand extends Command +class RetentionHoldRemoveCommand extends PhpcrShellCommand { protected function configure() { @@ -22,6 +23,8 @@ protected function configure() The removal does not take effect until a save is performed. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_RETENTION_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/RetentionPolicyGetCommand.php b/src/PHPCR/Shell/Console/Command/RetentionPolicyGetCommand.php index ae878a6d..497725d5 100644 --- a/src/PHPCR/Shell/Console/Command/RetentionPolicyGetCommand.php +++ b/src/PHPCR/Shell/Console/Command/RetentionPolicyGetCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class RetentionPolicyGetCommand extends Command +class RetentionPolicyGetCommand extends PhpcrShellCommand { protected function configure() { @@ -19,6 +20,8 @@ protected function configure() Gets the retention policy of a node identified by its path. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_RETENTION_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Command/RetentionPolicyRemoveCommand.php b/src/PHPCR/Shell/Console/Command/RetentionPolicyRemoveCommand.php index b274ea8f..0bea8918 100644 --- a/src/PHPCR/Shell/Console/Command/RetentionPolicyRemoveCommand.php +++ b/src/PHPCR/Shell/Console/Command/RetentionPolicyRemoveCommand.php @@ -7,8 +7,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use PHPCR\RepositoryInterface; -class RetentionPolicyRemoveCommand extends Command +class RetentionPolicyRemoveCommand extends PhpcrShellCommand { protected function configure() { @@ -19,6 +20,8 @@ protected function configure() Removes the retention policy of a node identified by its path. HERE ); + + $this->requiresDescriptor(RepositoryInterface::OPTION_RETENTION_SUPPORTED, true); } public function execute(InputInterface $input, OutputInterface $output) diff --git a/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php new file mode 100644 index 00000000..e49cf5fe --- /dev/null +++ b/src/PHPCR/Shell/Console/Helper/RepositoryHelper.php @@ -0,0 +1,75 @@ +repository = $repository; + } + + /** + * Return true if the repository supports the given descriptor + * which relates to a descriptor key + * + * @param string $descriptor + */ + public function hasDescriptor($descriptor, $value = null) + { + $this->loadDescriptors(); + + $exists = array_key_exists($descriptor, $this->descriptors); + + if (false === $exists) { + return false; + } + + if (null === $value) { + return true; + } + + $descriptorValue = $this->descriptors[$descriptor]; + + // normalize + if ($descriptorValue === 'true') { + $descriptorValue = true; + } + if ($descriptorValue === 'false') { + $descriptorValue = false; + } + + if ($value === $descriptorValue) { + return true; + } + + return false; + } + + private function loadDescriptors() + { + if (null === $this->descriptors) { + foreach ($this->repository->getDescriptorKeys() as $key) { + $this->descriptors[$key] = $this->repository->getDescriptor($key); + } + } + } + + public function getName() + { + return 'repository'; + } +} From 8ab4abb0124c917ec2c757cae4c46145b516a113 Mon Sep 17 00:00:00 2001 From: dantleech Date: Sat, 29 Mar 2014 10:06:47 +0100 Subject: [PATCH 2/2] CS fixes --- src/PHPCR/Shell/Console/Command/LockInfoCommand.php | 2 +- src/PHPCR/Shell/Console/Command/LockLockCommand.php | 3 ++- .../Console/Command/RepositoryDescriptorListCommand.php | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/PHPCR/Shell/Console/Command/LockInfoCommand.php b/src/PHPCR/Shell/Console/Command/LockInfoCommand.php index 28a95ad8..289f7625 100644 --- a/src/PHPCR/Shell/Console/Command/LockInfoCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockInfoCommand.php @@ -23,7 +23,7 @@ protected function configure() This may be either of the lock on that node itself or a deep lock on a node above that node. HERE - ); + ); $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); $this->dequiresDescriptor('jackalope.not_implemented.lock.get'); diff --git a/src/PHPCR/Shell/Console/Command/LockLockCommand.php b/src/PHPCR/Shell/Console/Command/LockLockCommand.php index ea0d741b..027212a0 100644 --- a/src/PHPCR/Shell/Console/Command/LockLockCommand.php +++ b/src/PHPCR/Shell/Console/Command/LockLockCommand.php @@ -51,7 +51,8 @@ protected function configure() It is possible to lock a node even if it is checked-in. HERE - ); + ); + $this->requiresDescriptor(RepositoryInterface::OPTION_LOCKING_SUPPORTED, true); } diff --git a/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php b/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php index 6d7bc174..ebb051f0 100644 --- a/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php +++ b/src/PHPCR/Shell/Console/Command/RepositoryDescriptorListCommand.php @@ -44,12 +44,12 @@ public function execute(InputInterface $input, OutputInterface $output) $table->render($output); } - private function getDescriptorValue($v) + private function getDescriptorValue($value) { - if (is_bool($v)) { - return $v ? 'true' : 'false'; + if (is_bool($value)) { + return $value ? 'true' : 'false'; } - return $v; + return $value; } }