From d93b142594b837cc122b68598cc428d43e8a1c02 Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Wed, 10 Jan 2024 10:11:50 -0600 Subject: [PATCH 1/5] Dummy testing command to try out Symfony auto-complete --- composer.json | 10 +- composer.lock | 595 +++++++++++++++-------- load-application.php | 3 +- src/commands/create-development-site.php | 8 + src/commands/testing.php | 50 ++ 5 files changed, 447 insertions(+), 219 deletions(-) create mode 100644 src/commands/testing.php diff --git a/composer.json b/composer.json index d4a372ea..b46a00df 100644 --- a/composer.json +++ b/composer.json @@ -5,10 +5,10 @@ "ext-gd": "*", "amphp/http-client": "^4.6", "phpseclib/phpseclib": "^3.0", - "symfony/console": "^4.4", - "symfony/filesystem": "^4.4", - "symfony/finder": "^4.4", - "symfony/process": "^4.4" + "symfony/console": "^v6.4", + "symfony/filesystem": "^v6.4", + "symfony/finder": "^v6.4", + "symfony/process": "^v6.4" }, "require-dev": { "roave/security-advisories": "dev-latest" @@ -39,7 +39,7 @@ }, "config": { "platform": { - "php": "7.4" + "php": "8.1" } } } diff --git a/composer.lock b/composer.lock index 231cd9ab..31746bf9 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "80725ea7d5c9d59418b0659ba663159e", + "content-hash": "d41cae23c2c2d4481631336f92132c83", "packages": [ { "name": "amphp/amp", @@ -1050,53 +1050,44 @@ }, { "name": "league/uri", - "version": "6.7.2", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bf414ba956d902f5d98bf9385fcf63954f09dce5", + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5", "shasum": "" }, "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.0" + "league/uri-interfaces": "^7.3", + "php": "^8.1" }, "conflict": { "league/uri-schemes": "^1.0" }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.3.2", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "^1.1", - "phpstan/phpstan": "^1.2.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.10", - "psr/http-factory": "^1.0" - }, "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1136,8 +1127,8 @@ "support": { "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.7.2" + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.4.0" }, "funding": [ { @@ -1145,46 +1136,44 @@ "type": "github" } ], - "time": "2022-09-13T19:50:42+00:00" + "time": "2023-12-01T06:24:25+00:00" }, { "name": "league/uri-interfaces", - "version": "2.3.0", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/bd8c487ec236930f7bbc42b8d374fa882fbba0f3", + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src/" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1198,17 +1187,32 @@ "homepage": "https://nyamsprod.com" } ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", "rfc3986", "rfc3987", + "rfc6570", "uri", - "url" + "url", + "ws" ], "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.0" }, "funding": [ { @@ -1216,7 +1220,7 @@ "type": "github" } ], - "time": "2021-06-28T04:27:21+00:00" + "time": "2023-11-24T15:40:42+00:00" }, { "name": "league/uri-parser", @@ -1407,16 +1411,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.34", + "version": "3.0.35", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "56c79f16a6ae17e42089c06a2144467acc35348a" + "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/56c79f16a6ae17e42089c06a2144467acc35348a", - "reference": "56c79f16a6ae17e42089c06a2144467acc35348a", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe", + "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe", "shasum": "" }, "require": { @@ -1497,7 +1501,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.34" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.35" }, "funding": [ { @@ -1513,26 +1517,31 @@ "type": "tidelift" } ], - "time": "2023-11-27T11:13:31+00:00" + "time": "2023-12-29T01:59:53+00:00" }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1559,22 +1568,77 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + }, + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -1583,7 +1647,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1598,7 +1662,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -1612,55 +1676,53 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "symfony/console", - "version": "v4.4.49", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "url": "https://api.github.com/repos/symfony/console/zipball/0254811a143e6bc6c8deea08b589a7e68a37f625", + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -1687,8 +1749,14 @@ ], "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/console/tree/v4.4.49" + "source": "https://github.com/symfony/console/tree/v6.4.2" }, "funding": [ { @@ -1704,29 +1772,29 @@ "type": "tidelift" } ], - "time": "2022-11-05T17:10:16+00:00" + "time": "2023-12-10T16:15:48+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -1755,7 +1823,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -1771,26 +1839,26 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v4.4.42", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5" + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -1818,7 +1886,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.42" + "source": "https://github.com/symfony/filesystem/tree/v6.4.0" }, "funding": [ { @@ -1834,25 +1902,27 @@ "type": "tidelift" } ], - "time": "2022-05-20T08:49:14+00:00" + "time": "2023-07-26T17:27:13+00:00" }, { "name": "symfony/finder", - "version": "v4.4.44", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f" + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/66bd787edb5e42ff59d3523f623895af05043e4f", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f", + "url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce", + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0|^7.0" }, "type": "library", "autoload": { @@ -1880,7 +1950,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v4.4.44" + "source": "https://github.com/symfony/finder/tree/v6.4.0" }, "funding": [ { @@ -1896,7 +1966,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:35:46+00:00" + "time": "2023-10-31T17:30:12+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1981,27 +2051,24 @@ "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-mbstring", + "name": "symfony/polyfill-intl-grapheme", "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { "php": ">=7.1" }, - "provide": { - "ext-mbstring": "*" - }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { @@ -2018,7 +2085,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -2035,17 +2102,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "grapheme", + "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -2061,25 +2129,28 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-php73", + "name": "symfony/polyfill-intl-normalizer", "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { "php": ">=7.1" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -2095,7 +2166,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "classmap": [ "Resources/stubs" @@ -2115,16 +2186,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "intl", + "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -2143,22 +2216,28 @@ "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-php80", + "name": "symfony/polyfill-mbstring", "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -2174,21 +2253,14 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2198,16 +2270,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "mbstring", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -2223,25 +2296,24 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/process", - "version": "v4.4.44", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" + "reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "url": "https://api.github.com/repos/symfony/process/zipball/c4b1ef0bc80533d87a2e969806172f1c2a980241", + "reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -2269,7 +2341,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v4.4.44" + "source": "https://github.com/symfony/process/tree/v6.4.2" }, "funding": [ { @@ -2285,37 +2357,33 @@ "type": "tidelift" } ], - "time": "2022-06-27T13:16:42+00:00" + "time": "2023-12-22T16:42:54+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0", + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2325,7 +2393,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2352,7 +2423,93 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-12-26T14:02:43+00:00" + }, + { + "name": "symfony/string", + "version": "v6.4.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.4.2" }, "funding": [ { @@ -2368,7 +2525,7 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-12-10T16:15:48+00:00" } ], "packages-dev": [ @@ -2378,12 +2535,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "498a07ca22004364fc54bc909b77de792a10c127" + "reference": "b3fcb6d7942e8ad987f8cccc11bb2ba496789ce4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/498a07ca22004364fc54bc909b77de792a10c127", - "reference": "498a07ca22004364fc54bc909b77de792a10c127", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/b3fcb6d7942e8ad987f8cccc11bb2ba496789ce4", + "reference": "b3fcb6d7942e8ad987f8cccc11bb2ba496789ce4", "shasum": "" }, "conflict": { @@ -2415,9 +2572,9 @@ "athlon1600/php-proxy": "<=5.1", "athlon1600/php-proxy-app": "<=3", "austintoddj/canvas": "<=3.4.2", - "automad/automad": "<1.8", + "automad/automad": "<=1.10.9", "awesome-support/awesome-support": "<=6.0.7", - "aws/aws-sdk-php": ">=3,<3.2.1", + "aws/aws-sdk-php": "<3.288.1", "azuracast/azuracast": "<0.18.3", "backdrop/backdrop": "<1.24.2", "backpack/crud": "<3.4.9", @@ -2457,6 +2614,7 @@ "cesnet/simplesamlphp-module-proxystatistics": "<3.1", "chriskacerguis/codeigniter-restserver": "<=2.7.1", "civicrm/civicrm-core": ">=4.2,<4.2.9|>=4.3,<4.3.3", + "ckeditor/ckeditor": "<4.17", "cockpit-hq/cockpit": "<=2.6.3", "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<3.1.9", @@ -2464,7 +2622,7 @@ "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", "composer/composer": "<1.10.27|>=2,<2.2.22|>=2.3,<2.6.4", - "concrete5/concrete5": "<9.2.2", + "concrete5/concrete5": "<9.2.3", "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/contao": ">=4,<4.4.56|>=4.5,<4.9.40|>=4.10,<4.11.7|>=4.13,<4.13.21|>=5.1,<5.1.4", @@ -2472,8 +2630,9 @@ "contao/core-bundle": "<4.9.42|>=4.10,<4.13.28|>=5,<5.1.10", "contao/listing-bundle": ">=4,<4.4.8", "contao/managed-edition": "<=1.5", + "corveda/phpsandbox": "<1.3.5", "cosenary/instagram": "<=2.3", - "craftcms/cms": "<=4.4.14", + "craftcms/cms": "<=4.5.10", "croogo/croogo": "<4", "cuyz/valinor": "<0.12", "czproject/git-php": "<4.0.3", @@ -2486,7 +2645,7 @@ "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", "desperado/xml-bundle": "<=0.1.7", - "directmailteam/direct-mail": "<5.2.4", + "directmailteam/direct-mail": "<6.0.3|>=7,<7.0.3|>=8,<9.5.2", "doctrine/annotations": "<1.2.7", "doctrine/cache": "<1.3.2|>=1.4,<1.4.2", "doctrine/common": "<2.4.3|>=2.5,<2.5.1", @@ -2497,9 +2656,9 @@ "doctrine/mongodb-odm-bundle": "<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", "dolibarr/dolibarr": "<18.0.2", - "dompdf/dompdf": "<2.0.2|==2.0.2", + "dompdf/dompdf": "<2.0.4", "doublethreedigital/guest-entries": "<3.1.2", - "drupal/core": "<9.4.14|>=9.5,<9.5.8|>=10,<10.0.8", + "drupal/core": "<9.5.11|>=10,<10.0.11|>=10.1,<10.1.4", "drupal/drupal": ">=6,<6.38|>=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", "duncanmcclean/guest-entries": "<3.1.2", "dweeves/magmi": "<=0.7.24", @@ -2530,7 +2689,7 @@ "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", "ezsystems/ezplatform-user": ">=1,<1.0.1", "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.03.5.1", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.06,<=2019.03.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", "ezyang/htmlpurifier": "<4.1.1", @@ -2543,8 +2702,8 @@ "firebase/php-jwt": "<6", "fixpunkt/fp-masterquiz": "<2.2.1|>=3,<3.5.2", "fixpunkt/fp-newsletter": "<1.1.1|>=2,<2.1.2|>=2.2,<3.2.6", - "flarum/core": "<1.8", - "flarum/framework": "<1.8", + "flarum/core": "<1.8.5", + "flarum/framework": "<1.8.5", "flarum/mentions": "<1.6.3", "flarum/sticky": ">=0.1.0.0-beta14,<=0.1.0.0-beta15", "flarum/tags": "<=0.1.0.0-beta13", @@ -2564,7 +2723,7 @@ "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", "froala/wysiwyg-editor": "<3.2.7|>=4.0.1,<=4.1.1", - "froxlor/froxlor": "<2.1.0.0-beta1", + "froxlor/froxlor": "<=2.1.1", "fuel/core": "<1.8.1", "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", "gaoming13/wechat-php-sdk": "<=1.10.2", @@ -2574,7 +2733,7 @@ "getkirby/kirby": "<=2.5.12", "getkirby/panel": "<2.5.14", "getkirby/starterkit": "<=3.7.0.2", - "gilacms/gila": "<=1.11.4", + "gilacms/gila": "<=1.15.4", "gleez/cms": "<=1.2|==2", "globalpayments/php-sdk": "<2", "gogentooss/samlbase": "<1.2.7", @@ -2582,7 +2741,7 @@ "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", "gree/jose": "<2.2.1", "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<6", + "grumpydictator/firefly-iii": "<6.1.1", "gugoan/economizzer": "<=0.9.0.0-beta1", "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", @@ -2610,7 +2769,7 @@ "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", "impresscms/impresscms": "<=1.4.5", - "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.2.2", + "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.2.3", "in2code/ipandlanguageredirect": "<5.1.2", "in2code/lux": "<17.6.1|>=18,<24.0.2", "innologi/typo3-appointments": "<2.0.6", @@ -2633,6 +2792,7 @@ "joyqi/hyper-down": "<=2.4.27", "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", + "juzaweb/cms": "<=3.4", "kazist/phpwhois": "<=4.2.6", "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", @@ -2671,12 +2831,14 @@ "magento/magento1ee": ">=1,<1.14.4.3-dev", "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2.0-patch2", "maikuolan/phpmussel": ">=1,<1.6", + "mainwp/mainwp": "<=4.4.3.3", "mantisbt/mantisbt": "<=2.25.7", "marcwillmann/turn": "<0.3.3", "matyhtf/framework": "<3.0.6", "mautic/core": "<4.3", "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", "mediawiki/matomo": "<2.4.3", + "mediawiki/semantic-media-wiki": "<4.0.2", "melisplatform/melis-asset-manager": "<5.0.1", "melisplatform/melis-cms": "<5.0.1", "melisplatform/melis-front": "<5.0.1", @@ -2731,7 +2893,7 @@ "open-web-analytics/open-web-analytics": "<1.7.4", "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev", "openid/php-openid": "<2.3", - "openmage/magento-lts": "<=19.5|>=20,<=20.1", + "openmage/magento-lts": "<20.2", "opensource-workshop/connect-cms": "<1.7.2|>=2,<2.3.2", "orchid/platform": ">=9,<9.4.4|>=14.0.0.0-alpha4,<14.5", "oro/calendar-bundle": ">=4.2,<=4.2.6|>=5,<=5.0.6|>=5.1,<5.1.1", @@ -2754,6 +2916,7 @@ "pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1", "personnummer/personnummer": "<3.0.2", "phanan/koel": "<5.1.4", + "phenx/php-svg-lib": "<0.5.1", "php-mod/curl": "<2.3.2", "phpbb/phpbb": "<3.2.10|>=3.3,<3.3.1", "phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7", @@ -2765,7 +2928,7 @@ "phpoffice/phpspreadsheet": "<1.16", "phpseclib/phpseclib": "<2.0.31|>=3,<3.0.34", "phpservermon/phpservermon": "<3.6", - "phpsysinfo/phpsysinfo": "<3.2.5", + "phpsysinfo/phpsysinfo": "<3.4.3", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", @@ -2778,6 +2941,7 @@ "pimcore/perspective-editor": "<1.5.1", "pimcore/pimcore": "<11.1.1", "pixelfed/pixelfed": "<=0.11.4", + "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", "pocketmine/pocketmine-mp": "<=4.23|>=5,<5.3.1", "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", @@ -2787,7 +2951,7 @@ "prestashop/blockwishlist": ">=2,<2.1.1", "prestashop/contactform": ">=1.0.1,<4.3", "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": "<8.1.2", + "prestashop/prestashop": "<8.1.3", "prestashop/productcomments": "<5.0.2", "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", @@ -2925,8 +3089,10 @@ "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", "symfony/webhook": ">=6.3,<6.3.8", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "symphonycms/symphony-2": "<2.6.4", "t3/dce": "<0.11.5|>=2.2,<2.6.2", "t3g/svg-sanitizer": "<1.0.3", + "t3s/content-consent": "<1.0.3|>=2,<2.0.2", "tastyigniter/tastyigniter": "<3.3", "tcg/voyager": "<=1.4", "tecnickcom/tcpdf": "<6.2.22", @@ -2951,7 +3117,7 @@ "twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3", "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", - "typo3/cms-core": "<=8.7.54|>=9,<=9.5.43|>=10,<=10.4.40|>=11,<=11.5.32|>=12,<=12.4.7", + "typo3/cms-core": "<8.7.55|>=9,<9.5.44|>=10,<10.4.41|>=11,<11.5.33|>=12,<12.4.8", "typo3/cms-extbase": "<6.2.24|>=7,<7.6.8|==8.1.1", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", "typo3/cms-install": ">=12.2,<12.4.8", @@ -2964,12 +3130,12 @@ "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", "uasoft-indonesia/badaso": "<=2.9.7", - "unisharp/laravel-filemanager": "<=2.5.1", + "unisharp/laravel-filemanager": "<2.6.4", "userfrosting/userfrosting": ">=0.3.1,<4.6.3", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", "uvdesk/community-skeleton": "<=1.1.1", "vanilla/safecurl": "<0.9.2", - "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", + "verot/class.upload.php": "<=2.1.6", "vova07/yii2-fileapi-widget": "<0.1.9", "vrana/adminer": "<4.8.1", "waldhacker/hcaptcha": "<2.1.2", @@ -2985,6 +3151,8 @@ "wikibase/wikibase": "<=1.39.3", "wikimedia/parsoid": "<0.12.2", "willdurand/js-translation-bundle": "<2.1.1", + "winter/wn-backend-module": "<1.2.4", + "winter/wn-system-module": "<1.2.4", "wintercms/winter": "<1.2.3", "woocommerce/woocommerce": "<6.6", "wp-cli/wp-cli": "<2.5", @@ -3000,6 +3168,7 @@ "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": "<1.1.29", "yiisoft/yii2": "<2.0.38", + "yiisoft/yii2-authclient": "<2.2.15", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.43", "yiisoft/yii2-elasticsearch": "<2.0.5", @@ -3045,7 +3214,7 @@ "zf-commons/zfc-user": "<1.2.2", "zfcampus/zf-apigility-doctrine": "<1.0.3", "zfr/zfr-oauth2-server-module": "<0.1.2", - "zoujingli/thinkadmin": "<6.0.22" + "zoujingli/thinkadmin": "<=6.1.53" }, "default-branch": true, "type": "metapackage", @@ -3083,7 +3252,7 @@ "type": "tidelift" } ], - "time": "2023-12-06T18:04:43+00:00" + "time": "2024-01-09T18:04:23+00:00" } ], "aliases": [], @@ -3100,7 +3269,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.4" + "php": "8.1" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/load-application.php b/load-application.php index fc3c90c0..23c9dbd8 100644 --- a/load-application.php +++ b/load-application.php @@ -51,11 +51,12 @@ new Team51\Command\WPCOM_Get_Stickers(), new Team51\Command\WPCOM_Add_Sticker(), new Team51\Command\WPCOM_Remove_Sticker(), + new Team51\Command\Testing(), ) ); foreach ( $application->all() as $command ) { - $command->addOption( '--contractor', '-c', InputOption::VALUE_NONE, 'Use the contractor config file.' ); + $command->addOption( '--contractor', '-con', InputOption::VALUE_NONE, 'Use the contractor config file.' ); $command->addOption( '--dev', null, InputOption::VALUE_NONE, 'Run the CLI tool in developer mode.' ); } diff --git a/src/commands/create-development-site.php b/src/commands/create-development-site.php index 9186f377..1233ebec 100644 --- a/src/commands/create-development-site.php +++ b/src/commands/create-development-site.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; use Team51\Helper\Pressable_Connection_Helper; use function Team51\Helper\get_pressable_site_by_id; use function Team51\Helper\get_pressable_site_sftp_user_by_email; @@ -337,6 +339,12 @@ function ( $result ) use ( $pressable_site, $output ) { exit; } + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues(['json', 'xml']); + } + } + // region HELPERS /** diff --git a/src/commands/testing.php b/src/commands/testing.php new file mode 100644 index 00000000..9759f1bc --- /dev/null +++ b/src/commands/testing.php @@ -0,0 +1,50 @@ +setName( 'testing' ) + ->setDescription( 'Testing auto-complete' ) + // TODO: Update link to point to an actual doc + ->setHelp( "Testing..." ) + ->addOption( 'format', 'f', InputOption::VALUE_REQUIRED, 'The format to use (md, txt, json, xml)', 'md' ) + ->addOption( 'save', '', InputOption::VALUE_NONE, 'Save the output to a file' ) + ->addOption( 'destination', 'd', InputOption::VALUE_REQUIRED, "The path to save the output to (Only applies if --save option is set)\nIf an extension isn't specified, it will be added automatically based on the format (e.g., 'dump-commands --format=json --destination=myfile' will output to myfile.json", getcwd() . '/team51-commands' ); + + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues(['json', 'xml']); + } + if ($input->mustSuggestOptionValuesFor('destination')) { + $suggestions->suggestValues(['test1', 'test2', 'something-else']); + } + } + + protected function execute( InputInterface $input, OutputInterface $output ) { + + $output->writeln( ' It works! ' ); + + return 1; + + + } + +} From f55953381003d85ee0ec28c1deb6ab6ab157f29f Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Sat, 3 Feb 2024 04:29:54 -0600 Subject: [PATCH 2/5] First proposal for autocomplete using three commands as example --- completion.sh | 82 ++++++++++++++++++++++ load-application.php | 1 - src/commands/create-development-site.php | 28 ++++++-- src/commands/pressable-site-add-domain.php | 24 +++++++ src/commands/stats-wpcom-traffic.php | 24 +++++++ src/commands/testing.php | 50 ------------- team51-cli.php | 17 +++-- 7 files changed, 165 insertions(+), 61 deletions(-) create mode 100644 completion.sh delete mode 100644 src/commands/testing.php diff --git a/completion.sh b/completion.sh new file mode 100644 index 00000000..a971c6c3 --- /dev/null +++ b/completion.sh @@ -0,0 +1,82 @@ +#compdef team51 + +# This file is part of the Symfony package. +# +# (c) Fabien Potencier +# +# For the full copyright and license information, please view +# https://symfony.com/doc/current/contributing/code/license.html + +# +# zsh completions for team51 +# +# References: +# - https://github.com/spf13/cobra/blob/master/zsh_completions.go +# - https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Console/Resources/completion.bash +# +_sf_team51() { + local lastParam flagPrefix requestComp out comp + local -a completions + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") lastParam=${words[-1]} + + # For zsh, when completing a flag with an = (e.g., team51 -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[0]} ${words[1]} _complete --no-interaction -szsh -a1 -c$((CURRENT-1))" i="" + for w in ${words[@]}; do + w=$(printf -- '%b' "$w") + # remove quotes from typed values + quote="${w:0:1}" + if [ "$quote" = \' ]; then + w="${w%\'}" + w="${w#\'}" + elif [ "$quote" = \" ]; then + w="${w%\"}" + w="${w#\"}" + fi + # empty values are ignored + if [ ! -z "$w" ]; then + i="${i}-i${w} " + fi + done + + # Ensure at least 1 input + if [ "${i}" = "" ]; then + requestComp="${requestComp} -i\" \"" + else + requestComp="${requestComp} ${i}" + fi + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + local tab=$(printf '\t') + comp=${comp//$tab/:} + completions+=${comp} + fi + done < <(printf "%s\n" "${out[@]}") + + # Let inbuilt _describe handle completions + eval _describe "completions" completions $flagPrefix + return $? +} + +compdef _sf_team51 team51 diff --git a/load-application.php b/load-application.php index 23c9dbd8..c467a57e 100644 --- a/load-application.php +++ b/load-application.php @@ -51,7 +51,6 @@ new Team51\Command\WPCOM_Get_Stickers(), new Team51\Command\WPCOM_Add_Sticker(), new Team51\Command\WPCOM_Remove_Sticker(), - new Team51\Command\Testing(), ) ); diff --git a/src/commands/create-development-site.php b/src/commands/create-development-site.php index 1233ebec..fe176f42 100644 --- a/src/commands/create-development-site.php +++ b/src/commands/create-development-site.php @@ -31,6 +31,28 @@ protected function configure() { ->addOption( 'branch', null, InputOption::VALUE_REQUIRED, "The GitHub branch you would like to the development site to use. Defaults to 'develop'." ); } + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { + $args = $input->getArguments(); + $arg_keys = array_keys($args); + foreach( $arg_keys as $arg ) { + if ( ! in_array($arg, [ 'command' ]) ) { + $arg = '[' . $arg . ']'; + $suggestions->suggestValue( $arg ); + } + } + + $options = $input->getOptions(); + $opt_keys = array_keys($options); + foreach( $opt_keys as $opt ) { + if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { + $opt = '--' . $opt; + $suggestions->suggestValue( $opt ); + } + } + + $suggestions->suggestValue( 'Example: team51 create-development-site --siteid=123 --label=issue-1234 --temporary-clone --skip-safety-net --branch=feature-branch' . PHP_EOL ); + } + protected function execute( InputInterface $input, OutputInterface $output ) { $api_helper = new API_Helper(); @@ -339,12 +361,6 @@ function ( $result ) use ( $pressable_site, $output ) { exit; } - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { - if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues(['json', 'xml']); - } - } - // region HELPERS /** diff --git a/src/commands/pressable-site-add-domain.php b/src/commands/pressable-site-add-domain.php index 10e10e3c..e86ac75d 100644 --- a/src/commands/pressable-site-add-domain.php +++ b/src/commands/pressable-site-add-domain.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; use function Team51\Helper\add_pressable_site_domain; use function Team51\Helper\convert_pressable_site; use function Team51\Helper\get_pressable_site_by_id; @@ -72,6 +74,28 @@ protected function configure(): void { ->addOption( 'primary', null, InputOption::VALUE_NONE, 'Set the given domain as the primary one.' ); } + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { + $args = $input->getArguments(); + $arg_keys = array_keys($args); + foreach( $arg_keys as $arg ) { + if ( ! in_array($arg, [ 'command' ]) ) { + $arg = '[' . $arg . ']'; + $suggestions->suggestValue( $arg ); + } + } + + $options = $input->getOptions(); + $opt_keys = array_keys($options); + foreach( $opt_keys as $opt ) { + if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { + $opt = '--' . $opt; + $suggestions->suggestValue( $opt ); + } + } + + $suggestions->suggestValue( 'Example: team51 pressable:add-site-domain --primary https://wordpress.com' . PHP_EOL ); + } + /** * {@inheritDoc} */ diff --git a/src/commands/stats-wpcom-traffic.php b/src/commands/stats-wpcom-traffic.php index 55fe8985..4778328d 100644 --- a/src/commands/stats-wpcom-traffic.php +++ b/src/commands/stats-wpcom-traffic.php @@ -10,6 +10,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; class Get_Site_Stats extends Command { @@ -59,6 +61,28 @@ protected function configure() { ); } + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { + $args = $input->getArguments(); + $arg_keys = array_keys($args); + foreach( $arg_keys as $arg ) { + if ( ! in_array($arg, [ 'command' ]) ) { + $arg = '[' . $arg . ']'; + $suggestions->suggestValue( $arg ); + } + } + + $options = $input->getOptions(); + $opt_keys = array_keys($options); + foreach( $opt_keys as $opt ) { + if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { + $opt = '--' . $opt; + $suggestions->suggestValue( $opt ); + } + } + + $suggestions->suggestValue( 'Example: team51 stats:wpcom-traffic --csv --period=day --num=7 --date=2023-01-01' . PHP_EOL ); + } + protected function execute( InputInterface $input, OutputInterface $output ) { $api_helper = new API_Helper(); diff --git a/src/commands/testing.php b/src/commands/testing.php deleted file mode 100644 index 9759f1bc..00000000 --- a/src/commands/testing.php +++ /dev/null @@ -1,50 +0,0 @@ -setName( 'testing' ) - ->setDescription( 'Testing auto-complete' ) - // TODO: Update link to point to an actual doc - ->setHelp( "Testing..." ) - ->addOption( 'format', 'f', InputOption::VALUE_REQUIRED, 'The format to use (md, txt, json, xml)', 'md' ) - ->addOption( 'save', '', InputOption::VALUE_NONE, 'Save the output to a file' ) - ->addOption( 'destination', 'd', InputOption::VALUE_REQUIRED, "The path to save the output to (Only applies if --save option is set)\nIf an extension isn't specified, it will be added automatically based on the format (e.g., 'dump-commands --format=json --destination=myfile' will output to myfile.json", getcwd() . '/team51-commands' ); - - } - - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues(['json', 'xml']); - } - if ($input->mustSuggestOptionValuesFor('destination')) { - $suggestions->suggestValues(['test1', 'test2', 'something-else']); - } - } - - protected function execute( InputInterface $input, OutputInterface $output ) { - - $output->writeln( ' It works! ' ); - - return 1; - - - } - -} diff --git a/team51-cli.php b/team51-cli.php index 6334dc54..5615b9a7 100755 --- a/team51-cli.php +++ b/team51-cli.php @@ -76,8 +76,9 @@ function update() { } // Initialize environment. -$is_quiet = false; -$is_dev = false; +$is_quiet = false; +$is_dev = false; +$is_autocomplete = false; foreach ( $argv as $arg ) { switch ( $arg ) { @@ -88,6 +89,11 @@ function update() { case '--dev': $is_dev = true; break; + case '_complete': + $is_dev = true; + $is_quiet = true; + $is_autocomplete = true; + break; } } @@ -98,6 +104,7 @@ function update() { define( 'IS_QUIET', $is_quiet ); define( 'IS_DEV', $is_dev ); +define( 'IS_AUTOCOMPLETE', $is_autocomplete ); // Print ASCII art. print_ascii_art(); @@ -110,7 +117,9 @@ function update() { } // Update Composer. -run_command( sprintf( 'composer install -o --working-dir %s', __DIR__ ) ); -run_command( sprintf( 'composer dump-autoload -o --working-dir %s', __DIR__ ) ); +if ( ! IS_AUTOCOMPLETE ) { + run_command( sprintf( 'composer install -o --working-dir %s', __DIR__ ) ); + run_command( sprintf( 'composer dump-autoload -o --working-dir %s', __DIR__ ) ); +} require __DIR__ . '/load-application.php'; From be3a6a0010dede67910e5ccfd01f574f3961e85c Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Wed, 21 Feb 2024 09:40:54 -0600 Subject: [PATCH 3/5] Added Autocomplete trait with generic complete function and use it on all commands --- load-application.php | 19 ++++++++++-- src/commands/add-branch-protection-rules.php | 2 ++ src/commands/create-development-site.php | 26 ++-------------- src/commands/create-production-site.php | 2 ++ src/commands/create-repository.php | 2 ++ .../delete-branch-protection-rules.php | 2 ++ src/commands/deployhq-rotate-private-key.php | 2 ++ src/commands/dump-commands.php | 1 + src/commands/flickr-scrap-photostream.php | 1 + src/commands/jetpack-enable-sso.php | 2 ++ src/commands/jetpack-module-list.php | 2 ++ src/commands/jetpack-module.php | 2 ++ src/commands/jetpack-sites-with.php | 2 ++ src/commands/plugin-list-full-dump.php | 1 + src/commands/plugin-list.php | 2 ++ src/commands/plugin-search.php | 2 ++ src/commands/pressable-call-api.php | 2 ++ .../pressable-generate-oauth-token.php | 2 ++ src/commands/pressable-site-add-domain.php | 26 ++-------------- .../pressable-site-create-collaborator.php | 2 ++ src/commands/pressable-site-open-shell.php | 2 ++ src/commands/pressable-site-php-errors.php | 2 ++ .../pressable-site-rotate-passwords.php | 2 ++ ...essable-site-rotate-sftp-user-password.php | 2 ++ ...pressable-site-rotate-wp-user-password.php | 2 ++ .../pressable-site-run-wp-cli-command.php | 2 ++ src/commands/pressable-upload-site-icon.php | 1 + src/commands/remove-user.php | 2 ++ src/commands/site-list.php | 2 ++ src/commands/stats-woocommerce-orders.php | 1 + src/commands/stats-wpcom-traffic.php | 25 +-------------- src/commands/triage-graphql.php | 2 ++ src/commands/update-repository-secret.php | 2 ++ src/commands/wpcom-add-sticker.php | 2 ++ src/commands/wpcom-get-stickers.php | 2 ++ src/commands/wpcom-remove-sticker.php | 2 ++ src/helpers/autocomplete-helper.php | 31 +++++++++++++++++++ src/helpers/functions.php | 2 +- 38 files changed, 112 insertions(+), 76 deletions(-) create mode 100644 src/helpers/autocomplete-helper.php diff --git a/load-application.php b/load-application.php index c467a57e..753e5d53 100644 --- a/load-application.php +++ b/load-application.php @@ -5,12 +5,25 @@ define( 'TEAM51_CLI_ROOT_DIR', __DIR__ ); if ( getenv( 'TEAM51_CONTRACTOR' ) ) { // Add the contractor flag automatically if set through the environment. - $argv[] = '-c'; - $_SERVER['argv'][] = '-c'; + $argv[] = '-con'; + $_SERVER['argv'][] = '-con'; } require __DIR__ . '/vendor/autoload.php'; -require __DIR__ . '/src/helpers/config-loader.php'; + +// If one the arguments is --help or an auto-complete flag, skip the config-loader to avoid communicating with 1Pass +$requires_auth = true; +foreach( $argv as $arg ) { + if ( in_array( $arg, ['_complete', '-h', '--help'], true ) ) { + $requires_auth = false; + break; + } +} + +if ( $requires_auth ) { + require __DIR__ . '/src/helpers/config-loader.php'; +} + $application = new Application(); diff --git a/src/commands/add-branch-protection-rules.php b/src/commands/add-branch-protection-rules.php index b1d1cf7d..5be3e283 100644 --- a/src/commands/add-branch-protection-rules.php +++ b/src/commands/add-branch-protection-rules.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Add_Branch_Protection_Rules extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'add-branch-protection-rules'; protected function configure() { diff --git a/src/commands/create-development-site.php b/src/commands/create-development-site.php index fe176f42..5c45948e 100644 --- a/src/commands/create-development-site.php +++ b/src/commands/create-development-site.php @@ -9,8 +9,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; use Team51\Helper\Pressable_Connection_Helper; use function Team51\Helper\get_pressable_site_by_id; use function Team51\Helper\get_pressable_site_sftp_user_by_email; @@ -18,6 +16,8 @@ use function Team51\Helper\run_pressable_site_wp_cli_command; class Create_Development_Site extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'create-development-site'; protected function configure() { @@ -31,28 +31,6 @@ protected function configure() { ->addOption( 'branch', null, InputOption::VALUE_REQUIRED, "The GitHub branch you would like to the development site to use. Defaults to 'develop'." ); } - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { - $args = $input->getArguments(); - $arg_keys = array_keys($args); - foreach( $arg_keys as $arg ) { - if ( ! in_array($arg, [ 'command' ]) ) { - $arg = '[' . $arg . ']'; - $suggestions->suggestValue( $arg ); - } - } - - $options = $input->getOptions(); - $opt_keys = array_keys($options); - foreach( $opt_keys as $opt ) { - if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { - $opt = '--' . $opt; - $suggestions->suggestValue( $opt ); - } - } - - $suggestions->suggestValue( 'Example: team51 create-development-site --siteid=123 --label=issue-1234 --temporary-clone --skip-safety-net --branch=feature-branch' . PHP_EOL ); - } - protected function execute( InputInterface $input, OutputInterface $output ) { $api_helper = new API_Helper(); diff --git a/src/commands/create-production-site.php b/src/commands/create-production-site.php index 4e4e672d..ec6113e9 100644 --- a/src/commands/create-production-site.php +++ b/src/commands/create-production-site.php @@ -11,6 +11,8 @@ use function Team51\Helper\run_app_command; class Create_Production_Site extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'create-production-site'; const DEPLOYHQ_ZONE_EUROPE = 3; // UK diff --git a/src/commands/create-repository.php b/src/commands/create-repository.php index 97758738..888b4424 100644 --- a/src/commands/create-repository.php +++ b/src/commands/create-repository.php @@ -27,6 +27,8 @@ * CLI command for creating a new GitHub repository. */ class Create_Repository extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/delete-branch-protection-rules.php b/src/commands/delete-branch-protection-rules.php index f3d2ce54..950ef198 100644 --- a/src/commands/delete-branch-protection-rules.php +++ b/src/commands/delete-branch-protection-rules.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Delete_Branch_Protection_Rules extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'delete-branch-protection-rules'; protected function configure() { diff --git a/src/commands/deployhq-rotate-private-key.php b/src/commands/deployhq-rotate-private-key.php index d5633f8d..fe72a6b1 100644 --- a/src/commands/deployhq-rotate-private-key.php +++ b/src/commands/deployhq-rotate-private-key.php @@ -12,6 +12,8 @@ * CLI command for rotating private key in projects. */ final class DeployHQ_Rotate_Private_Key extends Command { + use \Team51\Helper\Autocomplete; + /** * {@inheritdoc} */ diff --git a/src/commands/dump-commands.php b/src/commands/dump-commands.php index 7df34033..4817653d 100644 --- a/src/commands/dump-commands.php +++ b/src/commands/dump-commands.php @@ -11,6 +11,7 @@ use Symfony\Component\Console\Descriptor\XmlDescriptor; class Dump_Commands extends Command { + use \Team51\Helper\Autocomplete; protected function configure() { $this diff --git a/src/commands/flickr-scrap-photostream.php b/src/commands/flickr-scrap-photostream.php index 4b37faf1..cd4d0018 100644 --- a/src/commands/flickr-scrap-photostream.php +++ b/src/commands/flickr-scrap-photostream.php @@ -22,6 +22,7 @@ */ class Flickr_Scrap_Photostream extends Command { // region FIELDS AND CONSTANTS + use \Team51\Helper\Autocomplete; /** * {@inheritdoc} diff --git a/src/commands/jetpack-enable-sso.php b/src/commands/jetpack-enable-sso.php index ab3964f0..c44f51c9 100644 --- a/src/commands/jetpack-enable-sso.php +++ b/src/commands/jetpack-enable-sso.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Jetpack_Enable_SSO extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'jetpack-enable-sso'; protected function configure() { diff --git a/src/commands/jetpack-module-list.php b/src/commands/jetpack-module-list.php index 3901d80e..477795f2 100644 --- a/src/commands/jetpack-module-list.php +++ b/src/commands/jetpack-module-list.php @@ -10,6 +10,8 @@ use Symfony\Component\Console\Helper\Table; class Jetpack_Modules extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'jetpack-module-list'; protected function configure() { diff --git a/src/commands/jetpack-module.php b/src/commands/jetpack-module.php index f5b05048..fe5b0739 100644 --- a/src/commands/jetpack-module.php +++ b/src/commands/jetpack-module.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Jetpack_Module extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'jetpack-module'; private array $settings = array( diff --git a/src/commands/jetpack-sites-with.php b/src/commands/jetpack-sites-with.php index c1916b52..a25c0cfe 100644 --- a/src/commands/jetpack-sites-with.php +++ b/src/commands/jetpack-sites-with.php @@ -12,6 +12,8 @@ class Jetpack_Sites_With extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'jetpack-sites-with'; /** diff --git a/src/commands/plugin-list-full-dump.php b/src/commands/plugin-list-full-dump.php index 0c7d56ae..22f2d7d7 100644 --- a/src/commands/plugin-list-full-dump.php +++ b/src/commands/plugin-list-full-dump.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Output\OutputInterface; class Plugin_Summary extends Command { + use \Team51\Helper\Autocomplete; protected static $defaultName = 'plugin-list-full-dump'; diff --git a/src/commands/plugin-list.php b/src/commands/plugin-list.php index 5b4105b2..b6810c38 100644 --- a/src/commands/plugin-list.php +++ b/src/commands/plugin-list.php @@ -10,6 +10,8 @@ use Symfony\Component\Console\Helper\Table; class Plugin_List extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'plugin-list'; protected function configure() { diff --git a/src/commands/plugin-search.php b/src/commands/plugin-search.php index c7cbd53c..ce1911a2 100644 --- a/src/commands/plugin-search.php +++ b/src/commands/plugin-search.php @@ -18,6 +18,8 @@ * CLI command to search all Team51 sites for a specific plugin. */ class Plugin_Search extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-call-api.php b/src/commands/pressable-call-api.php index 84ed0987..9884169b 100644 --- a/src/commands/pressable-call-api.php +++ b/src/commands/pressable-call-api.php @@ -13,6 +13,8 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; class Pressable_Call_Api extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'pressable-call-api'; private $api_helper; private $output; diff --git a/src/commands/pressable-generate-oauth-token.php b/src/commands/pressable-generate-oauth-token.php index 19df121a..a0529433 100644 --- a/src/commands/pressable-generate-oauth-token.php +++ b/src/commands/pressable-generate-oauth-token.php @@ -16,6 +16,8 @@ * CLI command for generating an OAuth token for the Pressable API. */ class Pressable_Generate_OAuth_Token extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-add-domain.php b/src/commands/pressable-site-add-domain.php index e86ac75d..21613159 100644 --- a/src/commands/pressable-site-add-domain.php +++ b/src/commands/pressable-site-add-domain.php @@ -9,8 +9,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; use function Team51\Helper\add_pressable_site_domain; use function Team51\Helper\convert_pressable_site; use function Team51\Helper\get_pressable_site_by_id; @@ -30,6 +28,8 @@ * CLI command for adding a domain to a Pressable site. */ final class Pressable_Site_Add_Domain extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** @@ -74,28 +74,6 @@ protected function configure(): void { ->addOption( 'primary', null, InputOption::VALUE_NONE, 'Set the given domain as the primary one.' ); } - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { - $args = $input->getArguments(); - $arg_keys = array_keys($args); - foreach( $arg_keys as $arg ) { - if ( ! in_array($arg, [ 'command' ]) ) { - $arg = '[' . $arg . ']'; - $suggestions->suggestValue( $arg ); - } - } - - $options = $input->getOptions(); - $opt_keys = array_keys($options); - foreach( $opt_keys as $opt ) { - if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { - $opt = '--' . $opt; - $suggestions->suggestValue( $opt ); - } - } - - $suggestions->suggestValue( 'Example: team51 pressable:add-site-domain --primary https://wordpress.com' . PHP_EOL ); - } - /** * {@inheritDoc} */ diff --git a/src/commands/pressable-site-create-collaborator.php b/src/commands/pressable-site-create-collaborator.php index 51de6011..b7bdfda0 100644 --- a/src/commands/pressable-site-create-collaborator.php +++ b/src/commands/pressable-site-create-collaborator.php @@ -18,6 +18,8 @@ * CLI command for creating a new collaborator on a Pressable site. */ class Pressable_Site_Create_Collaborator extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-open-shell.php b/src/commands/pressable-site-open-shell.php index b6672593..ccc7c151 100644 --- a/src/commands/pressable-site-open-shell.php +++ b/src/commands/pressable-site-open-shell.php @@ -23,6 +23,8 @@ * CLI command for connecting to a Pressable site via SSH/SFTP and continuing on the interactive shell. */ class Pressable_Site_Open_Shell extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-php-errors.php b/src/commands/pressable-site-php-errors.php index b22deb97..b8146d21 100644 --- a/src/commands/pressable-site-php-errors.php +++ b/src/commands/pressable-site-php-errors.php @@ -21,6 +21,8 @@ * CLI command for getting PHP errors from a Pressable site. */ class Pressable_Site_PHP_Errors extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-rotate-passwords.php b/src/commands/pressable-site-rotate-passwords.php index 903a1832..f2bd317d 100644 --- a/src/commands/pressable-site-rotate-passwords.php +++ b/src/commands/pressable-site-rotate-passwords.php @@ -24,6 +24,8 @@ * CLI command for rotating the SFTP and WP user passwords of a given user on Pressable sites. */ final class Pressable_Site_Rotate_Passwords extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-rotate-sftp-user-password.php b/src/commands/pressable-site-rotate-sftp-user-password.php index 41c06072..f1c720ce 100644 --- a/src/commands/pressable-site-rotate-sftp-user-password.php +++ b/src/commands/pressable-site-rotate-sftp-user-password.php @@ -26,6 +26,8 @@ * CLI command for rotating the SFTP password of users on Pressable sites. */ final class Pressable_Site_Rotate_SFTP_User_Password extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-rotate-wp-user-password.php b/src/commands/pressable-site-rotate-wp-user-password.php index 1b13ce86..5f726a6e 100644 --- a/src/commands/pressable-site-rotate-wp-user-password.php +++ b/src/commands/pressable-site-rotate-wp-user-password.php @@ -36,6 +36,8 @@ * CLI command for rotating the WP password of users on Pressable sites. */ final class Pressable_Site_Rotate_WP_User_Password extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-site-run-wp-cli-command.php b/src/commands/pressable-site-run-wp-cli-command.php index daf4a1b6..fc63d236 100644 --- a/src/commands/pressable-site-run-wp-cli-command.php +++ b/src/commands/pressable-site-run-wp-cli-command.php @@ -18,6 +18,8 @@ * CLI command for running a WP-CLI command on a Pressable site. */ final class Pressable_Site_Run_WP_CLI_Command extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/pressable-upload-site-icon.php b/src/commands/pressable-upload-site-icon.php index e2f2a47c..2fe60d54 100644 --- a/src/commands/pressable-upload-site-icon.php +++ b/src/commands/pressable-upload-site-icon.php @@ -17,6 +17,7 @@ * CLI command for uploading the site icon as apple-touch-icon.png on a Pressable site. */ final class Pressable_Site_Upload_Icon extends Command { + use \Team51\Helper\Autocomplete; /** * {@inheritdoc} diff --git a/src/commands/remove-user.php b/src/commands/remove-user.php index 1e3fb34a..1f5d995a 100644 --- a/src/commands/remove-user.php +++ b/src/commands/remove-user.php @@ -12,6 +12,8 @@ use Team51\Helper\WPCOM_API_Helper; class Remove_User extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'remove-user'; private $api_helper; private $output; diff --git a/src/commands/site-list.php b/src/commands/site-list.php index 3e92f449..dbf8c217 100644 --- a/src/commands/site-list.php +++ b/src/commands/site-list.php @@ -12,6 +12,8 @@ use Symfony\Component\Console\Helper\ProgressBar; class Site_List extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'site-list'; protected function configure() { diff --git a/src/commands/stats-woocommerce-orders.php b/src/commands/stats-woocommerce-orders.php index 1d6b3133..8d34b9c0 100644 --- a/src/commands/stats-woocommerce-orders.php +++ b/src/commands/stats-woocommerce-orders.php @@ -12,6 +12,7 @@ use Symfony\Component\Console\Helper\ProgressBar; class Get_WooCommerce_Stats extends Command { + use \Team51\Helper\Autocomplete; protected static $defaultName = 'stats:woocommerce-orders'; diff --git a/src/commands/stats-wpcom-traffic.php b/src/commands/stats-wpcom-traffic.php index 4778328d..885a02f7 100644 --- a/src/commands/stats-wpcom-traffic.php +++ b/src/commands/stats-wpcom-traffic.php @@ -10,10 +10,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; class Get_Site_Stats extends Command { + use \Team51\Helper\Autocomplete; protected static $defaultName = 'stats:wpcom-traffic'; @@ -61,28 +60,6 @@ protected function configure() { ); } - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { - $args = $input->getArguments(); - $arg_keys = array_keys($args); - foreach( $arg_keys as $arg ) { - if ( ! in_array($arg, [ 'command' ]) ) { - $arg = '[' . $arg . ']'; - $suggestions->suggestValue( $arg ); - } - } - - $options = $input->getOptions(); - $opt_keys = array_keys($options); - foreach( $opt_keys as $opt ) { - if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { - $opt = '--' . $opt; - $suggestions->suggestValue( $opt ); - } - } - - $suggestions->suggestValue( 'Example: team51 stats:wpcom-traffic --csv --period=day --num=7 --date=2023-01-01' . PHP_EOL ); - } - protected function execute( InputInterface $input, OutputInterface $output ) { $api_helper = new API_Helper(); diff --git a/src/commands/triage-graphql.php b/src/commands/triage-graphql.php index f1f01b54..34211739 100644 --- a/src/commands/triage-graphql.php +++ b/src/commands/triage-graphql.php @@ -8,6 +8,8 @@ use Symfony\Component\Console\Output\OutputInterface; class Triage_GraphQL extends Command { + use \Team51\Helper\Autocomplete; + protected static $defaultName = 'triage'; const TRIAGE_STATUS = '🆕 Needs Triaged'; diff --git a/src/commands/update-repository-secret.php b/src/commands/update-repository-secret.php index 51ed3dec..8dda099f 100644 --- a/src/commands/update-repository-secret.php +++ b/src/commands/update-repository-secret.php @@ -20,6 +20,8 @@ * CLI command for updating a GitHub repository secret. */ class Update_Repository_Secret extends Command { + use \Team51\Helper\Autocomplete; + // region FIELDS AND CONSTANTS /** diff --git a/src/commands/wpcom-add-sticker.php b/src/commands/wpcom-add-sticker.php index 69a49b99..2f679673 100644 --- a/src/commands/wpcom-add-sticker.php +++ b/src/commands/wpcom-add-sticker.php @@ -14,6 +14,8 @@ use function Team51\Helper\get_string_input; final class WPCOM_Add_Sticker extends Command { + use \Team51\Helper\Autocomplete; + /** * {@inheritdoc} */ diff --git a/src/commands/wpcom-get-stickers.php b/src/commands/wpcom-get-stickers.php index 38f86d3a..1a36c254 100644 --- a/src/commands/wpcom-get-stickers.php +++ b/src/commands/wpcom-get-stickers.php @@ -14,6 +14,8 @@ use function Team51\Helper\get_wpcom_site_from_input; final class WPCOM_Get_Stickers extends Command { + use \Team51\Helper\Autocomplete; + /** * {@inheritdoc} */ diff --git a/src/commands/wpcom-remove-sticker.php b/src/commands/wpcom-remove-sticker.php index 1f0a9b39..f000bc97 100644 --- a/src/commands/wpcom-remove-sticker.php +++ b/src/commands/wpcom-remove-sticker.php @@ -14,6 +14,8 @@ use function Team51\Helper\get_string_input; final class WPCOM_Remove_Sticker extends Command { + use \Team51\Helper\Autocomplete; + /** * {@inheritdoc} */ diff --git a/src/helpers/autocomplete-helper.php b/src/helpers/autocomplete-helper.php new file mode 100644 index 00000000..1b3e70fe --- /dev/null +++ b/src/helpers/autocomplete-helper.php @@ -0,0 +1,31 @@ +getArguments(); + $arg_keys = array_keys($args); + foreach( $arg_keys as $arg ) { + if ( ! in_array($arg, [ 'command' ]) ) { + $arg = $arg; + $suggestions->suggestValue( $arg ); + } + } + + $options = $input->getOptions(); + $opt_keys = array_keys($options); + foreach( $opt_keys as $opt ) { + if ( ! in_array($opt, ['ansi', 'contractor', 'help', 'no-interaction', 'version', 'verbose', 'quiet', 'dev']) ) { + $opt = '--' . $opt; + $suggestions->suggestValue( $opt ); + } + } + + return; + } +} diff --git a/src/helpers/functions.php b/src/helpers/functions.php index 5c489bf6..ddc7cdec 100644 --- a/src/helpers/functions.php +++ b/src/helpers/functions.php @@ -216,7 +216,7 @@ function generate_random_password( int $length = 24, bool $special_chars = true * @return bool */ function is_contractor_mode(): bool { - return \in_array( '-c', $_SERVER['argv'], true ) + return \in_array( '-con', $_SERVER['argv'], true ) || \in_array( '--contractor', $_SERVER['argv'], true ); } From eae6cb45b447f8abb262db85a8d4b70e6c9ef891 Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Wed, 10 Apr 2024 15:42:18 -0600 Subject: [PATCH 4/5] Return int value on execute() functions of all commands. Also added int return type and changed. --- src/commands/add-branch-protection-rules.php | 18 ++++++++++-------- src/commands/create-development-site.php | 4 ++-- src/commands/create-production-site.php | 4 ++-- src/commands/create-repository.php | 6 +++--- .../delete-branch-protection-rules.php | 4 +++- src/commands/deployhq-rotate-private-key.php | 2 +- src/commands/dump-commands.php | 5 +++-- src/commands/flickr-scrap-photostream.php | 16 ++++++++-------- src/commands/jetpack-enable-sso.php | 4 +++- src/commands/jetpack-module-list.php | 3 ++- src/commands/jetpack-module.php | 4 +++- src/commands/jetpack-sites-with.php | 3 ++- src/commands/plugin-list-full-dump.php | 3 ++- src/commands/plugin-list.php | 3 ++- src/commands/plugin-search.php | 4 ++-- src/commands/pressable-call-api.php | 6 ++++-- .../pressable-generate-oauth-token.php | 2 +- src/commands/pressable-site-add-domain.php | 10 +++++----- .../pressable-site-create-collaborator.php | 4 +++- src/commands/pressable-site-open-shell.php | 8 ++++---- src/commands/pressable-site-php-errors.php | 12 ++++++------ .../pressable-site-rotate-passwords.php | 2 +- ...ressable-site-rotate-sftp-user-password.php | 2 +- .../pressable-site-rotate-wp-user-password.php | 2 +- .../pressable-site-run-wp-cli-command.php | 4 ++-- src/commands/pressable-upload-site-icon.php | 16 ++++++++-------- src/commands/remove-user.php | 4 +++- src/commands/site-list.php | 4 +++- src/commands/stats-woocommerce-orders.php | 4 +++- src/commands/stats-wpcom-traffic.php | 4 +++- src/commands/triage-graphql.php | 6 ++++-- src/commands/update-repository-secret.php | 2 +- src/commands/wpcom-add-sticker.php | 4 +++- src/commands/wpcom-get-stickers.php | 6 ++++-- src/commands/wpcom-remove-sticker.php | 4 +++- 35 files changed, 111 insertions(+), 78 deletions(-) diff --git a/src/commands/add-branch-protection-rules.php b/src/commands/add-branch-protection-rules.php index 5be3e283..41dce185 100644 --- a/src/commands/add-branch-protection-rules.php +++ b/src/commands/add-branch-protection-rules.php @@ -20,12 +20,12 @@ protected function configure() { ->addArgument( 'repo-slug', InputArgument::REQUIRED, "Repository name in slug form (e.g. client-name)?" ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper; - $slug = $input->getArgument( 'repo-slug' ); + $slug = $input->getArgument( 'repo-slug' ); - // TODO: Allow these rules to be managed via the config.json file. + // TODO: Allow these rules to be managed via the config.json file. $branch_protection_rules = array ( 'required_status_checks' => array ( @@ -42,10 +42,12 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $output->writeln( "Adding branch protection rules to $slug." ); $branch_protection_rules = $api_helper->call_github_api( "repos/" . GITHUB_API_OWNER . "/$slug/branches/trunk/protection", $branch_protection_rules, 'PUT' ); - if ( ! empty( $branch_protection_rules->required_status_checks->contexts ) ) { - $output->writeln( "Done. Added branch protection rules to $slug." ); - } else { - $output->writeln( "Failed to add branch protection rules to $slug." ); - } + if ( ! empty( $branch_protection_rules->required_status_checks->contexts ) ) { + $output->writeln( "Done. Added branch protection rules to $slug." ); + } else { + $output->writeln( "Failed to add branch protection rules to $slug." ); + } + + return Command::SUCCESS; } } diff --git a/src/commands/create-development-site.php b/src/commands/create-development-site.php index 5c45948e..cb1bb45f 100644 --- a/src/commands/create-development-site.php +++ b/src/commands/create-development-site.php @@ -31,7 +31,7 @@ protected function configure() { ->addOption( 'branch', null, InputOption::VALUE_REQUIRED, "The GitHub branch you would like to the development site to use. Defaults to 'develop'." ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper(); $production_site_id = $input->getOption( 'site-id' ); @@ -336,7 +336,7 @@ function ( $result ) use ( $pressable_site, $output ) { ) ); - exit; + return Command::SUCCESS; } // region HELPERS diff --git a/src/commands/create-production-site.php b/src/commands/create-production-site.php index ec6113e9..96b83db2 100644 --- a/src/commands/create-production-site.php +++ b/src/commands/create-production-site.php @@ -34,7 +34,7 @@ protected function configure() { ->addOption( 'template-id', null, InputOption::VALUE_OPTIONAL, 'The template that will be used while creating the project on DeployHQ. By default the DEPLOYHQ_DEFAULT_PROJECT_TEMPLATE config param is used.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper(); $manual_task_notices = array(); @@ -335,7 +335,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) { ) ); - exit; + return Command::SUCCESS; } // Convert a text string to something ready to be used as a unique, machine-friendly identifier diff --git a/src/commands/create-repository.php b/src/commands/create-repository.php index 888b4424..f01ef667 100644 --- a/src/commands/create-repository.php +++ b/src/commands/create-repository.php @@ -237,7 +237,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $repository = create_github_repository_from_template( GITHUB_API_OWNER, $this->repo_slug, GITHUB_API_OWNER, "team51-$this->repo_type-scaffold", $this->repo_description ); if ( \is_null( $repository ) ) { $output->writeln( "Failed to create $this->repo_slug repository from template. Aborting!" ); - return 1; + return Command::FAILURE; } $repository = update_github_repository( @@ -254,7 +254,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in ); if ( \is_null( $repository ) ) { $output->writeln( "Failed to update $this->repo_slug repository. Aborting!" ); - return 1; + return Command::FAILURE; } $output->writeln( "Successfully created $this->repo_slug repository from template." ); @@ -394,7 +394,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in ); } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/delete-branch-protection-rules.php b/src/commands/delete-branch-protection-rules.php index 950ef198..dc962a19 100644 --- a/src/commands/delete-branch-protection-rules.php +++ b/src/commands/delete-branch-protection-rules.php @@ -20,7 +20,7 @@ protected function configure() { ->addArgument( 'repo-slug', InputArgument::REQUIRED, "Repository name in slug form (e.g. client-name)?" ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper; $slug = $input->getArgument( 'repo-slug' ); @@ -33,5 +33,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } else { $output->writeln( "Failed to delete branch protection rules for $slug: {$delete_branch_protection_rules->message}" ); } + + return Command::SUCCESS; } } diff --git a/src/commands/deployhq-rotate-private-key.php b/src/commands/deployhq-rotate-private-key.php index fe72a6b1..1ec56b06 100644 --- a/src/commands/deployhq-rotate-private-key.php +++ b/src/commands/deployhq-rotate-private-key.php @@ -57,6 +57,6 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output->writeln( "{$project->permalink}: Done!" ); } - return 0; + return Command::SUCCESS; } } diff --git a/src/commands/dump-commands.php b/src/commands/dump-commands.php index 4817653d..78bb8907 100644 --- a/src/commands/dump-commands.php +++ b/src/commands/dump-commands.php @@ -25,18 +25,19 @@ protected function configure() { } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { try { $descriptor = $this->get_descriptor( $input->getOption( 'format' ) ); } catch ( \Exception $e ) { $output->writeln( '' . $e->getMessage() . '' ); - return; + return Command::FAILURE; } $stream = $this->set_output_stream( $input, $output ); $descriptor->describe( $stream, $this->getApplication() ); + return Command::SUCCESS; } private function get_descriptor( $format ) { diff --git a/src/commands/flickr-scrap-photostream.php b/src/commands/flickr-scrap-photostream.php index cd4d0018..d7e68cf1 100644 --- a/src/commands/flickr-scrap-photostream.php +++ b/src/commands/flickr-scrap-photostream.php @@ -91,7 +91,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $photosets = get_flickr_photosets_for_user( $this->flickr_user_id ); if ( \is_null( $photosets ) ) { $output->writeln( 'Failed to fetch photosets from Flickr.' ); - return 1; + return Command::FAILURE; } $photosets_data_directory = TEAM51_CLI_ROOT_DIR . "/flickr/$this->flickr_user_id/photosets"; @@ -123,7 +123,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in ); if ( \is_null( $photoset_photos ) ) { $output->writeln( "Failed to fetch photos from Flickr. Photoset error: $photoset->id" ); - return 1; + return Command::FAILURE; } $photos[] = $photoset_photos->photo; @@ -165,7 +165,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in ); if ( \is_null( $photos ) ) { $output->writeln( "Failed to fetch photos from Flickr. Page error: $current_page" ); - return 1; + return Command::FAILURE; } $progress_bar = new ProgressBar( $output, \min( $this->limit ?? PHP_INT_MAX, \count( $photos->photo ) ) ); @@ -189,7 +189,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $comments = get_flickr_comments_for_photo( $photo->id ); if ( \is_null( $comments ) ) { $output->writeln( "Failed to fetch comments from Flickr. Photo error: $photo->id" ); - return 1; + return Command::FAILURE; } \file_put_contents( @@ -204,7 +204,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $media_sizes = get_flickr_photo_sizes( $photo->id ); if ( \is_null( $media_sizes ) ) { $output->writeln( "Failed to fetch file sizes. Media error: $photo->id" ); - return 1; + return Command::FAILURE; } foreach ( $media_sizes->size as $size ) { @@ -218,12 +218,12 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $media_file = \file_get_contents( $media_url ); if ( empty( $media_file ) ) { $output->writeln( "Failed to download media. Meida error: $photo->id, Media URL: $media_url" ); - return 1; + return Command::FAILURE; } if ( false === \file_put_contents( $media_data_directory . '/media.' . $photo->originalformat, $media_file ) ) { $output->writeln( "Failed to save media. Media error: $photo->id" ); - return 1; + return Command::FAILURE; } if ( $this->limit ) { @@ -242,7 +242,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $has_next_page = 0 !== $this->limit && $photos->page < $photos->pages; } while ( $has_next_page ); - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/jetpack-enable-sso.php b/src/commands/jetpack-enable-sso.php index c44f51c9..bb7be798 100644 --- a/src/commands/jetpack-enable-sso.php +++ b/src/commands/jetpack-enable-sso.php @@ -20,7 +20,7 @@ protected function configure() { ->addArgument( 'site-domain', InputArgument::REQUIRED, 'The domain of the Jetpack connected site.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $site_domain = $input->getArgument( 'site-domain' ); $api_helper = new API_Helper(); @@ -56,5 +56,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } $output->writeln( 'All done! :)' ); + + return Command::SUCCESS; } } diff --git a/src/commands/jetpack-module-list.php b/src/commands/jetpack-module-list.php index 477795f2..3d102fb0 100644 --- a/src/commands/jetpack-module-list.php +++ b/src/commands/jetpack-module-list.php @@ -21,7 +21,7 @@ protected function configure() { ->addArgument( 'site-domain', InputArgument::REQUIRED, 'The domain of the Jetpack connected site.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $site_domain = $input->getArgument( 'site-domain' ); $api_helper = new API_Helper; @@ -56,5 +56,6 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $module_table->setRows( $module_list ); $module_table->render(); + return Command::SUCCESS; } } diff --git a/src/commands/jetpack-module.php b/src/commands/jetpack-module.php index fe5b0739..2b3813b8 100644 --- a/src/commands/jetpack-module.php +++ b/src/commands/jetpack-module.php @@ -27,7 +27,7 @@ protected function configure() { ->addArgument( 'setting', InputArgument::REQUIRED, 'enable/disable' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $site_domain = $input->getArgument( 'site-domain' ); $module = $input->getArgument( 'module' ); $setting = $input->getArgument( 'setting' ); @@ -70,6 +70,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } $output->writeln( 'All done! :)' ); + + return Command::SUCCESS; } /** diff --git a/src/commands/jetpack-sites-with.php b/src/commands/jetpack-sites-with.php index a25c0cfe..620722c7 100644 --- a/src/commands/jetpack-sites-with.php +++ b/src/commands/jetpack-sites-with.php @@ -35,7 +35,7 @@ protected function configure() { ->addArgument( 'module-status', InputArgument::OPTIONAL, 'The status of the Jetpack module to search for.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $module_slug = strtolower( $input->getArgument( 'module-slug' ) ); $module_status = strtolower( $input->getArgument( 'module-status' ) ); $validation_run = true; @@ -133,6 +133,7 @@ function ( $site ) use ( $module_status ) { $output->writeln( 'All done! :)' ); + return Command::SUCCESS; } private function get_list_of_modules( $site_id ) { diff --git a/src/commands/plugin-list-full-dump.php b/src/commands/plugin-list-full-dump.php index 22f2d7d7..d9a24bb3 100644 --- a/src/commands/plugin-list-full-dump.php +++ b/src/commands/plugin-list-full-dump.php @@ -28,7 +28,7 @@ protected function configure() { ->setDescription( 'Dumps a CSV of all plugins on on all t51 sites, including activation status' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper(); @@ -108,6 +108,7 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $output->writeln( 'Done, CSV saved to your current working directory: plugins-on-t51-sites-' . $timestamp . '.csv' ); + return Command::SUCCESS; } // Helper functions, getting list of plugins and getting woocommerce stats diff --git a/src/commands/plugin-list.php b/src/commands/plugin-list.php index b6810c38..60027262 100644 --- a/src/commands/plugin-list.php +++ b/src/commands/plugin-list.php @@ -21,7 +21,7 @@ protected function configure() { ->addArgument( 'site-domain', InputArgument::REQUIRED, 'The domain of the Jetpack connected site.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $site_domain = $input->getArgument( 'site-domain' ); $api_helper = new API_Helper; @@ -56,5 +56,6 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $plugin_table->setRows( $plugin_list ); $plugin_table->render(); + return Command::SUCCESS; } } diff --git a/src/commands/plugin-search.php b/src/commands/plugin-search.php index ce1911a2..48a0e01d 100644 --- a/src/commands/plugin-search.php +++ b/src/commands/plugin-search.php @@ -86,7 +86,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $sites = get_wpcom_jetpack_sites(); if ( empty( $sites ) ) { $output->writeln( 'Failed to fetch sites.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'Successfully fetched ' . count( $sites ) . ' Jetpack sites.', OutputInterface::VERBOSITY_VERBOSE ); @@ -133,7 +133,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $this->output_not_checked_site_list( $sites_not_checked, $output ); } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-call-api.php b/src/commands/pressable-call-api.php index 9884169b..3a29a22b 100644 --- a/src/commands/pressable-call-api.php +++ b/src/commands/pressable-call-api.php @@ -47,13 +47,13 @@ private function get_question_helper(): QuestionHelper { * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $this->api_helper = new API_Helper(); $this->output = $output; if ( ! in_array( $input->getOption( 'format' ), array( 'text', 'json' ), true ) ) { $this->output->writeln( 'Invalid output format' ); - return; + return Command::FAILURE; } $this->format = $input->getOption( 'format' ); @@ -61,6 +61,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $this->handle_api_call( $input, $output ); $output->writeln( "\nAll done!" ); + + return Command::SUCCESS; } /*********************************** diff --git a/src/commands/pressable-generate-oauth-token.php b/src/commands/pressable-generate-oauth-token.php index a0529433..e2a5f4b6 100644 --- a/src/commands/pressable-generate-oauth-token.php +++ b/src/commands/pressable-generate-oauth-token.php @@ -84,7 +84,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in ) . PHP_EOL ); - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-add-domain.php b/src/commands/pressable-site-add-domain.php index 21613159..7d01fe4e 100644 --- a/src/commands/pressable-site-add-domain.php +++ b/src/commands/pressable-site-add-domain.php @@ -133,7 +133,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $result = convert_pressable_site( $this->pressable_site->id ); if ( \is_null( $result ) ) { $output->writeln( 'Failed to convert staging site to live site.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'Converted staging site to live site.' ); @@ -147,7 +147,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $site_domains = add_pressable_site_domain( $this->pressable_site->id, $this->new_domain ); if ( \is_null( $site_domains ) ) { $output->writeln( 'Failed to add domain to site.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'Domain added to site.' ); @@ -157,7 +157,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $new_domain = $this->find_domain_object( $site_domains ); if ( \is_null( $new_domain ) ) { $output->writeln( 'Failed to find the newly added domain in the list of site domains.' ); - return 1; + return Command::FAILURE; } // Set the new domain as the primary domain. @@ -169,7 +169,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $new_domain = set_pressable_site_primary_domain( $this->pressable_site->id, $new_domain->id ); if ( \is_null( $new_domain ) ) { $output->writeln( 'Failed to set primary domain.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'Domain set as primary.' ); @@ -228,7 +228,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in } } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-create-collaborator.php b/src/commands/pressable-site-create-collaborator.php index b7bdfda0..79cbe5fb 100644 --- a/src/commands/pressable-site-create-collaborator.php +++ b/src/commands/pressable-site-create-collaborator.php @@ -53,7 +53,7 @@ protected function initialize( InputInterface $input, OutputInterface $output ): * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { // Handle if searching by domain or using the passed site name. if ( $input->getOption( 'search' ) ) { $this->handle_search_for_site( $input, $output ); @@ -62,6 +62,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } $output->writeln( "\nAll done!" ); + + return Command::SUCCESS; } /*********************************** diff --git a/src/commands/pressable-site-open-shell.php b/src/commands/pressable-site-open-shell.php index ccc7c151..27dead4e 100644 --- a/src/commands/pressable-site-open-shell.php +++ b/src/commands/pressable-site-open-shell.php @@ -117,7 +117,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $sftp_user = create_pressable_site_collaborator( $this->user_email, $this->pressable_site->id ); if ( \is_null( $sftp_user ) ) { $output->writeln( "Could not create a Pressable SFTP user with the email $this->user_email on {$this->pressable_site->displayName}." ); - return 1; + return Command::FAILURE; } // SFTP users are different from collaborator users. We need to query the API again to get the SFTP user. @@ -131,7 +131,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $result = reset_pressable_site_sftp_user_password( $this->pressable_site->id, $sftp_user->username ); if ( \is_null( $result ) ) { $output->writeln( "Could not reset the SFTP password of $sftp_user->email on {$this->pressable_site->displayName}." ); - return 1; + return Command::FAILURE; } $output->writeln( "New SFTP user password: $result" ); @@ -146,10 +146,10 @@ protected function execute( InputInterface $input, OutputInterface $output ): in } if ( ! \is_null( \passthru( "$this->shell_type $ssh_host", $result_code ) ) ) { $output->writeln( "Could not open an interactive $this->shell_type shell. Error code: $result_code" ); - return 1; + return Command::FAILURE; } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-php-errors.php b/src/commands/pressable-site-php-errors.php index b8146d21..297ed31a 100644 --- a/src/commands/pressable-site-php-errors.php +++ b/src/commands/pressable-site-php-errors.php @@ -109,7 +109,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $ssh_connection = Pressable_Connection_Helper::get_ssh_connection( $this->pressable_site->id ); if ( \is_null( $ssh_connection ) ) { $output->writeln( "Failed to connect via SSH for {$this->pressable_site->url}. Aborting!" ); - return 1; + return Command::FAILURE; } $output->writeln( 'Finding the PHP error log location.', OutputInterface::VERBOSITY_VERBOSE ); @@ -118,7 +118,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $error_log_path = $ssh_connection->exec( 'wp eval "echo ini_get(\'error_log\');"' ); if ( empty( $error_log_path ) ) { $output->writeln( "Failed to find the PHP error log location for {$this->pressable_site->url}. Aborting!" ); - return 1; + return Command::FAILURE; } $output->writeln( "Found the PHP error log location: $error_log_path", OutputInterface::VERBOSITY_DEBUG ); @@ -134,13 +134,13 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output->writeln( "The PHP error log for {$this->pressable_site->url} appears to be empty. Go make some errors and try again!" ); } - return 1; + return Command::FAILURE; } // Output the raw log if requested in said format. if ( 'raw' === $this->format ) { $this->output_raw_error_log( $error_log, $output ); - return 0; + return Command::SUCCESS; } // Parse the error log for the most recent fatal errors. @@ -149,7 +149,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $php_errors = $this->parse_error_log( $error_log ); if ( 0 === count( $php_errors ) ) { $output->writeln( "The PHP error log for {$this->pressable_site->url} appears to be empty. Go make some errors and try again!" ); - return 0; + return Command::SUCCESS; } $stats_table = $this->analyze_error_entries( $php_errors ); @@ -165,7 +165,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in break; } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-rotate-passwords.php b/src/commands/pressable-site-rotate-passwords.php index f2bd317d..85db086f 100644 --- a/src/commands/pressable-site-rotate-passwords.php +++ b/src/commands/pressable-site-rotate-passwords.php @@ -172,7 +172,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output ); - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-rotate-sftp-user-password.php b/src/commands/pressable-site-rotate-sftp-user-password.php index f1c720ce..0b2a1c90 100644 --- a/src/commands/pressable-site-rotate-sftp-user-password.php +++ b/src/commands/pressable-site-rotate-sftp-user-password.php @@ -204,7 +204,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output->writeln( "New SFTP user password: $new_pressable_sftp_password" ); } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-rotate-wp-user-password.php b/src/commands/pressable-site-rotate-wp-user-password.php index 5f726a6e..450dcc61 100644 --- a/src/commands/pressable-site-rotate-wp-user-password.php +++ b/src/commands/pressable-site-rotate-wp-user-password.php @@ -193,7 +193,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output->writeln( 'WP user password updated in 1Password.' ); } - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-site-run-wp-cli-command.php b/src/commands/pressable-site-run-wp-cli-command.php index fc63d236..7eff117e 100644 --- a/src/commands/pressable-site-run-wp-cli-command.php +++ b/src/commands/pressable-site-run-wp-cli-command.php @@ -103,7 +103,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $ssh = Pressable_Connection_Helper::get_ssh_connection( $this->pressable_site->id ); if ( \is_null( $ssh ) ) { $output->writeln( 'Could not connect to the SSH server.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'SSH connection established.', OutputInterface::VERBOSITY_VERBOSE ); @@ -116,7 +116,7 @@ static function( string $str ): void { } ); - return 0; + return Command::SUCCESS; } // endregion diff --git a/src/commands/pressable-upload-site-icon.php b/src/commands/pressable-upload-site-icon.php index 2fe60d54..d492c6c3 100644 --- a/src/commands/pressable-upload-site-icon.php +++ b/src/commands/pressable-upload-site-icon.php @@ -76,20 +76,20 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $sftp = Pressable_Connection_Helper::get_sftp_connection( $this->pressable_site->id ); if ( \is_null( $sftp ) ) { $output->writeln( 'Could not connect to the SFTP server.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'SFTP connection established.', OutputInterface::VERBOSITY_VERBOSE ); if ( $sftp->file_exists( 'apple-touch-icon.png' ) ) { $output->writeln( 'apple-touch-icon.png already exists. Aborting.' ); - return 1; + return Command::FAILURE; } $ssh = Pressable_Connection_Helper::get_ssh_connection( $this->pressable_site->id ); if ( \is_null( $ssh ) ) { $output->writeln( 'Could not connect to the SSH server.' ); - return 1; + return Command::FAILURE; } $output->writeln( 'SSH connection established.', OutputInterface::VERBOSITY_VERBOSE ); @@ -101,7 +101,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) { $output->writeln( 'Site has no icon set. Aborting.' ); $output->writeln( "Error with URL: $url", OutputInterface::VERBOSITY_VERY_VERBOSE ); - return 1; + return Command::FAILURE; } $output->writeln( "Site icon URL: $url", OutputInterface::VERBOSITY_VERBOSE ); @@ -110,13 +110,13 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $file_data = \file_get_contents( $url ); if ( false === $file_data ) { $output->writeln( 'Could not download the site icon. Aborting.' ); - return 1; + return Command::FAILURE; } $image = $this->process_image( $file_data, $output ); if ( false === $image ) { $output->writeln( 'Could not process the site icon. Aborting.' ); - return 1; + return Command::FAILURE; } // If site icon is set and downloaded successfully, upload it to the site. @@ -132,7 +132,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in if ( false === $result ) { $output->writeln( 'Could not upload the site icon.' ); - return 1; + return Command::FAILURE; } if ( ! $this->dry_run ) { @@ -140,7 +140,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in $output->writeln( "URL: https://{$this->pressable_site->url}/apple-touch-icon.png", OutputInterface::VERBOSITY_VERBOSE ); } - return 0; + return Command::SUCCESS; } /** diff --git a/src/commands/remove-user.php b/src/commands/remove-user.php index 1f5d995a..446bdd79 100644 --- a/src/commands/remove-user.php +++ b/src/commands/remove-user.php @@ -26,7 +26,7 @@ protected function configure() { ->addOption( 'list', null, InputOption::VALUE_NONE, 'List the sites where this email is found.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $this->api_helper = new API_Helper(); $this->output = $output; @@ -139,6 +139,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { // TODO: Remove user from Github too? $output->writeln( 'All done!' ); + + return Command::SUCCESS; } /** diff --git a/src/commands/site-list.php b/src/commands/site-list.php index dbf8c217..0c09ed00 100644 --- a/src/commands/site-list.php +++ b/src/commands/site-list.php @@ -25,7 +25,7 @@ protected function configure() { ->addOption( 'exclude', null, InputOption::VALUE_OPTIONAL, "Optional.\nExclude columns from the export option. Possible values: Site Name, Domain, Site ID, and Host. Letter case is not important.\nExample usage:\nsite-list csv-export --exclude='Site name, Host'\nsite-list json-export --exclude='site id,host'\n" ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper; $audit = false; @@ -217,6 +217,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { $this->create_json( $final_site_list, $atomic_count, $pressable_count, $simple_count, $other_count, $filtered_site_count, $json_ex_columns ); $output->writeln( 'Exported to sites.json in the current folder.' ); } + + return Command::SUCCESS; } protected function eval_which_host( $site, $pressable_sites ) { diff --git a/src/commands/stats-woocommerce-orders.php b/src/commands/stats-woocommerce-orders.php index 8d34b9c0..15c46ef5 100644 --- a/src/commands/stats-woocommerce-orders.php +++ b/src/commands/stats-woocommerce-orders.php @@ -59,7 +59,7 @@ protected function configure() { ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $plugin_slug = 'woocommerce'; $api_helper = new API_Helper(); @@ -271,6 +271,8 @@ function ( $carry, $site ) { } $output->writeln( 'All done! :)' ); + + return Command::SUCCESS; } // Helper functions, getting list of plugins and getting woocommerce stats diff --git a/src/commands/stats-wpcom-traffic.php b/src/commands/stats-wpcom-traffic.php index 885a02f7..c5c34aa1 100644 --- a/src/commands/stats-wpcom-traffic.php +++ b/src/commands/stats-wpcom-traffic.php @@ -60,7 +60,7 @@ protected function configure() { ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $api_helper = new API_Helper(); // error if the unir or date options are not set @@ -244,6 +244,8 @@ function ( $carry, $site ) { } $output->writeln( 'All done! :)' ); + + return Command::SUCCESS; } // Helper functions, getting site stats diff --git a/src/commands/triage-graphql.php b/src/commands/triage-graphql.php index 34211739..27048aee 100644 --- a/src/commands/triage-graphql.php +++ b/src/commands/triage-graphql.php @@ -21,10 +21,10 @@ protected function configure() { ->setHelp( 'Scans the triage column to find due dates in the near future.' ); } - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { if ( ! defined( 'GITHUB_DEVQUEUE_PROJECT_ID' ) ) { $output->writeln( 'GITHUB_DEVQUEUE_PROJECT_ID not set in config.' ); - return; + return Command::FAILURE; } $api_helper = new API_Helper(); @@ -115,6 +115,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { ) ); } + + return Command::SUCCESS; } private function query( string $project_id, string $after = '', int $per_page = 100 ) { diff --git a/src/commands/update-repository-secret.php b/src/commands/update-repository-secret.php index 8dda099f..b6852a53 100644 --- a/src/commands/update-repository-secret.php +++ b/src/commands/update-repository-secret.php @@ -174,7 +174,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in } } - return 0; + return Command::SUCCESS; } /** diff --git a/src/commands/wpcom-add-sticker.php b/src/commands/wpcom-add-sticker.php index 2f679673..0d7a00e7 100644 --- a/src/commands/wpcom-add-sticker.php +++ b/src/commands/wpcom-add-sticker.php @@ -76,7 +76,7 @@ protected function initialize( InputInterface $input, OutputInterface $output ): /** * {@inheritDoc} */ - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $response = WPCOM_API_Helper::call_api( sprintf( WPCOM_ADD_STICKER_URL, $this->wpcom_site->ID, $this->sticker ), 'POST' @@ -87,6 +87,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } else { $output->writeln( "Couldn't add `{$this->sticker}` on site `{$this->wpcom_site->ID}`" ); } + + return Command::SUCCESS; } /** diff --git a/src/commands/wpcom-get-stickers.php b/src/commands/wpcom-get-stickers.php index 1a36c254..3defa3a8 100644 --- a/src/commands/wpcom-get-stickers.php +++ b/src/commands/wpcom-get-stickers.php @@ -58,14 +58,14 @@ protected function initialize( InputInterface $input, OutputInterface $output ): /** * {@inheritDoc} */ - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $stickers = WPCOM_API_Helper::call_api( sprintf( WPCOM_GET_STICKERS_URL, $this->wpcom_site->ID ) ); if ( empty( $stickers ) ) { $output->writeln( 'Site has no stickers associated.' ); - exit; + return Command::FAILURE; } $sticker_table = new Table( $output ); @@ -74,6 +74,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { ->setHeaders( array( "ID: {$this->wpcom_site->ID} ({$this->wpcom_site->URL})" ) ) ->setRows( array_map( fn ( $sticker ) => array( $sticker ), $stickers ) ) ->render(); + + return Command::SUCCESS; } /** diff --git a/src/commands/wpcom-remove-sticker.php b/src/commands/wpcom-remove-sticker.php index f000bc97..f5ce0144 100644 --- a/src/commands/wpcom-remove-sticker.php +++ b/src/commands/wpcom-remove-sticker.php @@ -76,7 +76,7 @@ protected function initialize( InputInterface $input, OutputInterface $output ): /** * {@inheritDoc} */ - protected function execute( InputInterface $input, OutputInterface $output ) { + protected function execute( InputInterface $input, OutputInterface $output ): int { $response = WPCOM_API_Helper::call_api( sprintf( WPCOM_REMOVE_STICKER_URL, $this->wpcom_site->ID, $this->sticker ), 'POST' @@ -87,6 +87,8 @@ protected function execute( InputInterface $input, OutputInterface $output ) { } else { $output->writeln( "Couldn't remove `{$this->sticker}` on site `{$this->wpcom_site->ID}`" ); } + + return Command::SUCCESS; } /** From c5978c9d9a8024e2a6253ab0a3d526ecc74e5912 Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Thu, 11 Apr 2024 08:29:50 -0600 Subject: [PATCH 5/5] Updated a couple of returned responses from failure to success or invalid --- src/commands/pressable-call-api.php | 2 +- src/commands/wpcom-get-stickers.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/pressable-call-api.php b/src/commands/pressable-call-api.php index 3a29a22b..31c34159 100644 --- a/src/commands/pressable-call-api.php +++ b/src/commands/pressable-call-api.php @@ -53,7 +53,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in if ( ! in_array( $input->getOption( 'format' ), array( 'text', 'json' ), true ) ) { $this->output->writeln( 'Invalid output format' ); - return Command::FAILURE; + return Command::INVALID; } $this->format = $input->getOption( 'format' ); diff --git a/src/commands/wpcom-get-stickers.php b/src/commands/wpcom-get-stickers.php index 3defa3a8..996763b6 100644 --- a/src/commands/wpcom-get-stickers.php +++ b/src/commands/wpcom-get-stickers.php @@ -65,7 +65,7 @@ protected function execute( InputInterface $input, OutputInterface $output ): in if ( empty( $stickers ) ) { $output->writeln( 'Site has no stickers associated.' ); - return Command::FAILURE; + return Command::SUCCESS; } $sticker_table = new Table( $output );