From d3df0ff1d31d10a8e794c8bb2a738d39b248e47f Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 09:01:20 +0000 Subject: [PATCH 1/6] Add phpstan check in woodpecker ci --- .woodpecker/.phpunit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index 63309d0928..0a748821ff 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -77,6 +77,9 @@ steps: else phpunit --configuration tests/phpunit.xml -d memory_limit=-1; fi + - if [ "${PHP_MAJOR_VERSION}" = "8.2" ]; then + bin/composer.phar run phpstan + fi codecov: image: friendicaci/codecov when: From 2b6cc5378f81680b9b047802f32a6d75b0ac7908 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 09:17:07 +0000 Subject: [PATCH 2/6] Fix command, move it to top --- .woodpecker/.phpunit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index 0a748821ff..22502376a6 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -67,6 +67,9 @@ steps: MEMCACHED_HOST: "memcached" MEMCACHE_HOST: "memcached" commands: + - if [ "${PHP_MAJOR_VERSION}" = "8.2" ]; then + bin/composer.phar run phpstan; + fi - cp config/local-sample.config.php config/local.config.php - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql @@ -77,9 +80,6 @@ steps: else phpunit --configuration tests/phpunit.xml -d memory_limit=-1; fi - - if [ "${PHP_MAJOR_VERSION}" = "8.2" ]; then - bin/composer.phar run phpstan - fi codecov: image: friendicaci/codecov when: From fca8de40a179587e935d989e34c7fccfca8d7646 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 10:37:48 +0000 Subject: [PATCH 3/6] Remove dependency for twitter addon --- src/Module/Debug/Babel.php | 49 ++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index e7852847f6..095ed38633 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -234,41 +234,32 @@ class Babel extends BaseModule case 'twitter': $json = trim($request['text']); - if (file_exists('addon/twitter/twitter.php')) { - require_once 'addon/twitter/twitter.php'; + $status = json_decode($json); - $status = json_decode($json); + $results[] = [ + 'title' => DI::l10n()->t('Decoded post'), + 'content' => $visible_whitespace(var_export($status, true)), + ]; - $results[] = [ - 'title' => DI::l10n()->t('Decoded post'), - 'content' => $visible_whitespace(var_export($status, true)), - ]; + $postarray = []; + $postarray['object-type'] = Activity\ObjectType::NOTE; - $postarray = []; - $postarray['object-type'] = Activity\ObjectType::NOTE; - - if (!empty($status->full_text)) { - $postarray['body'] = $status->full_text; - } else { - $postarray['body'] = $status->text; - } - - // When the post contains links then use the correct object type - if (count($status->entities->urls) > 0) { - $postarray['object-type'] = Activity\ObjectType::BOOKMARK; - } - - $results[] = [ - 'title' => DI::l10n()->t('Post array before expand entities'), - 'content' => $visible_whitespace(var_export($postarray, true)), - ]; + if (!empty($status->full_text)) { + $postarray['body'] = $status->full_text; } else { - $results[] = [ - 'title' => DI::l10n()->tt('Error', 'Errors', 1), - 'content' => DI::l10n()->t('Twitter addon is absent from the addon/ folder.'), - ]; + $postarray['body'] = $status->text; } + // When the post contains links then use the correct object type + if (count($status->entities->urls) > 0) { + $postarray['object-type'] = Activity\ObjectType::BOOKMARK; + } + + $results[] = [ + 'title' => DI::l10n()->t('Post array before expand entities'), + 'content' => $visible_whitespace(var_export($postarray, true)), + ]; + break; } } From 84048617c93dd5de80730dfacfa9e043c606fd80 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 10:41:14 +0000 Subject: [PATCH 4/6] Remove phpstan ignored errors --- src/Core/Cache/Type/APCuCache.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Core/Cache/Type/APCuCache.php b/src/Core/Cache/Type/APCuCache.php index 5564a1e793..f1dde2462c 100644 --- a/src/Core/Cache/Type/APCuCache.php +++ b/src/Core/Cache/Type/APCuCache.php @@ -41,7 +41,6 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory $ns = $this->getCacheKey($prefix ?? ''); $ns = preg_quote($ns, '/'); - /** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */ $iterator = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); $keys = []; @@ -119,7 +118,6 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory $prefix = $this->getPrefix(); $prefix = preg_quote($prefix, '/'); - /** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */ $iterator = new \APCUIterator('/^' . $prefix . '/', APC_ITER_KEY); return apcu_delete($iterator); From 6909f5cba67fb22ffb3471307bf3b763324357c4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 12:22:39 +0000 Subject: [PATCH 5/6] Recreate lang --- view/lang/C/messages.po | 112 +++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 7c69b8d946..01da0d4ed7 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2024.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 07:44+0000\n" +"POT-Creation-Date: 2024-11-16 12:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -292,8 +292,8 @@ msgstr "" #: mod/photos.php:1152 mod/photos.php:1232 #: src/Module/Calendar/Event/Form.php:236 src/Module/Contact/Advanced.php:118 #: src/Module/Contact/Profile.php:371 -#: src/Module/Debug/ActivityPubConversion.php:124 -#: src/Module/Debug/Babel.php:283 src/Module/Debug/Localtime.php:50 +#: src/Module/Debug/ActivityPubConversion.php:128 +#: src/Module/Debug/Babel.php:279 src/Module/Debug/Localtime.php:50 #: src/Module/Debug/Probe.php:40 src/Module/Debug/WebFinger.php:37 #: src/Module/FriendSuggest.php:131 src/Module/Install.php:220 #: src/Module/Install.php:260 src/Module/Install.php:295 @@ -1065,7 +1065,7 @@ msgstr "" msgid "Email" msgstr "" -#: src/Content/ContactSelector.php:116 src/Module/Debug/Babel.php:277 +#: src/Content/ContactSelector.php:116 src/Module/Debug/Babel.php:273 msgid "Diaspora" msgstr "" @@ -4198,7 +4198,7 @@ msgid "Data" msgstr "" #: src/Module/Admin/Logs/View.php:86 -#: src/Module/Debug/ActivityPubConversion.php:45 +#: src/Module/Debug/ActivityPubConversion.php:49 msgid "Source" msgstr "" @@ -5628,7 +5628,7 @@ msgstr "" msgid "Babel" msgstr "" -#: src/Module/BaseAdmin.php:97 src/Module/Debug/ActivityPubConversion.php:121 +#: src/Module/BaseAdmin.php:97 src/Module/Debug/ActivityPubConversion.php:125 msgid "ActivityPub Conversion" msgstr "" @@ -6722,199 +6722,195 @@ msgstr "" msgid "Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:41 +#: src/Module/Debug/ActivityPubConversion.php:45 msgid "Formatted" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:53 +#: src/Module/Debug/ActivityPubConversion.php:57 msgid "Activity" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:101 +#: src/Module/Debug/ActivityPubConversion.php:105 msgid "Object data" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:108 +#: src/Module/Debug/ActivityPubConversion.php:112 msgid "Result Item" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:113 -#: src/Module/Debug/Babel.php:262 src/Module/Moderation/Item/Source.php:79 +#: src/Module/Debug/ActivityPubConversion.php:117 +#: src/Module/Moderation/Item/Source.php:79 #: src/Module/Security/TwoFactor/Verify.php:84 msgid "Error" msgid_plural "Errors" msgstr[0] "" msgstr[1] "" -#: src/Module/Debug/ActivityPubConversion.php:122 +#: src/Module/Debug/ActivityPubConversion.php:126 msgid "Source activity" msgstr "" -#: src/Module/Debug/Babel.php:39 +#: src/Module/Debug/Babel.php:44 msgid "Source input" msgstr "" -#: src/Module/Debug/Babel.php:45 +#: src/Module/Debug/Babel.php:50 msgid "BBCode::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:51 +#: src/Module/Debug/Babel.php:56 msgid "BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:56 +#: src/Module/Debug/Babel.php:61 msgid "BBCode::convert (hex)" msgstr "" -#: src/Module/Debug/Babel.php:61 +#: src/Module/Debug/Babel.php:66 msgid "BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:67 +#: src/Module/Debug/Babel.php:72 msgid "BBCode::convert => HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:73 +#: src/Module/Debug/Babel.php:78 msgid "BBCode::toMarkdown" msgstr "" -#: src/Module/Debug/Babel.php:79 +#: src/Module/Debug/Babel.php:84 msgid "BBCode::toMarkdown => Markdown::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:83 +#: src/Module/Debug/Babel.php:88 msgid "BBCode::toMarkdown => Markdown::convert" msgstr "" -#: src/Module/Debug/Babel.php:89 +#: src/Module/Debug/Babel.php:94 msgid "BBCode::toMarkdown => Markdown::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:95 +#: src/Module/Debug/Babel.php:100 msgid "BBCode::toMarkdown => Markdown::convert => HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:103 +#: src/Module/Debug/Babel.php:108 msgid "Item Body" msgstr "" -#: src/Module/Debug/Babel.php:107 +#: src/Module/Debug/Babel.php:112 msgid "Item Tags" msgstr "" -#: src/Module/Debug/Babel.php:113 +#: src/Module/Debug/Babel.php:118 msgid "PageInfo::appendToBody" msgstr "" -#: src/Module/Debug/Babel.php:118 +#: src/Module/Debug/Babel.php:123 msgid "PageInfo::appendToBody => BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:122 +#: src/Module/Debug/Babel.php:127 msgid "PageInfo::appendToBody => BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:129 +#: src/Module/Debug/Babel.php:134 msgid "Source input (Diaspora format)" msgstr "" -#: src/Module/Debug/Babel.php:138 +#: src/Module/Debug/Babel.php:143 msgid "Source input (Markdown)" msgstr "" -#: src/Module/Debug/Babel.php:144 +#: src/Module/Debug/Babel.php:149 msgid "Markdown::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:149 +#: src/Module/Debug/Babel.php:154 msgid "Markdown::convert" msgstr "" -#: src/Module/Debug/Babel.php:155 +#: src/Module/Debug/Babel.php:160 msgid "Markdown::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:162 +#: src/Module/Debug/Babel.php:167 msgid "Raw HTML input" msgstr "" -#: src/Module/Debug/Babel.php:167 +#: src/Module/Debug/Babel.php:172 msgid "HTML Input" msgstr "" -#: src/Module/Debug/Babel.php:174 +#: src/Module/Debug/Babel.php:179 msgid "HTML Purified (raw)" msgstr "" -#: src/Module/Debug/Babel.php:179 +#: src/Module/Debug/Babel.php:184 msgid "HTML Purified (hex)" msgstr "" -#: src/Module/Debug/Babel.php:184 +#: src/Module/Debug/Babel.php:189 msgid "HTML Purified" msgstr "" -#: src/Module/Debug/Babel.php:190 +#: src/Module/Debug/Babel.php:195 msgid "HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:196 +#: src/Module/Debug/Babel.php:201 msgid "HTML::toBBCode => BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:201 +#: src/Module/Debug/Babel.php:206 msgid "HTML::toBBCode => BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:207 +#: src/Module/Debug/Babel.php:212 msgid "HTML::toBBCode => BBCode::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:213 +#: src/Module/Debug/Babel.php:218 msgid "HTML::toMarkdown" msgstr "" -#: src/Module/Debug/Babel.php:219 +#: src/Module/Debug/Babel.php:224 msgid "HTML::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:225 +#: src/Module/Debug/Babel.php:230 msgid "HTML::toPlaintext (compact)" msgstr "" -#: src/Module/Debug/Babel.php:238 +#: src/Module/Debug/Babel.php:240 msgid "Decoded post" msgstr "" -#: src/Module/Debug/Babel.php:257 +#: src/Module/Debug/Babel.php:259 msgid "Post array before expand entities" msgstr "" -#: src/Module/Debug/Babel.php:263 -msgid "Twitter addon is absent from the addon/ folder." -msgstr "" - -#: src/Module/Debug/Babel.php:273 +#: src/Module/Debug/Babel.php:269 msgid "Babel Diagnostic" msgstr "" -#: src/Module/Debug/Babel.php:275 +#: src/Module/Debug/Babel.php:271 msgid "Source text" msgstr "" -#: src/Module/Debug/Babel.php:276 +#: src/Module/Debug/Babel.php:272 msgid "BBCode" msgstr "" -#: src/Module/Debug/Babel.php:278 +#: src/Module/Debug/Babel.php:274 msgid "Markdown" msgstr "" -#: src/Module/Debug/Babel.php:279 +#: src/Module/Debug/Babel.php:275 msgid "HTML" msgstr "" -#: src/Module/Debug/Babel.php:281 +#: src/Module/Debug/Babel.php:277 msgid "Twitter Source / Tweet URL (requires API key)" msgstr "" From 6e17b3b76ed7ea4f2c9a3e3688e1173edd5ff1ca Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 16 Nov 2024 19:03:15 +0000 Subject: [PATCH 6/6] Move phpstan into own workflow step --- .woodpecker/.phpunit.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index 22502376a6..c3860e6f91 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -55,6 +55,13 @@ steps: - '.composer' volumes: - /tmp/drone-cache:/tmp/cache + phpstan: + image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} + when: + matrix: + PHP_MAJOR_VERSION: 8.2 + commands: + - bin/composer.phar run phpstan; test: image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} environment: @@ -67,9 +74,6 @@ steps: MEMCACHED_HOST: "memcached" MEMCACHE_HOST: "memcached" commands: - - if [ "${PHP_MAJOR_VERSION}" = "8.2" ]; then - bin/composer.phar run phpstan; - fi - cp config/local-sample.config.php config/local.config.php - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql