Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65fd804bd5 | ||
|
|
e6c172f762 | ||
|
|
cf1b0157fa | ||
|
|
752271b258 | ||
|
|
7399146214 | ||
|
|
beeff70d98 | ||
|
|
430919bcdf | ||
|
|
9f3f2483f5 |
No files matched your search
@@ -0,0 +1,43 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.2'
|
||||
tools: phpunit:8,psalm
|
||||
|
||||
- name: Setup problem matchers for PHPUnit
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composercache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composercache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- run: composer install --no-interaction
|
||||
|
||||
- name: Psalm
|
||||
run: psalm --output-format=github
|
||||
if: always()
|
||||
|
||||
- name: PHPUnit
|
||||
run: phpunit --coverage-text
|
||||
if: always()
|
||||
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 3.3.7 - 2022-06-16
|
||||
|
||||
### Fixed
|
||||
- PHP warning, when accessing OPcache status with `opcache.restrict_api`
|
||||
|
||||
## 3.3.6 - 2022-02-08
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
_Make a site, make it fast._
|
||||
|
||||
[](https://scrutinizer-ci.com/g/Rarst/laps/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/Rarst/laps/build-status/master)
|
||||
[](https://scrutinizer-ci.com/g/Rarst/laps/?branch=master)
|
||||
[](https://github.com/Rarst/laps/actions/workflows/tests.yml)
|
||||
[](https://packagist.org/packages/rarst/laps)
|
||||
[](https://packagist.org/packages/rarst/laps)
|
||||
[](https://packagist.org/packages/rarst/laps)
|
||||
@@ -37,13 +35,13 @@ API requests need to be authenticated as admin for performance data to be sent.
|
||||
|
||||
## Installation
|
||||
|
||||
| [Composer](https://getcomposer.org/) (recommended) | Release archive |
|
||||
| -------------------------------------------------- | -------- |
|
||||
| `composer require rarst/laps` | [](https://github.com/Rarst/laps/releases/latest/download/laps.zip) |
|
||||
| [Composer](https://getcomposer.org/) (recommended) | Release archive |
|
||||
| -------------------------------------------------- | -------- |
|
||||
| `composer require rarst/laps` | [](https://github.com/Rarst/laps/releases/latest/download/laps.zip)|
|
||||
|
||||
## Tests
|
||||
|
||||
Tests require [Brain Monkey](https://github.com/Brain-WP/BrainMonkey) (included in dependencies) and PHPUnit 9 (not included).
|
||||
Tests require [Brain Monkey](https://github.com/Brain-WP/BrainMonkey) (included in dependencies) and PHPUnit 8 (not included).
|
||||
|
||||
```bash
|
||||
phpunit
|
||||
|
||||
+89
-16
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare( strict_types=1 );
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
@@ -15,13 +16,13 @@ class RoboFile extends \Robo\Tasks {
|
||||
public function watch() {
|
||||
|
||||
$this->taskWatch()
|
||||
->monitor( [ 'public/css/variables.less', 'public/css/laps.less' ], function () {
|
||||
$this->makeCss();
|
||||
} )
|
||||
->monitor( 'public/js/source.js', function () {
|
||||
$this->makeJs();
|
||||
} )
|
||||
->run();
|
||||
->monitor( [ 'public/css/variables.less', 'public/css/laps.less' ], function () {
|
||||
$this->makeCss();
|
||||
} )
|
||||
->monitor( 'public/js/source.js', function () {
|
||||
$this->makeJs();
|
||||
} )
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
$this->taskExec( 'lessc public/css/laps.less public/css/laps.css --source-map=public/css/laps.css.map' )->run();
|
||||
|
||||
$this->taskMinify( 'public/css/laps.css' )
|
||||
->run();
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,11 +55,11 @@ class RoboFile extends \Robo\Tasks {
|
||||
'vendor/twbs/bootstrap/js/tooltip.js',
|
||||
'public/js/source.js',
|
||||
] )
|
||||
->to( 'public/js/laps.js' )
|
||||
->run();
|
||||
->to( 'public/js/laps.js' )
|
||||
->run();
|
||||
|
||||
$this->taskMinify( 'public/js/laps.js' )
|
||||
->run();
|
||||
->run();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,14 +69,65 @@ class RoboFile extends \Robo\Tasks {
|
||||
$dir = __DIR__ . '/src/mustache/cache';
|
||||
$this->_cleanDir( $dir );
|
||||
$mustache = new \Mustache_Engine(
|
||||
array(
|
||||
[
|
||||
'loader' => new \Mustache_Loader_FilesystemLoader( __DIR__ . '/src/mustache' ),
|
||||
'cache' => $dir,
|
||||
)
|
||||
]
|
||||
);
|
||||
$mustache->loadTemplate( 'laps' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates release zip
|
||||
*
|
||||
* @param string $php PHP version to target.
|
||||
*/
|
||||
public function makeArchive( $php = '7.2.5' ): void {
|
||||
|
||||
$composer = json_decode( file_get_contents( __DIR__ . '/composer.json' ) );
|
||||
$package = $composer->name;
|
||||
|
||||
[ $vendor, $name ] = explode( '/', $package );
|
||||
|
||||
if ( empty( $vendor ) || empty( $name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_mkdir( 'release' );
|
||||
|
||||
$version = $this->latestTag();
|
||||
|
||||
$this->taskExec( "composer create-project {$package} {$name} {$version}" )
|
||||
->dir( __DIR__ . '/release' )
|
||||
->arg( '--prefer-dist' )
|
||||
->arg( '--no-install' )
|
||||
->run();
|
||||
|
||||
if ( $php ) {
|
||||
$this->taskExec( "composer config platform.php {$php}" )
|
||||
->dir( __DIR__ . "/release/{$name}" )
|
||||
->run();
|
||||
}
|
||||
|
||||
$this->taskExec( 'composer remove composer/installers --no-update' )
|
||||
->dir( __DIR__ . "/release/{$name}" )
|
||||
->run();
|
||||
|
||||
$this->taskExec( 'composer update --no-dev --optimize-autoloader' )
|
||||
->dir( __DIR__ . "/release/{$name}" )
|
||||
->run();
|
||||
|
||||
$zipFile = "release/{$name}.zip";
|
||||
|
||||
$this->_remove( $zipFile );
|
||||
|
||||
$this->taskPack( $zipFile )
|
||||
->addDir( $name, "release/{$name}" )
|
||||
->run();
|
||||
|
||||
$this->_deleteDir( "release/{$name}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates version in header and makes git version tag.
|
||||
*
|
||||
@@ -83,12 +135,13 @@ class RoboFile extends \Robo\Tasks {
|
||||
*/
|
||||
public function tag( $version ) {
|
||||
|
||||
$this->versionSet( $version );
|
||||
$this->makeVersion( $version );
|
||||
|
||||
$this->taskGitStack()
|
||||
->stopOnFail()
|
||||
->add( 'CHANGELOG.md' )
|
||||
->add( 'laps.php' )
|
||||
->commit( "Updated header version to {$version}" )
|
||||
->commit( "Released version $version" )
|
||||
->tag( $version )
|
||||
->run();
|
||||
}
|
||||
@@ -98,11 +151,31 @@ class RoboFile extends \Robo\Tasks {
|
||||
*
|
||||
* @param string $version Version string.
|
||||
*/
|
||||
public function versionSet( $version ) {
|
||||
public function makeVersion( $version ) {
|
||||
|
||||
$this->taskReplaceInFile( 'CHANGELOG.md' )
|
||||
->from( '## Unreleased' )
|
||||
->to( '## Unreleased' . PHP_EOL . PHP_EOL . "## $version - " . date_format( date_create(), 'Y-m-d' ) )
|
||||
->run();
|
||||
|
||||
$this->taskReplaceInFile( 'laps.php' )
|
||||
->regex( '|^Version:.*$|m' )
|
||||
->to( 'Version: ' . $version )
|
||||
->run();
|
||||
}
|
||||
|
||||
public function upload() {
|
||||
$version = $this->latestTag();
|
||||
$zipFile = __DIR__ . '/release/laps.zip';
|
||||
|
||||
$this->makeArchive();
|
||||
$this->_exec("gh release upload $version $zipFile");
|
||||
$this->_remove( $zipFile );
|
||||
}
|
||||
|
||||
private function latestTag(): string {
|
||||
$commit = escapeshellarg( exec( 'git rev-list --tags --max-count=1' ) );
|
||||
|
||||
return escapeshellarg( exec( "git describe --tags {$commit}" ) );
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,9 @@
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/installers": true
|
||||
},
|
||||
"platform": {
|
||||
"php": "7.2.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+52
-51
@@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "e87830a8a9b8c2c9587e0c4ac5139f12",
|
||||
"content-hash": "1bf4582190f9dfcabf70f1a29f7f15e8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v2.0.1",
|
||||
"version": "v2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8"
|
||||
"reference": "af93ba6e52236418f07a278033eba6959ee5b983"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8",
|
||||
"reference": "a241e78aaeb09781f5f5b92ac01ffd13ab43e5e8",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/af93ba6e52236418f07a278033eba6959ee5b983",
|
||||
"reference": "af93ba6e52236418f07a278033eba6959ee5b983",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -37,7 +37,8 @@
|
||||
"class": "Composer\\Installers\\Plugin",
|
||||
"branch-alias": {
|
||||
"dev-main": "2.x-dev"
|
||||
}
|
||||
},
|
||||
"plugin-modifies-install-path": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -131,7 +132,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/installers/issues",
|
||||
"source": "https://github.com/composer/installers/tree/v2.0.1"
|
||||
"source": "https://github.com/composer/installers/tree/v2.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -147,7 +148,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-09-13T08:21:20+00:00"
|
||||
"time": "2022-04-13T09:13:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mustache/mustache",
|
||||
@@ -254,20 +255,20 @@
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/container.git",
|
||||
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
|
||||
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
|
||||
},
|
||||
"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/8622567409010282b7aeebe4bb841fe98b58dcaf",
|
||||
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4.0"
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -296,22 +297,22 @@
|
||||
],
|
||||
"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/1.1.1"
|
||||
},
|
||||
"time": "2021-11-05T16:50:12+00:00"
|
||||
"time": "2021-03-05T17:36:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
"version": "v2.5.0",
|
||||
"version": "v2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8"
|
||||
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
|
||||
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -349,7 +350,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.0"
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -365,26 +366,26 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-07-12T14:48:14+00:00"
|
||||
"time": "2022-01-02T09:53:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v2.5.0",
|
||||
"version": "v2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc"
|
||||
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
|
||||
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"psr/container": "^1.1",
|
||||
"symfony/deprecation-contracts": "^2.1"
|
||||
"symfony/deprecation-contracts": "^2.1|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2"
|
||||
@@ -432,7 +433,7 @@
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.0"
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -448,20 +449,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-11-04T16:48:04+00:00"
|
||||
"time": "2022-03-13T20:07:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/stopwatch",
|
||||
"version": "v4.4.37",
|
||||
"version": "v4.4.38",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/stopwatch.git",
|
||||
"reference": "ad652049cc8d62417a33373f5d69edde4cbb29d5"
|
||||
"reference": "7f4f5a8122f7530d688cc9edf2f8c9261552fa2d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/ad652049cc8d62417a33373f5d69edde4cbb29d5",
|
||||
"reference": "ad652049cc8d62417a33373f5d69edde4cbb29d5",
|
||||
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/7f4f5a8122f7530d688cc9edf2f8c9261552fa2d",
|
||||
"reference": "7f4f5a8122f7530d688cc9edf2f8c9261552fa2d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -494,7 +495,7 @@
|
||||
"description": "Provides a way to profile code",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/stopwatch/tree/v4.4.37"
|
||||
"source": "https://github.com/symfony/stopwatch/tree/v4.4.38"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -510,7 +511,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-01-02T09:41:36+00:00"
|
||||
"time": "2022-02-18T15:34:20+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -594,12 +595,12 @@
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Brain\\Monkey\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"inc/api.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"Brain\\Monkey\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
@@ -685,33 +686,30 @@
|
||||
},
|
||||
{
|
||||
"name": "mockery/mockery",
|
||||
"version": "1.5.0",
|
||||
"version": "1.3.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mockery/mockery.git",
|
||||
"reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac"
|
||||
"reference": "472fa8ca4e55483d55ee1e73c963718c4393791d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac",
|
||||
"reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac",
|
||||
"url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d",
|
||||
"reference": "472fa8ca4e55483d55ee1e73c963718c4393791d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"hamcrest/hamcrest-php": "^2.0.1",
|
||||
"lib-pcre": ">=7.0",
|
||||
"php": "^7.3 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<8.0"
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5 || ^9.3"
|
||||
"phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -751,9 +749,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mockery/mockery/issues",
|
||||
"source": "https://github.com/mockery/mockery/tree/1.5.0"
|
||||
"source": "https://github.com/mockery/mockery/tree/1.3.5"
|
||||
},
|
||||
"time": "2022-01-20T13:18:17+00:00"
|
||||
"time": "2021-09-13T15:33:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pds/skeleton",
|
||||
@@ -855,5 +853,8 @@
|
||||
"php": "^7.2.5 || ^8"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.2.0"
|
||||
"platform-overrides": {
|
||||
"php": "7.2.5"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Plugin Name: Laps
|
||||
Plugin URI: https://github.com/Rarst/laps
|
||||
Description: Light WordPress profiler.
|
||||
Author: Andrey “Rarst” Savchenko
|
||||
Version: 3.3.5
|
||||
Version: 3.3.7
|
||||
Author URI: https://www.rarst.net/
|
||||
Requires PHP: 7.1.3
|
||||
Update URI: false
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
</phpunit>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
totallyTyped="false"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
errorLevel="2"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src"/>
|
||||
|
||||
@@ -36,8 +36,12 @@ class Core_Load_Collector implements Record_Collector_Interface {
|
||||
|
||||
$php = 'PHP Load – ' . PHP_VERSION;
|
||||
|
||||
if ( function_exists( 'opcache_get_status' ) ) {
|
||||
$zend_status = opcache_get_status();
|
||||
if ( $this->opcache_api_available() ) {
|
||||
/**
|
||||
* This is silenced since it might still emit warning for correct `opcache.resrict_api` configuration.
|
||||
* @see https://github.com/php/php-src/issues/8799
|
||||
*/
|
||||
$zend_status = @opcache_get_status();
|
||||
$php .= empty( $zend_status['opcache_enabled'] ) ? '' : ' – OPcache';
|
||||
}
|
||||
|
||||
@@ -52,4 +56,22 @@ class Core_Load_Collector implements Record_Collector_Interface {
|
||||
new Record( $load, $timestart, $this->timeload - $timestart, '', 'core' ),
|
||||
];
|
||||
}
|
||||
|
||||
private function opcache_api_available(): bool {
|
||||
if ( ! function_exists( 'opcache_get_status' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$restrict_api = ini_get( 'opcache.restrict_api' );
|
||||
|
||||
if ( ! $restrict_api ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The paths aren't normalized, because it is unclear if they are in PHP itself
|
||||
* and this should rather be false negative to prevent warning emitted.
|
||||
*/
|
||||
return 0 === stripos( __FILE__, $restrict_api );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user