public function isHiddenInList() { // Hide this command in the list if the project is not Drupal. $projectRoot = $this->getProjectRoot(); if ($projectRoot && !Drupal::isDrupal($projectRoot)) { return true; } return parent::isHiddenInList(); }
protected function configure() { parent::configure(); $this->setName('environment:http-access')->setAliases(['httpaccess'])->setDescription('Update HTTP access settings for an environment')->addOption('access', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Access restriction in the format "permission:address"')->addOption('auth', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Authentication details in the format "username:password"')->addOption('enabled', null, InputOption::VALUE_REQUIRED, 'Whether access control should be enabled: 1 to enable, 0 to disable'); $this->addProjectOption()->addEnvironmentOption()->addNoWaitOption(); $this->addExample('Require a username and password', '--auth myname:mypassword'); $this->addExample('Restrict access to only one IP address', '--access deny:any --access allow:69.208.1.192'); $this->addExample('Remove the password requirement, keeping IP restrictions', '--auth 0'); $this->addExample('Disable all HTTP access control', '--enabled 0'); }
public function hideInList() { // Hide this command in the list if the project is not Drupal. $projectRoot = $this->getProjectRoot(); if ($projectRoot) { if (!Drupal::isDrupal($projectRoot . '/' . LocalProject::REPOSITORY_DIR)) { return true; } } return parent::hideInList(); }
/** * Get the preferred project for autocompletion. * * The project is either defined by an ID that the user has specified in * the command (via the 'id' argument of 'get', or the '--project' option), * or it is determined from the current path. * * @return \Platformsh\Client\Model\Project|false */ protected function getProject() { if (!$this->projects) { return false; } $commandLine = $this->handler->getContext()->getCommandLine(); $currentProjectId = $this->getProjectIdFromCommandLine($commandLine); if (!$currentProjectId && ($currentProject = $this->welcomeCommand->getCurrentProject())) { return $currentProject; } elseif (isset($this->projects[$currentProjectId])) { return $this->projects[$currentProjectId]; } return false; }
/** * Get a list of environment IDs. * * The project is either defined by an ID that the user has specified in * the command (via the 'id' argument of 'get', or the '--project' option), * or it is determined from the current path. * * @return string[] */ public function getEnvironments() { if (!$this->projects) { return []; } $commandLine = $this->handler->getContext()->getCommandLine(); $currentProjectId = $this->getProjectIdFromCommandLine($commandLine); if (!$currentProjectId && ($currentProject = $this->platformCommand->getCurrentProject())) { $project = $currentProject; } elseif (isset($this->projects[$currentProjectId])) { $project = $this->projects[$currentProjectId]; } else { return []; } $environments = $this->platformCommand->getEnvironments($project, false, false); return array_keys($environments); }
/** * {@inheritdoc} */ public function isEnabled() { return parent::isEnabled() && self::$config->has('experimental.enable_create') && self::$config->get('experimental.enable_create'); }
public function isEnabled() { return ProcessManager::supported() && parent::isEnabled(); }
public function __construct($name = null) { parent::__construct($name); $this->propertyFormatter = new PropertyFormatter(); }