diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 3393d081..fd5ed831 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1 @@
-custom: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=77KW4LBEYBD9U"
+custom: "https://www.buymeacoffee.com/devdavido"
diff --git a/.github/stale.yml b/.github/stale.yml
index edf7b8ac..75ccde2c 100644
--- a/.github/stale.yml
+++ b/.github/stale.yml
@@ -1,10 +1,9 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
-daysUntilClose: 7
+daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- - pinned
- security
- nostale
# Label to use when marking an issue as stale
@@ -13,6 +12,6 @@ staleLabel: stale
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs
- within the next 7 days. Thank you for your contributions.
+ within the next 30 days. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index f3b7b291..f16b7ae4 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -5,67 +5,37 @@ on:
paths-ignore:
- '*.md'
-env:
- PLUGIN_NAME: PerformanceAudit
- TEST_SUITE: PluginTests
- MYSQL_ADAPTER: PDO_MYSQL
-
jobs:
- phpunit:
+ tests:
strategy:
+ fail-fast: false
matrix:
- php-versions: ['7.1']
- #php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0']
- matomo-versions: ['3.12.0', '3.14.0']
- node-version: [12.x]
- #node-version: [10.x, 12.x]
+ php: ['7.2', '7.4', '8.0', '8.3']
+ matomo-target: ['minimum_required_matomo', 'maximum_supported_matomo']
+ node: ['12.x', '20.x']
runs-on: ubuntu-latest
- name: PHPUnit with PHP ${{ matrix.php-versions }}, Node.js ${{ matrix.node-version }} and Matomo ${{ matrix.matomo-versions }}
+ permissions:
+ checks: write
+ pull-requests: write
+ contents: read
- steps:
- - uses: actions/checkout@v2
+ name: Tests w/ PHP ${{ matrix.php }}, Node.js ${{ matrix.node }}, Target Matomo '${{ matrix.matomo-target }}'
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
with:
- php-version: ${{ matrix.php-versions }}
- extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, iconv
- coverage: none
- tools: composer, phpunit:7.5.20
+ lfs: true
+ persist-credentials: false
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
+ - name: Run plugin tests
+ uses: matomo-org/github-action-tests@main
with:
- node-version: ${{ matrix.node-version }}
-
- - name: Create database
- run: |
- sudo /etc/init.d/mysql start
- mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS matomo_tests;'
-
- - name: Clone Matomo and run plugin Tests
- # TODO
- run: |
- shopt -s extglob
- mkdir ${{ env.PLUGIN_NAME }}
- cp -R !(${{ env.PLUGIN_NAME }}) ${{ env.PLUGIN_NAME }}
- cp -R .git/ ${{ env.PLUGIN_NAME }}/
-
- git clone --config filter.lfs.smudge=true -q https://github.com/matomo-org/matomo.git matomo
- cd matomo
- git fetch --all
- git submodule update
- git checkout -f -q tags/${{ matrix.matomo-versions }}
- [ -d ./tests/travis/.git ] || sh -c "rm -rf ./tests/travis && git clone https://github.com/matomo-org/travis-scripts.git ./tests/travis"
- cd ./tests/travis
- git checkout master
- cd ../..
- [ ! -f ./tests/travis/check_plugin_compatible_with_piwik.php ] || php ./tests/travis/check_plugin_compatible_with_piwik.php "${{ env.PLUGIN_NAME }}"
- composer install --no-dev --no-progress
- rm -rf plugins/${{ env.PLUGIN_NAME }}
- mv ../${{ env.PLUGIN_NAME }} plugins
- echo './console tests:run PerformanceAudit'
- env:
- DB_PASSWORD: root
+ plugin-name: 'PerformanceAudit'
+ test-type: 'PluginTests'
+ php-version: ${{ matrix.php }}
+ matomo-test-branch: ${{ matrix.matomo-target }}
+ node-version: ${{ matrix.node }}
+ mysql-service: true
diff --git a/API.php b/API.php
index 07940815..208fe856 100644
--- a/API.php
+++ b/API.php
@@ -1,10 +1,4 @@
getPrettyPercentFromQuotient($value / 100), 0, -1);
}
}
diff --git a/Columns/Metrics/MaxSeconds.php b/Columns/Metrics/MaxSeconds.php
index 0eedf728..799d3a44 100644
--- a/Columns/Metrics/MaxSeconds.php
+++ b/Columns/Metrics/MaxSeconds.php
@@ -1,10 +1,4 @@
getPrettyPercentFromQuotient($value / 100), 0, -1);
}
}
diff --git a/Columns/Metrics/MedianSeconds.php b/Columns/Metrics/MedianSeconds.php
index e051c2f7..ea468161 100644
--- a/Columns/Metrics/MedianSeconds.php
+++ b/Columns/Metrics/MedianSeconds.php
@@ -1,10 +1,4 @@
getPrettyPercentFromQuotient($value / 100), 0, -1);
}
}
diff --git a/Columns/Metrics/MinSeconds.php b/Columns/Metrics/MinSeconds.php
index f16fd64c..90552144 100644
--- a/Columns/Metrics/MinSeconds.php
+++ b/Columns/Metrics/MinSeconds.php
@@ -1,10 +1,4 @@
+
## Installation
Preferably you install [this plugin](https://plugins.matomo.org/PerformanceAudit) automatically by:
@@ -78,14 +77,11 @@ Run the integration and unit tests with:
## Changelog
Please see the [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
-## ToDo
-- Add support for [mobile Matomo app](https://matomo.org/mobile/).
-
## Contact
-If you have any questions or inquiries, you can contact `github {at} diskoboss {døt} de`.
+If you have any questions or inquiries, you can contact `github{at}diskoboss{døt}de`.
## Security
-If you discover any security related issues, please contact `github {at} diskoboss {døt} de` instead of using the issue tracker.
+If you discover any security related issues, please contact `github{at}diskoboss{døt}de` instead of using the issue tracker.
Please note that the performance audits will be performed with Chromium which renders Matomo-tracked web pages on your server without the sandbox mode of Chromium. You can find more information about this possible issue on the [lighthouse-cli repository](https://github.com/GoogleChrome/lighthouse-ci/tree/master/docs/recipes/docker-client#--no-sandbox-issues-explained).
diff --git a/Reports/GetPerformanceBase.php b/Reports/GetPerformanceBase.php
index bbd9d01a..e2f11f87 100644
--- a/Reports/GetPerformanceBase.php
+++ b/Reports/GetPerformanceBase.php
@@ -1,10 +1,4 @@
=7.2.5",
"ext-json": "*",
"ext-spl": "*",
- "ducks-project/spl-types": "^1.1",
- "symfony/polyfill-mbstring": "^1.20",
+ "ducks-project/spl-types": "^1.2",
+ "symfony/polyfill-mbstring": "^1.28",
"symfony/process": "^4.4",
"jeroen-g/lighthouse": "^0.2"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "^2.17"
+ "friendsofphp/php-cs-fixer": "^2.19"
},
"autoload": {
"classmap": ["./"]
diff --git a/lang/en.json b/lang/en.json
index fade106a..aa435a50 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -5,7 +5,7 @@
"CoreAdminHome_MenuPerformance": "Performance",
"CoreAdminHome_PluginPerformance": "PerformanceAudit Plugin",
"CoreAdminHome_VersionPerformance": "You are currently using version %1$s%2$s%3$s of the %4$s plugin.",
- "Donate": "Donate",
+ "Donate_BuyMeACoffee": "Buy me a coffee",
"EnvironmentDesktop": "desktop",
"EnvironmentMobile": "mobile",
"Metrics_Max_Percent": "Highest %",
diff --git a/plugin.json b/plugin.json
index 8d61a43e..33efbf00 100644
--- a/plugin.json
+++ b/plugin.json
@@ -1,7 +1,7 @@
{
"name": "PerformanceAudit",
"description": "Daily performance audits of all your sites in Matomo.",
- "version": "2.0.0",
+ "version": "2.1.0",
"theme": false,
"require": {
"php": ">=7.2.5",
@@ -9,16 +9,12 @@
},
"authors": [
{
- "name": "David",
- "email": "github@diskoboss.de",
+ "name": "DevDavido",
"homepage": "https://github.com/DevDavido"
}
],
- "donate": {
- "paypal": "david.domainemail@gmx.de"
- },
"support": {
- "email": "github@diskoboss.de",
+ "email": "github{at}diskoboss{døt}de",
"issues": "https://github.com/DevDavido/performance-audit-plugin/issues"
},
"homepage": "https://github.com/DevDavido/performance-audit-plugin",
diff --git a/templates/version.twig b/templates/version.twig
index 9957c57a..4460f535 100644
--- a/templates/version.twig
+++ b/templates/version.twig
@@ -23,8 +23,8 @@
+ *
+ * @internal
+ */
+final class Php80
+{
+ public static function fdiv(float $dividend, float $divisor): float
+ {
+ return @($dividend / $divisor);
+ }
+
+ public static function get_debug_type($value): string
+ {
+ switch (true) {
+ case null === $value: return 'null';
+ case \is_bool($value): return 'bool';
+ case \is_string($value): return 'string';
+ case \is_array($value): return 'array';
+ case \is_int($value): return 'int';
+ case \is_float($value): return 'float';
+ case \is_object($value): break;
+ case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
+ default:
+ if (null === $type = @get_resource_type($value)) {
+ return 'unknown';
+ }
+
+ if ('Unknown' === $type) {
+ $type = 'closed';
+ }
+
+ return "resource ($type)";
+ }
+
+ $class = \get_class($value);
+
+ if (false === strpos($class, '@')) {
+ return $class;
+ }
+
+ return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
+ }
+
+ public static function get_resource_id($res): int
+ {
+ if (!\is_resource($res) && null === @get_resource_type($res)) {
+ throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
+ }
+
+ return (int) $res;
+ }
+
+ public static function preg_last_error_msg(): string
+ {
+ switch (preg_last_error()) {
+ case \PREG_INTERNAL_ERROR:
+ return 'Internal error';
+ case \PREG_BAD_UTF8_ERROR:
+ return 'Malformed UTF-8 characters, possibly incorrectly encoded';
+ case \PREG_BAD_UTF8_OFFSET_ERROR:
+ return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
+ case \PREG_BACKTRACK_LIMIT_ERROR:
+ return 'Backtrack limit exhausted';
+ case \PREG_RECURSION_LIMIT_ERROR:
+ return 'Recursion limit exhausted';
+ case \PREG_JIT_STACKLIMIT_ERROR:
+ return 'JIT stack limit exhausted';
+ case \PREG_NO_ERROR:
+ return 'No error';
+ default:
+ return 'Unknown error';
+ }
+ }
+
+ public static function str_contains(string $haystack, string $needle): bool
+ {
+ return '' === $needle || false !== strpos($haystack, $needle);
+ }
+
+ public static function str_starts_with(string $haystack, string $needle): bool
+ {
+ return 0 === strncmp($haystack, $needle, \strlen($needle));
+ }
+
+ public static function str_ends_with(string $haystack, string $needle): bool
+ {
+ if ('' === $needle || $needle === $haystack) {
+ return true;
+ }
+
+ if ('' === $haystack) {
+ return false;
+ }
+
+ $needleLength = \strlen($needle);
+
+ return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
+ }
+}
diff --git a/vendor/symfony/polyfill-php80/PhpToken.php b/vendor/symfony/polyfill-php80/PhpToken.php
new file mode 100644
index 00000000..fe6e6910
--- /dev/null
+++ b/vendor/symfony/polyfill-php80/PhpToken.php
@@ -0,0 +1,103 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Polyfill\Php80;
+
+/**
+ * @author Fedonyuk Anton