Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2020-08-19 18:56:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Wed Aug 19 18:56:30 2020 rev:104 rq:827692 version:3.62.0 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2020-08-14 10:05:34.221355028 +0200 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new.3399/platformsh-cli.changes 2020-08-19 18:57:37.551872755 +0200 @@ -1,0 +2,11 @@ +Tue Aug 18 22:37:26 UTC 2020 - [email protected] + +- Update to version 3.62.0: + * Release v3.62.0 + * Apply feature flag to the --force-invite option + * Handle mongodb URIs in relationships (#975) + * Show the stderr of every shell command, if in debug mode (#972) + * Retry fetching the activity log stream (#973) + * Support force-sending an invitation (#976) + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.61.0.tar.xz New: ---- platformsh-cli-3.62.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.lKJSLe/_old 2020-08-19 18:57:39.551873818 +0200 +++ /var/tmp/diff_new_pack.lKJSLe/_new 2020-08-19 18:57:39.555873820 +0200 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.61.0 +Version: 3.62.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.lKJSLe/_old 2020-08-19 18:57:39.591873840 +0200 +++ /var/tmp/diff_new_pack.lKJSLe/_new 2020-08-19 18:57:39.595873842 +0200 @@ -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.61.0</param> + <param name="revision">refs/tags/v3.62.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.lKJSLe/_old 2020-08-19 18:57:39.619873854 +0200 +++ /var/tmp/diff_new_pack.lKJSLe/_new 2020-08-19 18:57:39.619873854 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">8e6262a3ef2ec7b2b16a6675fb34fc2300489f46</param> + <param name="changesrevision">01e939e5285acfb3eaf69a1ac6f2e42ce4c7b9dc</param> </service> </servicedata> ++++++ licenses.txt ++++++ --- /var/tmp/diff_new_pack.lKJSLe/_old 2020-08-19 18:57:39.667873880 +0200 +++ /var/tmp/diff_new_pack.lKJSLe/_new 2020-08-19 18:57:39.671873882 +0200 @@ -16,7 +16,7 @@ padraic/phar-updater v1.0.6 BSD-3-Clause paragonie/random_compat v2.0.18 MIT pjcdawkins/guzzle-oauth2-plugin v2.3.1 MIT -platformsh/client v0.37.2 MIT +platformsh/client 0.38.1 MIT platformsh/console-form v0.0.24 MIT psr/container 1.0.0 MIT psr/log 1.1.3 MIT ++++++ platformsh-cli-3.61.0.tar.xz -> platformsh-cli-3.62.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/composer.json new/platformsh-cli-3.62.0/composer.json --- old/platformsh-cli-3.61.0/composer.json 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/composer.json 2020-08-18 00:08:04.000000000 +0200 @@ -8,7 +8,7 @@ "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", "platformsh/console-form": ">=0.0.24 <2.0", - "platformsh/client": ">=0.37.2 <2.0", + "platformsh/client": ">=0.38.1 <2.0", "symfony/console": "^3.0 >=3.2", "symfony/yaml": "^3.0 || ^2.6", "symfony/finder": "^3.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/composer.lock new/platformsh-cli-3.62.0/composer.lock --- old/platformsh-cli-3.61.0/composer.lock 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/composer.lock 2020-08-18 00:08:04.000000000 +0200 @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "622a98f40b55807f6d8bb25538914875", + "content-hash": "a18b032106e42883b145cc8981c2be62", "packages": [ { "name": "cocur/slugify", @@ -290,6 +290,7 @@ "Guzzle", "cache" ], + "abandoned": true, "time": "2019-09-16T13:44:55+00:00" }, { @@ -665,16 +666,16 @@ }, { "name": "platformsh/client", - "version": "v0.37.2", + "version": "0.38.1", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "2f63f43d16faa370895f90f1e6febd5519e2664d" + "reference": "2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2f63f43d16faa370895f90f1e6febd5519e2664d", - "reference": "2f63f43d16faa370895f90f1e6febd5519e2664d", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3", + "reference": "2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3", "shasum": "" }, "require": { @@ -704,7 +705,7 @@ } ], "description": "Platform.sh API client", - "time": "2020-08-05T09:08:05+00:00" + "time": "2020-08-17T14:52:55+00:00" }, { "name": "platformsh/console-form", @@ -2656,6 +2657,7 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2017-12-04T08:55:13+00:00" }, { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/dist/manifest.json new/platformsh-cli-3.62.0/dist/manifest.json --- old/platformsh-cli-3.61.0/dist/manifest.json 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/dist/manifest.json 2020-08-18 00:08:04.000000000 +0200 @@ -17,10 +17,10 @@ }, { "name": "platform.phar", - "sha1": "93f8a19ff692c19e60e07494a484ea613affef24", - "sha256": "6f5114c2a27a3d4631d857cf938eda184bbb431568bfbf006958a6dd3526323f", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.61.0/platform.phar", - "version": "3.61.0", + "sha1": "214e3b502a811eed1ffa0ef2448fafe007feed24", + "sha256": "268164bb583dec30862098ccf9cc96cf9c998f54cb5bb01c34a58dd7715a7841", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.62.0/platform.phar", + "version": "3.62.0", "php": { "min": "5.5.9" }, @@ -294,6 +294,11 @@ "notes": "New features:\n\n* Project choice will now be via an autocomplete, rather than a list, if there\n are too many to list (more than 25, or more than the terminal height). Start\n typing a project ID, or use the up and down arrows to scroll through the\n autocomplete suggestions.\n* Similarly, the environment choice can now be via a list, if there are few\n enough to display like that, otherwise the older autocomplete will show.\n* The installer now supports a proxy defined with one of the `https_proxy` or\n `http_proxy` environment variables.\n\nOther changes:\n\n* Use --globoff by default in curl commands\n* Disable use of the SSH agent unless explicitly enabled in the user config file.\n Add this to the user config file to automatically add keys/certificates to the SSH agent:\n ```yaml\n # ~/.platformsh/config.yaml\n api:\n add_to_ssh_agent: true\n ```\n* Explicitly request the `offline_access` scope when logging in.\n* Add a comment to auto-generated temporary SSH keys.", "show from": "3.60.0", "hide from": "3.61.0" + }, + { + "notes": "* Support force-sending an invitation in the `user:add` command (via a prompt,\n or the `--force-invite` option).\n* Retry fetching the activity log stream to avoid errors when an activity is starting.\n* Show the stderr of every shell command, if in debug mode (`-vvv`).\n* Handle multi-host mongodb URIs in relationships.", + "show from": "3.61.0", + "hide from": "3.62.0" } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/src/Command/User/UserAddCommand.php new/platformsh-cli-3.62.0/src/Command/User/UserAddCommand.php --- old/platformsh-cli-3.61.0/src/Command/User/UserAddCommand.php 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/src/Command/User/UserAddCommand.php 2020-08-18 00:08:04.000000000 +0200 @@ -26,6 +26,11 @@ ->addArgument('email', InputArgument::OPTIONAL, "The user's email address"); $this->addRoleOption(); + + if ($this->config()->getWithDefault('api.invitations', false)) { + $this->addOption('force-invite', null, InputOption::VALUE_NONE, 'Send an invitation, even if one has already been sent'); + } + $this->addProjectOption(); $this->addWaitOptions(); @@ -272,12 +277,17 @@ $environments[] = new Environment($id, $role); } try { - $project->inviteUserByEmail($email, $desiredProjectRole, $environments); + $project->inviteUserByEmail($email, $desiredProjectRole, $environments, $input->getOption('force-invite')); $this->stdErr->writeln(''); $this->stdErr->writeln(sprintf('An invitation has been sent to <info>%s</info>', $email)); } catch (AlreadyInvitedException $e) { $this->stdErr->writeln(''); $this->stdErr->writeln(sprintf('An invitation has already been sent to <info>%s</info>', $e->getEmail())); + if ($questionHelper->confirm('Do you want to send this invitation anyway?')) { + $project->inviteUserByEmail($email, $desiredProjectRole, $environments, true); + $this->stdErr->writeln(''); + $this->stdErr->writeln(sprintf('A new invitation has been sent to <info>%s</info>', $email)); + } } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/src/Service/ActivityMonitor.php new/platformsh-cli-3.62.0/src/Service/ActivityMonitor.php --- old/platformsh-cli-3.61.0/src/Service/ActivityMonitor.php 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/src/Service/ActivityMonitor.php 2020-08-18 00:08:04.000000000 +0200 @@ -100,7 +100,7 @@ $bar->setFormat('[%bar%] %elapsed:6s% (%state%)'); $bar->start(); - $logStream = $this->getLogStream($activity); + $logStream = $this->getLogStream($activity, $bar); $bar->advance(); // Read the log while waiting for the activity to complete. @@ -426,16 +426,30 @@ * Returns the activity log as a PHP stream resource. * * @param Activity $activity + * @param ProgressBar $bar + * Progress bar, updated when we retry. * * @return resource */ - private function getLogStream(Activity $activity) { + private function getLogStream(Activity $activity, ProgressBar $bar) { $url = $activity->getLink('log'); - $stream = fopen($url, 'r', false, $this->api->getStreamContext()); - if ($stream === false) { - throw new \RuntimeException('Failed to open stream: ' . $url); + + // Try fetching the stream with a 10 second timeout per call, and a .5 + // second interval between calls, for up to 30 seconds. + $readTimeout = 10; + $interval = .5; + $stream = \fopen($url, 'r', false, $this->api->getStreamContext($readTimeout)); + $start = \microtime(true); + while ($stream === false) { + if (\microtime(true) - $start > 30) { + throw new \RuntimeException('Failed to open activity log stream: ' . $url); + } + $bar->advance(); + \usleep($interval * 1000000); + $bar->advance(); + $stream = \fopen($url, 'r', false, $this->api->getStreamContext($readTimeout)); } - stream_set_blocking($stream, 0); + \stream_set_blocking($stream, 0); return $stream; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/src/Service/Api.php new/platformsh-cli-3.62.0/src/Service/Api.php --- old/platformsh-cli-3.61.0/src/Service/Api.php 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/src/Service/Api.php 2020-08-18 00:08:04.000000000 +0200 @@ -474,14 +474,16 @@ /** * Constructs a stream context for using the API with stream functions. * + * @param int|float $timeout + * * @return resource */ - public function getStreamContext() { + public function getStreamContext($timeout = 15) { $opts = [ 'http' => [ 'method' => 'GET', 'follow_location' => 0, - 'timeout' => 15, + 'timeout' => $timeout, 'user_agent' => $this->getUserAgent(), 'header' => [ 'Authorization: Bearer ' . $this->getAccessToken(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/src/Service/Relationships.php new/platformsh-cli-3.62.0/src/Service/Relationships.php --- old/platformsh-cli-3.61.0/src/Service/Relationships.php 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/src/Service/Relationships.php 2020-08-18 00:08:04.000000000 +0200 @@ -174,7 +174,47 @@ */ public function getRelationships(HostInterface $host, $refresh = false) { - return $this->envVarService->getArrayEnvVar('RELATIONSHIPS', $host, $refresh); + return $this->normalizeRelationships( + $this->envVarService->getArrayEnvVar('RELATIONSHIPS', $host, $refresh) + ); + } + + /** + * Normalizes relationships that have weird output in the API. + * + * If only real-life relationships were this simple. + * + * @param array $relationships + * + * @return array + */ + private function normalizeRelationships(array $relationships) + { + foreach ($relationships as &$relationship) { + foreach ($relationship as &$instance) { + // If there is a "host" which is actually a full MongoDB + // multi-instance URI such a mongodb://hostname1,hostname2,hostname3:1234/path?query + // then this converts it into a valid URL (selecting just the + // first hostname), and parses that to populate the instance + // definition. + if (isset($instance['scheme']) && isset($instance['host']) + && $instance['scheme'] === 'mongodb' && strpos($instance['host'], 'mongodb://') === 0) { + $mongodbUri = $instance['host']; + $url = \preg_replace_callback('#^(mongodb://)([^/?]+)([/?]|$)#', function ($matches) { + return $matches[1] . \explode(',', $matches[2])[0] . $matches[3]; + }, $mongodbUri); + $urlParts = \parse_url($url); + if ($urlParts) { + $instance = array_merge($urlParts, $instance); + // Fix the "host" to be a hostname. + $instance['host'] = $urlParts['host']; + // Set the "url" as the original "host". + $instance['url'] = $mongodbUri; + } + } + } + } + return $relationships; } /** @@ -282,12 +322,17 @@ public function buildUrl(array $instance) { $parts = $instance; + // Convert to parse_url parts. - $parts['user'] = $parts['username']; - $parts['pass'] = $parts['password']; + if (isset($parts['username'])) { + $parts['user'] = $parts['username']; + } + if (isset($parts['password'])) { + $parts['pass'] = $parts['password']; + } unset($parts['username'], $parts['password']); // The 'query' is expected to be a string. - if (is_array($parts['query'])) { + if (isset($parts['query']) && is_array($parts['query'])) { unset($parts['query']['is_master']); $parts['query'] = (new Query($parts['query']))->__toString(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.61.0/src/Service/Shell.php new/platformsh-cli-3.62.0/src/Service/Shell.php --- old/platformsh-cli-3.61.0/src/Service/Shell.php 2020-08-13 13:27:12.000000000 +0200 +++ new/platformsh-cli-3.62.0/src/Service/Shell.php 2020-08-18 00:08:04.000000000 +0200 @@ -124,13 +124,16 @@ $blankLine = true; } - // Blank line just to aid debugging. + // Conditional blank line just to aid debugging. if ($blankLine) { $this->stdErr->writeln('', OutputInterface::VERBOSITY_VERBOSE); } $result = $this->runProcess($process, $mustRun, $quiet); + // Another blank line after the command output ends. + $this->stdErr->writeln('', OutputInterface::VERBOSITY_VERBOSE); + return is_int($result) ? $result === 0 : $result; } @@ -216,8 +219,14 @@ protected function runProcess(Process $process, $mustRun = false, $quiet = true) { try { - $process->mustRun($quiet ? null : function ($type, $buffer) { - $output = $type === Process::ERR ? $this->stdErr : $this->output; + $process->mustRun(function ($type, $buffer) use ($quiet) { + $output = $type === Process::ERR ? $this->output : $this->stdErr; + if ($quiet) { + // Always show stderr output in debug mode. + if ($type !== Process::ERR || !$output->isDebug()) { + return; + } + } $output->write(preg_replace('/^/m', ' ', $buffer)); }); } catch (ProcessFailedException $e) { ++++++ 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 2020-08-13 20:32:07.793394032 +0200 +++ new/vendor/autoload.php 2020-08-19 00:37:30.162054503 +0200 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitf33106493991023d7e9aa3a168d1ea0f::getLoader(); +return ComposerAutoloaderInit5db2f2fae7409a3711582bdd8205ecdf::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 2020-08-13 20:32:07.793394032 +0200 +++ new/vendor/composer/autoload_real.php 2020-08-19 00:37:30.162054503 +0200 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf33106493991023d7e9aa3a168d1ea0f +class ComposerAutoloaderInit5db2f2fae7409a3711582bdd8205ecdf { private static $loader; @@ -22,15 +22,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf33106493991023d7e9aa3a168d1ea0f', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit5db2f2fae7409a3711582bdd8205ecdf', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitf33106493991023d7e9aa3a168d1ea0f', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit5db2f2fae7409a3711582bdd8205ecdf', '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\ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -51,19 +51,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiref33106493991023d7e9aa3a168d1ea0f($fileIdentifier, $file); + composerRequire5db2f2fae7409a3711582bdd8205ecdf($fileIdentifier, $file); } return $loader; } } -function composerRequiref33106493991023d7e9aa3a168d1ea0f($fileIdentifier, $file) +function composerRequire5db2f2fae7409a3711582bdd8205ecdf($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 2020-08-13 20:32:07.793394032 +0200 +++ new/vendor/composer/autoload_static.php 2020-08-19 00:37:30.162054503 +0200 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f +class ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -193,9 +193,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitf33106493991023d7e9aa3a168d1ea0f::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit5db2f2fae7409a3711582bdd8205ecdf::$classMap; }, null, ClassLoader::class); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/installed.json new/vendor/composer/installed.json --- old/vendor/composer/installed.json 2020-08-13 20:32:07.141387931 +0200 +++ new/vendor/composer/installed.json 2020-08-19 00:37:29.738051731 +0200 @@ -293,7 +293,8 @@ "keywords": [ "Guzzle", "cache" - ] + ], + "abandoned": true }, { "name": "guzzlehttp/guzzle", @@ -682,17 +683,17 @@ }, { "name": "platformsh/client", - "version": "v0.37.2", - "version_normalized": "0.37.2.0", + "version": "0.38.1", + "version_normalized": "0.38.1.0", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "2f63f43d16faa370895f90f1e6febd5519e2664d" + "reference": "2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2f63f43d16faa370895f90f1e6febd5519e2664d", - "reference": "2f63f43d16faa370895f90f1e6febd5519e2664d", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3", + "reference": "2d9a5b05f5dddb9e078f0a53bcde1701ca39ffd3", "shasum": "" }, "require": { @@ -706,7 +707,7 @@ "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2020-08-05T09:08:05+00:00", + "time": "2020-08-17T14:52:55+00:00", "type": "library", "installation-source": "dist", "autoload": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Model/Project.php new/vendor/platformsh/client/src/Model/Project.php --- old/vendor/platformsh/client/src/Model/Project.php 2020-08-05 11:08:05.000000000 +0200 +++ new/vendor/platformsh/client/src/Model/Project.php 2020-08-17 16:52:55.000000000 +0200 @@ -142,17 +142,20 @@ * The user's role on the project ('viewer' or 'admin'). * @param InvitationEnvironment[] $environments * A list of environments for the invitation. Only used if the project role is not 'admin'. + * @param bool $force + * Whether to re-send the invitation, if an invitation has already been sent to the same email address. * - * @throws AlreadyInvitedException if there is a pending invitation open with the same details + * @throws AlreadyInvitedException if there is a pending invitation for the same email address * * @return ProjectInvitation */ - public function inviteUserByEmail($email, $role, array $environments = []) + public function inviteUserByEmail($email, $role, array $environments = [], $force = false) { $data = [ 'email' => $email, 'role' => $role, 'environments' => InvitationEnvironment::listForApi($environments), + 'force' => $force, ]; $request = $this->client->createRequest('post', $this->getLink('invitations'), ['json' => $data]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Model/User.php new/vendor/platformsh/client/src/Model/User.php --- old/vendor/platformsh/client/src/Model/User.php 1970-01-01 01:00:00.000000000 +0100 +++ new/vendor/platformsh/client/src/Model/User.php 2020-08-17 16:52:55.000000000 +0200 @@ -0,0 +1,25 @@ +<?php + +namespace Platformsh\Client\Model; + +/** + * Account information for a Platform.sh user. + * + * @property-read string $id + * @property-read string $email + * @property-read string $username + * @property-read string $first_name + * @property-read string $last_name + * @property-read string $picture + * @property-read string $country + * @property-read string $company + * @property-read string $website + * @property-read bool $deactivated + * @property-read bool $email_verified + * @property-read bool $mfa_enabled + * @property-read string $created_at + * @property-read string $updated_at + */ +class User extends Resource +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/PlatformClient.php new/vendor/platformsh/client/src/PlatformClient.php --- old/vendor/platformsh/client/src/PlatformClient.php 2020-08-05 11:08:05.000000000 +0200 +++ new/vendor/platformsh/client/src/PlatformClient.php 2020-08-17 16:52:55.000000000 +0200 @@ -15,6 +15,7 @@ use Platformsh\Client\Model\SetupOptions; use Platformsh\Client\Model\SshKey; use Platformsh\Client\Model\Subscription; +use Platformsh\Client\Model\User; class PlatformClient { @@ -72,6 +73,16 @@ return $this->getProjectDirect($id, $hostname, $https); } + // Use the API gateway. + $apiUrl = $this->connector->getApiUrl(); + if ($apiUrl) { + $project = Project::get($id, $apiUrl . '/projects', $this->connector->getClient()); + if ($project) { + $project->setApiUrl($apiUrl); + } + return $project; + } + // Use the project locator. if ($url = $this->locateProject($id)) { $project = Project::get($url, null, $this->connector->getClient()); @@ -112,6 +123,14 @@ /** * Get account information for the logged-in user. * + * This information includes various integrated details such as the + * projects the user can access, their registered SSH keys, and legacy + * information. + * + * For purely user profile related information, getUser() is recommended. + * + * @see PlatformClient::getUser() + * * @param bool $reset * * @return array @@ -168,7 +187,7 @@ protected function locateProject($id) { $client = $this->connector->getClient(); - $url = $this->apiUrl() . '/projects/' . rawurlencode($id); + $url = rtrim($this->connector->getAccountsEndpoint(), '/') . '/projects/' . rawurlencode($id); try { $result = (array) $client->get($url)->json(); } @@ -422,4 +441,23 @@ return SetupOptions::create($options, $url, $this->connector->getClient()); } + + /** + * Get a user account. + * + * @param string|null $id + * The user ID. Defaults to the current user's ID. + * + * @return User|false + */ + public function getUser($id = null) + { + if (!$this->connector->getApiUrl()) { + throw new \RuntimeException('No API URL configured'); + } + if ($id === null) { + $id = $this->getAccountInfo()['id']; + } + return User::get($id, $this->connector->getApiUrl() . '/users', $this->connector->getClient()); + } }
