Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2019-02-17 12:21:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Sun Feb 17 12:21:27 2019 rev:62 rq:676595 version:3.40.0 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2019-01-21 11:02:29.767109127 +0100 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new.28833/platformsh-cli.changes 2019-02-17 12:21:28.120198452 +0100 @@ -1,0 +2,19 @@ +Fri Feb 15 18:10:44 UTC 2019 - [email protected] + +- Update to version 3.40.0: + * Release v3.40.0 + * Use a different Drush alias root for site-local versions 8 or 9 (#777) + * Fix non-interactive choice default handling + * Fix non-interactive choice questions with no default should return null instead of erroring + * Make db:size schema agnostic but warn about inaccessible schemas + * Filter schemas by endpoint privileges + * Present a choice between schemas + * Include the service name and schema in the dump filename + * Add --schema option to db:dump and db:sql + * Always include a line break after choose() + * Fix checkout command when there is only one branch + * Fix Drush lock files not being used + * Add some 3-letter aliases + * Remove experimental "server" commands from README + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.39.0.tar.xz New: ---- platformsh-cli-3.40.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.MWd1w3/_old 2019-02-17 12:21:28.892198240 +0100 +++ /var/tmp/diff_new_pack.MWd1w3/_new 2019-02-17 12:21:28.896198239 +0100 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.39.0 +Version: 3.40.0 Release: 0 Summary: Tool for managing Platform.sh services from the command line # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.MWd1w3/_old 2019-02-17 12:21:28.928198230 +0100 +++ /var/tmp/diff_new_pack.MWd1w3/_new 2019-02-17 12:21:28.932198229 +0100 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">refs/tags/v3.39.0</param> + <param name="revision">refs/tags/v3.40.0</param> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.MWd1w3/_old 2019-02-17 12:21:28.948198224 +0100 +++ /var/tmp/diff_new_pack.MWd1w3/_new 2019-02-17 12:21:28.952198224 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">d0dd97e777b3c7b2fe5432004477ef3eb9f44fcf</param> + <param name="changesrevision">4d5f7dcd1eefbbf3473e0b7f091623cd7d83d355</param> </service> </servicedata> ++++++ platformsh-cli-3.39.0.tar.xz -> platformsh-cli-3.40.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/README.md new/platformsh-cli-3.40.0/README.md --- old/platformsh-cli-3.39.0/README.md 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/README.md 2019-02-15 17:37:35.000000000 +0100 @@ -81,7 +81,7 @@ web Open the Web UI activity activity:get View detailed information on a single activity - activity:list (activities) Get a list of activities for an environment or project + activity:list (activities, act) Get a list of activities for an environment or project activity:log Display the log for an activity app app:config-get View the configuration of an app @@ -117,7 +117,7 @@ environment:drush (drush) Run a drush command on the remote environment environment:http-access (httpaccess) Update HTTP access settings for an environment environment:info Read or set properties for an environment - environment:list (environments) Get a list of environments + environment:list (environments, env) Get a list of environments environment:logs (log) Read an environment's logs environment:merge (merge) Merge an environment environment:push (push) Push code to an environment @@ -148,7 +148,7 @@ project:delete Delete a project project:get (get) Clone a project locally project:info Read or set properties for a project - project:list (projects) Get a list of all active projects + project:list (projects, pro) Get a list of all active projects project:set-remote Set the remote project for the current Git repository repo repo:cat Read a file in the project repository @@ -159,11 +159,6 @@ self self:install Install or update CLI configuration files self:update (self-update) Update the CLI to the latest version -server - server:list (servers) List running local project web server(s) - server:run Run a local PHP web server - server:start Run PHP web server(s) for the local project - server:stop Stop local project web server(s) service service:list (services) List services in the project service:mongo:dump (mongodump) Create a binary archive dump of data from MongoDB @@ -195,7 +190,7 @@ variable:create Create a variable variable:delete Delete a variable variable:get (vget) View a variable - variable:list (variables) List variables + variable:list (variables, var) List variables variable:update Update a variable worker worker:list (workers) Get a list of all deployed workers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/config.yaml new/platformsh-cli-3.40.0/config.yaml --- old/platformsh-cli-3.39.0/config.yaml 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/config.yaml 2019-02-15 17:37:35.000000000 +0100 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.39.0' + version: '3.40.0' executable: 'platform' package_name: 'platformsh/cli' installer_url: 'https://platform.sh/cli/installer' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/dist/manifest.json new/platformsh-cli-3.40.0/dist/manifest.json --- old/platformsh-cli-3.39.0/dist/manifest.json 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/dist/manifest.json 2019-02-15 17:37:35.000000000 +0100 @@ -1,10 +1,10 @@ [ { "name": "platform.phar", - "sha1": "a522451e18a9aa6d50c93b76903e13efd7a4c9a6", - "sha256": "f764ee7f83e659276e2876e3b80fda134045ab2ed9192d7f8574f2d56d559b28", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.39.0/platform.phar", - "version": "3.39.0", + "sha1": "72d7a75476e28557e49fbd14c1fd3265075a0891", + "sha256": "9d48efeff8ecfa4a0eea0826c6df8dba12827b8f3e9af0f3aa14b2bff299c420", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.40.0/platform.phar", + "version": "3.40.0", "php": { "min": "5.5.9" }, @@ -167,6 +167,11 @@ "notes": "New features:\n\n* Add tunnel:single command (allow opening a tunnel without posix/pcntl).\n\nBug fixes:\n\n* Fix bug where login to a new account does not log out from the old account.\n* Account for differing app roots in Drush aliases - allows generated Drush\n aliases to work with Platform.sh Enterprise environments.\n* Fix Drush 9 alias compatibility (and remove Drush 9-beta compatibility).", "show from": "3.38.0", "hide from": "3.39.0" + }, + { + "notes": "New features:\n\n* Support multiple schemas per database relationship:\n - Add --schema option to `db:dump` and `db:sql` commands.\n - Include the service name and schema in the `db:dump` default filename.\n - Present a choice between schemas if no schema is specified.\n - Make `db:size` schema agnostic but warn about inaccessible schemas.\n\nBug fixes:\n\n* Use a different Drush alias root for site-local versions 8 or 9. Drush 9\n fails to find a Drupal root via a relative path in some circumstances.\n* Fix behavior of choice questions with no default in non-interactive mode.\n* Fix checkout command when there is only one branch.\n* Fix Drush lock files not being used in local:build command.\n\nOther changes:\n\n* Add some 3-letter command aliases:\n - activity:list => activities => act\n - environment:list => environments => env\n - project:list => projects => pro\n - variable:list => variables => var", + "show from": "3.39.0", + "hide from": "3.40.0" } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Activity/ActivityListCommand.php new/platformsh-cli-3.40.0/src/Command/Activity/ActivityListCommand.php --- old/platformsh-cli-3.39.0/src/Command/Activity/ActivityListCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Activity/ActivityListCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -19,7 +19,7 @@ { $this ->setName('activity:list') - ->setAliases(['activities']) + ->setAliases(['activities', 'act']) ->addOption('type', null, InputOption::VALUE_REQUIRED, 'Filter activities by type') ->addOption('limit', null, InputOption::VALUE_REQUIRED, 'Limit the number of results displayed', 10) ->addOption('start', null, InputOption::VALUE_REQUIRED, 'Only activities created before this date will be listed') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/CommandBase.php new/platformsh-cli-3.40.0/src/Command/CommandBase.php --- old/platformsh-cli-3.39.0/src/Command/CommandBase.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/CommandBase.php 2019-02-15 17:37:35.000000000 +0100 @@ -877,8 +877,6 @@ $id = $questionHelper->choose($projectList, $text, null, false); - $this->stdErr->writeln(''); - return $id; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Db/DbDumpCommand.php new/platformsh-cli-3.40.0/src/Command/Db/DbDumpCommand.php --- old/platformsh-cli-3.39.0/src/Command/Db/DbDumpCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Db/DbDumpCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -18,7 +18,8 @@ { $this->setName('db:dump') ->setDescription('Create a local dump of the remote database'); - $this->addOption('file', 'f', InputOption::VALUE_REQUIRED, 'A custom filename for the dump') + $this->addOption('schema', null, InputOption::VALUE_REQUIRED, 'The schema to dump. Omit to use the default schema (usually "main").') + ->addOption('file', 'f', InputOption::VALUE_REQUIRED, 'A custom filename for the dump') ->addOption('directory', 'd', InputOption::VALUE_REQUIRED, 'A custom directory for the dump') ->addOption('gzip', 'z', InputOption::VALUE_NONE, 'Compress the dump using gzip') ->addOption('timestamp', 't', InputOption::VALUE_NONE, 'Add a timestamp to the dump filename') @@ -50,6 +51,59 @@ /** @var \Platformsh\Cli\Service\Filesystem $fs */ $fs = $this->getService('fs'); + /** @var \Platformsh\Cli\Service\Relationships $relationships */ + $relationships = $this->getService('relationships'); + + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + + $database = $relationships->chooseDatabase($sshUrl, $input, $output); + if (empty($database)) { + return 1; + } + + $schema = $input->getOption('schema'); + if (empty($schema)) { + // Get information about the deployed service associated with the + // selected relationship. + $deployment = $this->api()->getCurrentDeployment($environment); + $service = $deployment->getService($database['service']); + + // Get a list of schemas from the service configuration. + $schemas = !empty($service->configuration['schemas']) + ? $service->configuration['schemas'] + : ['main']; + + // Filter the list by the schemas accessible from the endpoint. + if (isset($database['rel']) + && isset($service->configuration['endpoints'][$database['rel']]['privileges'])) { + $schemas = array_intersect( + $schemas, + array_keys($service->configuration['endpoints'][$database['rel']]['privileges']) + ); + } + + // Provide the user with a choice of schemas. + $choices = []; + foreach ($schemas as $schema) { + $choices[$schema] = $schema; + if ($schema === $database['path']) { + $choices[$schema] .= ' (default)'; + } + } + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + $schema = $questionHelper->choose($choices, 'Enter a number to choose a schema:', $database['path'] ? $database['path'] . ' (default)' : null, true); + if (empty($schema)) { + $this->stdErr->writeln('The --schema is required.'); + if (!empty($schemas)) { + $this->stdErr->writeln('Available schemas: ' . implode(', ', $schemas)); + } + + return 1; + } + } + $dumpFile = null; if (!$input->getOption('stdout')) { // Process the user --file option. @@ -69,7 +123,8 @@ } else { $defaultFilename = $this->getDefaultFilename( $environment, - $appName, + $database['service'], + $schema, $includedTables, $excludedTables, $schemaOnly, @@ -107,8 +162,6 @@ if ($dumpFile) { if (file_exists($dumpFile)) { - /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ - $questionHelper = $this->getService('question_helper'); if (!$questionHelper->confirm("File exists: <comment>$dumpFile</comment>. Overwrite?", false)) { return 1; } @@ -120,17 +173,9 @@ )); } - /** @var \Platformsh\Cli\Service\Relationships $relationships */ - $relationships = $this->getService('relationships'); - - $database = $relationships->chooseDatabase($sshUrl, $input, $output); - if (empty($database)) { - return 1; - } - switch ($database['scheme']) { case 'pgsql': - $dumpCommand = 'pg_dump --no-owner --clean --blobs ' . $relationships->getDbCommandArgs('pg_dump', $database); + $dumpCommand = 'pg_dump --no-owner --clean --blobs ' . $relationships->getDbCommandArgs('pg_dump', $database, $schema); if ($schemaOnly) { $dumpCommand .= ' --schema-only'; } @@ -144,7 +189,7 @@ default: $dumpCommand = 'mysqldump --single-transaction ' - . $relationships->getDbCommandArgs('mysqldump', $database); + . $relationships->getDbCommandArgs('mysqldump', $database, $schema); if ($schemaOnly) { $dumpCommand .= ' --no-data'; } @@ -223,7 +268,8 @@ * Get the default dump filename. * * @param Environment $environment - * @param string|null $appName + * @param string|null $dbServiceName + * @param string|null $schema * @param array $includedTables * @param array $excludedTables * @param bool $schemaOnly @@ -233,15 +279,19 @@ */ private function getDefaultFilename( Environment $environment, - $appName = null, + $dbServiceName = null, + $schema = null, array $includedTables = [], array $excludedTables = [], $schemaOnly = false, $gzip = false) { $defaultFilename = $environment->project . '--' . $environment->machine_name; - if ($appName !== null) { - $defaultFilename .= '--' . $appName; + if ($dbServiceName !== null) { + $defaultFilename .= '--' . $dbServiceName; + } + if ($schema !== null) { + $defaultFilename .= '--' . $schema; } if ($includedTables) { $defaultFilename .= '--' . implode(',', $includedTables); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Db/DbSizeCommand.php new/platformsh-cli-3.40.0/src/Command/Db/DbSizeCommand.php --- old/platformsh-cli-3.39.0/src/Command/Db/DbSizeCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Db/DbSizeCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -53,34 +53,19 @@ return 1; } - // Find the database's service name in the relationships. - $dbServiceName = false; - foreach ($appConfig['relationships'] as $relationshipName => $relationship) { - if ($database['_relationship_name'] === $relationshipName) { - list($dbServiceName,) = explode(':', $relationship, 2); - break; - } - } - if (!$dbServiceName) { - $this->stdErr->writeln('Service name not found for relationship: ' . $database['_relationship_name']); - return 1; - } - - // Load services yaml. - $services = $this->getProjectServiceConfig(); - if (!empty($services[$dbServiceName]['disk'])) { - $allocatedDisk = $services[$dbServiceName]['disk']; - } else { - $this->stdErr->writeln('The allocated disk size could not be determined for service: <comment>' . $dbServiceName . '</comment>'); - $allocatedDisk = false; - } + // Get information about the deployed service associated with the + // selected relationship. + $deployment = $this->api()->getCurrentDeployment($this->getSelectedEnvironment()); + $dbServiceName = $database['service']; + $service = $deployment->getService($dbServiceName); + $allocatedDisk = $service->disk; /** @var Shell $shell */ $shell = $this->getService('shell'); /** @var \Platformsh\Cli\Service\Ssh $ssh */ $ssh = $this->getService('ssh'); - $this->stdErr->writeln('Checking database <comment>' . $dbServiceName . '</comment>...'); + $this->stdErr->writeln(sprintf('Checking database service <comment>%s</comment>...', $dbServiceName)); $command = ['ssh']; $command = array_merge($command, $ssh->getSshArgs()); @@ -123,6 +108,23 @@ $this->stdErr->writeln('<options=bold;fg=yellow>Warning</>'); $this->stdErr->writeln("This is an estimate of the database's disk usage. It does not represent its real size on disk."); + // Find if not all the available schemas were accessible via this relationship. + if (isset($database['rel']) + && isset($service->configuration['endpoints'][$database['rel']]['privileges'])) { + $schemas = !empty($service->configuration['schemas']) + ? $service->configuration['schemas'] + : ['main']; + $accessible = array_keys($service->configuration['endpoints'][$database['rel']]['privileges']); + $missing = array_diff($schemas, $accessible); + if (!empty($missing)) { + $this->stdErr->writeln(''); + $this->stdErr->writeln('Additionally, not all schemas are accessible through this endpoint.'); + $this->stdErr->writeln(' Endpoint: ' . $database['rel']); + $this->stdErr->writeln(' Accessible schemas: <info>' . implode(', ', $accessible) . '</info>'); + $this->stdErr->writeln(' Inaccessible schemas: <comment>' . implode(', ', $missing) . '</comment>'); + } + } + return 0; } @@ -145,7 +147,7 @@ /** @var \Platformsh\Cli\Service\Relationships $relationships */ $relationships = $this->getService('relationships'); - $dbUrl = $relationships->getDbCommandArgs('psql', $database); + $dbUrl = $relationships->getDbCommandArgs('psql', $database, ''); return sprintf( "psql --echo-hidden -t --no-align %s -c '%s'", @@ -173,7 +175,7 @@ /** @var \Platformsh\Cli\Service\Relationships $relationships */ $relationships = $this->getService('relationships'); - $connectionParams = $relationships->getDbCommandArgs('mysql', $database); + $connectionParams = $relationships->getDbCommandArgs('mysql', $database, ''); return sprintf( "mysql %s --no-auto-rehash --raw --skip-column-names --execute '%s'", @@ -181,32 +183,4 @@ $query ); } - - /** - * Find the service configuration (from services.yaml). - * - * @return array - */ - private function getProjectServiceConfig() - { - $servicesYaml = false; - $servicesYamlFilename = $this->config()->get('service.project_config_dir') . '/services.yaml'; - $services = []; - try { - /** @var \Platformsh\Cli\Service\GitDataApi $gitData */ - $gitData = $this->getService('git_data_api'); - $servicesYaml = $gitData->readFile($servicesYamlFilename, $this->getSelectedEnvironment()); - } catch (ApiFeatureMissingException $e) { - $this->debug($e->getMessage()); - if ($projectRoot = $this->getProjectRoot()) { - $this->debug('Reading file in local project: ' . $projectRoot . '/' . $servicesYamlFilename); - $servicesYaml = file_get_contents($projectRoot . '/' . $servicesYamlFilename); - } - } - if ($servicesYaml) { - $services = (new YamlParser())->parseContent($servicesYaml, $servicesYamlFilename); - } - - return $services; - } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Db/DbSqlCommand.php new/platformsh-cli-3.40.0/src/Command/Db/DbSqlCommand.php --- old/platformsh-cli-3.39.0/src/Command/Db/DbSqlCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Db/DbSqlCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -21,6 +21,7 @@ ->setDescription('Run SQL on the remote database') ->addArgument('query', InputArgument::OPTIONAL, 'An SQL statement to execute') ->addOption('raw', null, InputOption::VALUE_NONE, 'Produce raw, non-tabular output'); + $this->addOption('schema', null, InputOption::VALUE_REQUIRED, 'The schema to dump. Omit to use the default schema (usually "main"). Pass an empty string to not use any schema.'); $this->addProjectOption()->addEnvironmentOption()->addAppOption(); Relationships::configureInput($this->getDefinition()); Ssh::configureInput($this->getDefinition()); @@ -47,11 +48,52 @@ return 1; } + $schema = $input->getOption('schema'); + if ($schema === null) { + // Get information about the deployed service associated with the + // selected relationship. + $deployment = $this->api()->getCurrentDeployment($this->getSelectedEnvironment()); + $service = $deployment->getService($database['service']); + + // Get a list of schemas from the service configuration. + $schemas = !empty($service->configuration['schemas']) + ? $service->configuration['schemas'] + : ['main']; + + // Filter the list by the schemas accessible from the endpoint. + if (isset($database['rel']) + && isset($service->configuration['endpoints'][$database['rel']]['privileges'])) { + $schemas = array_intersect( + $schemas, + array_keys($service->configuration['endpoints'][$database['rel']]['privileges']) + ); + } + + // Provide the user with a choice of schemas. + if (count($schemas) === 1) { + $schema = reset($schemas); + } else { + $choices = []; + $schemas[] = '(none)'; + $default = ($database['path'] ?: '(none)'); + foreach ($schemas as $schema) { + $choices[$schema] = $schema; + if ($schema === $default) { + $choices[$schema] .= ' (default)'; + } + } + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ + $questionHelper = $this->getService('question_helper'); + $schema = $questionHelper->choose($choices, 'Enter a number to choose a schema:', $default . ' (default)', true); + $schema = $schema === '(none)' ? '' : $schema; + } + } + $query = $input->getArgument('query'); switch ($database['scheme']) { case 'pgsql': - $sqlCommand = 'psql ' . $relationships->getDbCommandArgs('psql', $database); + $sqlCommand = 'psql ' . $relationships->getDbCommandArgs('psql', $database, $schema); if ($query) { if ($input->getOption('raw')) { $sqlCommand .= ' -t'; @@ -61,7 +103,7 @@ break; default: - $sqlCommand = 'mysql --no-auto-rehash ' . $relationships->getDbCommandArgs('mysql', $database); + $sqlCommand = 'mysql --no-auto-rehash ' . $relationships->getDbCommandArgs('mysql', $database, $schema); if ($query) { if ($input->getOption('raw')) { $sqlCommand .= ' --batch --raw'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Environment/EnvironmentCheckoutCommand.php new/platformsh-cli-3.40.0/src/Command/Environment/EnvironmentCheckoutCommand.php --- old/platformsh-cli-3.39.0/src/Command/Environment/EnvironmentCheckoutCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Environment/EnvironmentCheckoutCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -39,7 +39,7 @@ if ($branch === null) { if ($input->isInteractive()) { $branch = $this->offerBranchChoice($project, $projectRoot); - if ($branch === null) { + if ($branch === false) { return 1; } } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Environment/EnvironmentListCommand.php new/platformsh-cli-3.40.0/src/Command/Environment/EnvironmentListCommand.php --- old/platformsh-cli-3.39.0/src/Command/Environment/EnvironmentListCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Environment/EnvironmentListCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -28,7 +28,7 @@ { $this ->setName('environment:list') - ->setAliases(['environments']) + ->setAliases(['environments', 'env']) ->setDescription('Get a list of environments') ->addOption('no-inactive', 'I', InputOption::VALUE_NONE, 'Do not show inactive environments') ->addOption('pipe', null, InputOption::VALUE_NONE, 'Output a simple list of environment IDs.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Project/ProjectListCommand.php new/platformsh-cli-3.40.0/src/Command/Project/ProjectListCommand.php --- old/platformsh-cli-3.39.0/src/Command/Project/ProjectListCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Project/ProjectListCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -16,7 +16,7 @@ { $this ->setName('project:list') - ->setAliases(['projects']) + ->setAliases(['projects', 'pro']) ->setDescription('Get a list of all active projects') ->addOption('pipe', null, InputOption::VALUE_NONE, 'Output a simple list of project IDs') ->addOption('host', null, InputOption::VALUE_REQUIRED, 'Filter by region hostname (exact match)') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Service/MongoDB/MongoExportCommand.php new/platformsh-cli-3.40.0/src/Command/Service/MongoDB/MongoExportCommand.php --- old/platformsh-cli-3.39.0/src/Command/Service/MongoDB/MongoExportCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Service/MongoDB/MongoExportCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -65,7 +65,6 @@ /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $questionHelper = $this->getService('question_helper'); $collection = $questionHelper->choose(array_combine($collections, $collections), 'Enter a number to choose a collection:', null, false); - $this->stdErr->writeln(''); } $command = 'mongoexport ' . $relationshipsService->getDbCommandArgs('mongoexport', $service); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/User/UserAddCommand.php new/platformsh-cli-3.40.0/src/Command/User/UserAddCommand.php --- old/platformsh-cli-3.39.0/src/Command/User/UserAddCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/User/UserAddCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -76,9 +76,6 @@ $choices[$account['email']] = $this->getUserLabel($access); } $email = $questionHelper->choose($choices, 'Enter a number to choose a user to update:'); - if (count($choices) > 1) { - $hasOutput = true; - } } else { $question = new Question("Enter the user's email address: "); $question->setValidator(function ($answer) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/User/UserGetCommand.php new/platformsh-cli-3.40.0/src/Command/User/UserGetCommand.php --- old/platformsh-cli-3.39.0/src/Command/User/UserGetCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/User/UserGetCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -59,9 +59,6 @@ $choices[$account['email']] = sprintf('%s (%s)', $account['display_name'], $account['email']); } $email = $questionHelper->choose($choices, 'Enter a number to choose a user:'); - if (count($choices) > 1) { - $this->stdErr->writeln(''); - } } $projectAccess = $this->api()->loadProjectAccessByEmail($project, $email); if (!$projectAccess) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Command/Variable/VariableListCommand.php new/platformsh-cli-3.40.0/src/Command/Variable/VariableListCommand.php --- old/platformsh-cli-3.39.0/src/Command/Variable/VariableListCommand.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Command/Variable/VariableListCommand.php 2019-02-15 17:37:35.000000000 +0100 @@ -15,7 +15,7 @@ { $this ->setName('variable:list') - ->setAliases(['variables']) + ->setAliases(['variables', 'var']) ->setDescription('List variables'); $this->addLevelOption(); Table::configureInput($this->getDefinition()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Local/BuildFlavor/Drupal.php new/platformsh-cli-3.40.0/src/Local/BuildFlavor/Drupal.php --- old/platformsh-cli-3.39.0/src/Local/BuildFlavor/Drupal.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Local/BuildFlavor/Drupal.php 2019-02-15 17:37:35.000000000 +0100 @@ -180,7 +180,7 @@ 'drupal-org.make.yml', 'drupal-org.make', ]; - if (empty($this->settings['lock'])) { + if (!empty($this->settings['lock'])) { $candidates = array_merge([ 'project.make.lock', 'project.make.yml.lock', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Service/QuestionHelper.php new/platformsh-cli-3.40.0/src/Service/QuestionHelper.php --- old/platformsh-cli-3.39.0/src/Service/QuestionHelper.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Service/QuestionHelper.php 2019-02-15 17:37:35.000000000 +0100 @@ -89,12 +89,27 @@ $question = new ChoiceQuestion($text, $itemList, $defaultKey); $question->setMaxAttempts(5); + if (!$this->input->isInteractive()) { + if (!isset($defaultKey)) { + return null; + } + $choice = $itemList[$defaultKey]; + $choiceKey = array_search($choice, $items, true); + if ($choiceKey === false) { + throw new \RuntimeException('Invalid default'); + } + + return $choiceKey; + } + $choice = $this->ask($this->input, $this->output, $question); $choiceKey = array_search($choice, $items, true); if ($choiceKey === false) { throw new \RuntimeException("Invalid value: $choice"); } + $this->output->writeln(''); + return $choiceKey; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/Service/Relationships.php new/platformsh-cli-3.40.0/src/Service/Relationships.php --- old/platformsh-cli-3.39.0/src/Service/Relationships.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/Service/Relationships.php 2019-02-15 17:37:35.000000000 +0100 @@ -126,7 +126,6 @@ if (!$identifier) { $questionHelper = new QuestionHelper($input, $output); $identifier = $questionHelper->choose($choices, 'Enter a number to choose a relationship:'); - $stdErr->writeln(''); } if (strpos($identifier, '.') !== false) { @@ -160,54 +159,74 @@ /** * Returns command-line arguments to connect to a database. * - * @param string $command The command that will need arguments (one of - * 'psql', 'pg_dump', 'mysql', or 'mysqldump'). - * @param array $database The database definition from the relationship. + * @param string $command The command that will need arguments + * (one of 'psql', 'pg_dump', 'mysql', + * or 'mysqldump'). + * @param array $database The database definition from the + * relationship. + * @param string|null $schema The name of a database schema, or + * null to use the default schema, or + * an empty string to not select a + * schema. * * @return string * The command line arguments (excluding the $command). */ - public function getDbCommandArgs($command, array $database) + public function getDbCommandArgs($command, array $database, $schema = null) { + if ($schema === null) { + $schema = $database['path']; + } + switch ($command) { case 'psql': case 'pg_dump': - return OsUtil::escapePosixShellArg(sprintf( - 'postgresql://%s:%s@%s:%d/%s', + $url = sprintf( + 'postgresql://%s:%s@%s:%d', $database['username'], $database['password'], $database['host'], - $database['port'], - $database['path'] - )); + $database['port'] + ); + if ($schema !== '') { + $url .= '/' . rawurlencode($schema); + } + + return OsUtil::escapePosixShellArg($url); case 'mysql': case 'mysqldump': - return sprintf( - '--user=%s --password=%s --host=%s --port=%d %s', + $args = sprintf( + '--user=%s --password=%s --host=%s --port=%d', OsUtil::escapePosixShellArg($database['username']), OsUtil::escapePosixShellArg($database['password']), OsUtil::escapePosixShellArg($database['host']), - $database['port'], - OsUtil::escapePosixShellArg($database['path']) + $database['port'] ); + if ($schema !== '') { + $args .= ' ' . OsUtil::escapePosixShellArg($schema); + } + + return $args; case 'mongo': case 'mongodump': case 'mongoexport': case 'mongorestore': $args = sprintf( - '--username %s --password %s --host %s --port %d --authenticationDatabase %s', + '--username %s --password %s --host %s --port %d', OsUtil::escapePosixShellArg($database['username']), OsUtil::escapePosixShellArg($database['password']), OsUtil::escapePosixShellArg($database['host']), - $database['port'], - OsUtil::escapePosixShellArg($database['path']) + $database['port'] ); - if ($command === 'mongo') { - $args .= ' ' . OsUtil::escapePosixShellArg($database['path']); - } else { - $args .= ' --db ' . OsUtil::escapePosixShellArg($database['path']); + if ($schema !== '') { + $args .= '--authenticationDatabase ' . OsUtil::escapePosixShellArg($schema); + if ($command === 'mongo') { + $args .= ' ' . OsUtil::escapePosixShellArg($schema); + } else { + $args .= ' --db ' . OsUtil::escapePosixShellArg($schema); + } } return $args; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.39.0/src/SiteAlias/DrushAlias.php new/platformsh-cli-3.40.0/src/SiteAlias/DrushAlias.php --- old/platformsh-cli-3.39.0/src/SiteAlias/DrushAlias.php 2019-01-18 12:39:27.000000000 +0100 +++ new/platformsh-cli-3.40.0/src/SiteAlias/DrushAlias.php 2019-02-15 17:37:35.000000000 +0100 @@ -240,10 +240,27 @@ return false; } - // The 'root' can be a relative path, relative to the home directory. - // Conveniently, the home directory is the same as the app root. + // Drush 8 (on the remote) accepts a relative path for the 'root'. + // Drush 9 (on the remote) does not accept a relative path for some + // structures of Drupal (e.g. where the Drupal root is inside the + // Composer root). + // + // Drush 9 will replace ~/ with the home directory, but Drush 8 won't. + // + // The Drush 9 relative path issue could be resolved via this PR: + // https://github.com/webflo/drupal-finder/pull/40 + // + // The CLI cannot determine the Drush version on the remote, but it + // can make a guess based on the site-local Drush version. Those + // versions may become out of sync, but this is the best we can do for + // now. Relative 'root' support in Drush 9 would solve the problem. + $version = $this->drush->getVersion(); + $root = $version !== false && version_compare($version, '9', '>=') + ? '~/' . $app->getDocumentRoot() + : $app->getDocumentRoot(); + $alias = [ - 'root' => $app->getDocumentRoot(), + 'root' => $root, 'options' => [ $this->getAutoRemoveKey() => true, ], ++++++ platformsh-cli-vendor.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php --- old/vendor/autoload.php 2019-01-18 17:06:36.218319811 +0100 +++ new/vendor/autoload.php 2019-02-15 19:10:47.282533237 +0100 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitf77d77365fc1f7ea6d2d32ddf8a94760::getLoader(); +return ComposerAutoloaderInit187161be1a32487c3bfee098262affe9::getLoader(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_real.php new/vendor/composer/autoload_real.php --- old/vendor/composer/autoload_real.php 2019-01-18 17:06:36.218319811 +0100 +++ new/vendor/composer/autoload_real.php 2019-02-15 19:10:47.282533237 +0100 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf77d77365fc1f7ea6d2d32ddf8a94760 +class ComposerAutoloaderInit187161be1a32487c3bfee098262affe9 { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf77d77365fc1f7ea6d2d32ddf8a94760', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit187161be1a32487c3bfee098262affe9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitf77d77365fc1f7ea6d2d32ddf8a94760', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit187161be1a32487c3bfee098262affe9', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit187161be1a32487c3bfee098262affe9::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit187161be1a32487c3bfee098262affe9::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiref77d77365fc1f7ea6d2d32ddf8a94760($fileIdentifier, $file); + composerRequire187161be1a32487c3bfee098262affe9($fileIdentifier, $file); } return $loader; } } -function composerRequiref77d77365fc1f7ea6d2d32ddf8a94760($fileIdentifier, $file) +function composerRequire187161be1a32487c3bfee098262affe9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_static.php new/vendor/composer/autoload_static.php --- old/vendor/composer/autoload_static.php 2019-01-18 17:06:36.218319811 +0100 +++ new/vendor/composer/autoload_static.php 2019-02-15 19:10:47.282533237 +0100 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760 +class ComposerStaticInit187161be1a32487c3bfee098262affe9 { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -201,9 +201,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitf77d77365fc1f7ea6d2d32ddf8a94760::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit187161be1a32487c3bfee098262affe9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit187161be1a32487c3bfee098262affe9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit187161be1a32487c3bfee098262affe9::$classMap; }, null, ClassLoader::class); }
