public function execute(InputInterface $input, OutputInterface $output) { $config = $this->get('config.manager'); $aliases = $config->getConfig('alias'); $table = new Table($output); $table->setHeaders(['Alias', 'Command']); foreach ($aliases as $alias => $command) { $table->addRow([$alias, $command]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $prefixes = $session->getNamespacePrefixes(); $table = new Table($output); $table->setHeaders(['Prefix', 'URI']); foreach ($prefixes as $prefix) { $uri = $session->getNamespaceURI($prefix); $table->addRow([$prefix, $uri]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $retentionManager = $session->getRetentionManager(); $absPath = $input->getArgument('absPath'); $holds = $retentionManager->getHolds($absPath); $table = new Table($output); $table->setHeaders(['Name']); foreach ($holds as $hold) { $table->addRow([$hold->getName()]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $workspace = $session->getWorkspace(); $lockManager = $workspace->getLockManager(); $lockTokens = $lockManager->getLockTokens(); $table = new Table($output); $table->setHeaders(['Token']); foreach ($lockTokens as $token) { $table->addRow([$token]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $workspace = $session->getWorkspace(); $availableWorkspaces = $workspace->getAccessibleWorkspaceNames(); $table = new Table($output); $table->setHeaders(['Name']); foreach ($availableWorkspaces as $availableWorkspace) { if ($availableWorkspace == $workspace->getName()) { $availableWorkspace .= ' *'; } $table->addRow([$availableWorkspace]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $repository = $session->getRepository(); $info = ['user id' => $session->getUserID(), 'live' => $session->isLive() ? 'yes' : 'no', 'workspace name' => $session->getWorkspace()->getName(), 'jcr repository name' => $repository->getDescriptor('jcr.repository.name'), 'jcr repository vendor' => $repository->getDescriptor('jcr.repository.vendor'), 'jcr repository version' => $repository->getDescriptor('jcr.repository.version')]; foreach ($session->getAttributeNames() as $attributeName) { $attribute = $session->getAttribute($attributeName); } $table = new Table($output); $table->setHeaders(['Key', 'Value']); foreach ($info as $key => $value) { $table->addRow([$key, $value]); } $table->render($output); }
/** * Render a table with the results of the given QueryResultInterface. */ public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed) { $table = new Table($output); $table->setHeaders(array_merge(['Path', 'Index'], $result->getColumnNames())); foreach ($result->getRows() as $row) { $values = array_merge([$row->getPath()], $row->getValues()); foreach ($values as &$value) { $value = $this->textHelper->truncate($value, 255); } $table->addRow($values); } $table->render($output); if (true === $this->config['show_execution_time_query']) { $output->writeln(sprintf('%s rows in set (%s sec)', count($result->getRows()), number_format($elapsed, $this->config['execution_time_expansion']))); } }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $supported = $input->getOption('supported'); $absOath = $input->getArgument('absPath'); $acm = $session->getAccessControlManager(); if (true === $supported) { $privileges = $acm->getSupportedPrivileges($absPath); } else { $privileges = $acm->getPrivileges($absPath); } $table = new Table($output); $table->setHeaders(['Name']); foreach ($privileges as $privilege) { $table->addRow([$privilege->getName()]); } }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $repository = $session->getRepository(); $keys = $repository->getDescriptorKeys(); $table = new Table($output); $table->setHeaders(['Key', 'Value', 'Standard?']); foreach ($keys as $key) { $descriptor = $repository->getDescriptor($key); $isStandard = $repository->isStandardDescriptor($key); if (is_array($descriptor)) { $descriptor = implode(', ', $this->getDescriptorValue($descriptor)); } $table->addRow([$key, $this->getDescriptorValue($descriptor), $isStandard ? 'yes' : 'no']); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $nodeHelper = $this->get('helper.node'); $table = new Table($output); $path = $input->getArgument('path'); $workspace = $session->getWorkspace(); $node = $session->getNodeByPathOrIdentifier($path); $nodeHelper->assertNodeIsVersionable($node); $versionManager = $workspace->getVersionManager(); $history = $versionManager->getVersionHistory($node->getPath()); $versions = $history->getAllVersions(); $table->setHeaders(['Name', 'Created']); foreach ($versions as $name => $version) { $table->addRow([$name, $version->getCreated()->format('Y-m-d H:i:s')]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $workspace = $session->getWorkspace(); $namespaceRegistry = $workspace->getNamespaceRegistry(); $nodeTypeManager = $workspace->getNodeTypeManager(); $filter = $input->getArgument('filter'); $nodeTypes = $nodeTypeManager->getAllNodeTypes(); $table = new Table($output); $table->setHeaders(['Name', 'Primary Item Name', 'Abstract?', 'Mixin?', 'Queryable?']); foreach ($nodeTypes as $nodeType) { if ($filter && !preg_match('{' . $filter . '}', $nodeType->getName())) { continue; } $table->addRow([$nodeType->getName(), $nodeType->getPrimaryItemName(), $nodeType->isAbstract() ? 'yes' : 'no', $nodeType->isMixin() ? 'yes' : 'no', $nodeType->isQueryable() ? 'yes' : 'no']); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { $this->output = $output; $profile = $this->get('config.profile'); $output->writeln('<comment>NOTE: The profile may include information not relating to your current transport</comment>'); $output->writeln(''); foreach ($profile->toArray() as $domain => $config) { $output->writeln('<comment>' . $domain . '</comment>'); $table = new Table($output); $table->setHeaders(['Key', 'Value']); foreach ($config as $key => $value) { if ($key === 'db_password') { $value = '***'; } $table->addRow([$key, is_scalar($value) ? $value : json_encode($value)]); } $table->render($output); } }
public function execute(InputInterface $input, OutputInterface $output) { $session = $this->get('phpcr.session'); $path = $input->getArgument('path'); $name = $input->getArgument('name'); $nodes = $session->findNodes($path); foreach ($nodes as $node) { $references = ['weak' => [], 'strong' => []]; $references['weak'] = $node->getWeakReferences($name ?: null); $references['strong'] = $node->getReferences($name ?: null); $table = new Table($output); $table->setHeaders(['Path', 'Property', 'Type']); foreach ($references as $type => $typeReferences) { foreach ($typeReferences as $property) { $nodePath = $property->getParent()->getPath(); $table->addRow([$nodePath, $property->getName(), $type]); } } if (0 !== count($references['weak']) || 0 !== count($references['strong'])) { $output->writeln('<pathbold>' . $node->getPath() . '</pathbold>'); $table->render($output); } } }