(Grav GitSync) Automatic Commit from smokephil

This commit is contained in:
smokephil 2025-11-11 19:27:29 +01:00 committed by GitSync
parent d73d0ba519
commit 96a01e3ab4
260 changed files with 25905 additions and 16011 deletions

View file

@ -1,3 +1,32 @@
# v2.2.3
## 10/29/2025
1. [](#improved)
* `intl` php package is no longer required to install Grav
# v2.2.2
## 03/21/2025
1. [](#bugfix)
* Fix permission warning on Windows [#46](https://github.com/getgrav/grav-plugin-problems/pull/46)
# v2.2.1
## 03/21/2025
1. [](#bugfix)
* Fix path check on windows [#44](https://github.com/getgrav/grav-plugin-problems/pull/44)
# v2.2.0
## 03/20/2025
1. [](#new)
* Extended php module checks [#38](https://github.com/getgrav/grav-plugin-problems/pull/38)
1. [](#improved)
* Make sure the Essential Folders are listed without extra '/' in front of them
* Updated `http://` links to `https://` across files [#41](https://github.com/getgrav/grav-plugin-problems/pull/41)
* Clarify Apache module detection text [#40](https://github.com/getgrav/grav-plugin-problems/pull/40)
* Ensure essential folder are listed without extra `/` [#39](https://github.com/getgrav/grav-plugin-problems/pull/39)
# v2.1.2
## 10/22/2024

View file

@ -4,7 +4,7 @@
![Problems](assets/readme_1.jpg)
`Problems` is a [Grav](http://github.com/getgrav/grav) Plugin and allows to detect issues.
`Problems` is a [Grav](https://github.com/getgrav/grav) Plugin and allows to detect issues.
This plugin is included in any package distributed that contains Grav. If you decide to clone Grav from GitHub, you will most likely want to install this.
@ -14,7 +14,7 @@ Installing the Problems plugin can be done in one of two ways. Our GPM (Grav Pac
## GPM Installation (Preferred)
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](https://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
bin/gpm install problems
@ -22,13 +22,13 @@ This will install the Problems plugin into your `/user/plugins` directory within
## Manual Installation
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `problems`. You can find these files either on [GitHub](https://github.com/getgrav/grav-plugin-problems) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `problems`. You can find these files either on [GitHub](https://github.com/getgrav/grav-plugin-problems) or via [GetGrav.org](https://getgrav.org/downloads/plugins#extras).
You should now have all the plugin files under
/your/site/grav/user/plugins/problems
> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav), the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) plugins, and a theme to be installed in order to operate.
> NOTE: This plugin is a modular component for Grav which requires [Grav](https://github.com/getgrav/grav), the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) plugins, and a theme to be installed in order to operate.
# Usage

View file

@ -1,13 +1,13 @@
name: Problems
slug: problems
type: plugin
version: 2.1.2
version: 2.2.3
description: Detects and reports problems found in the site.
icon: exclamation-circle
author:
name: Team Grav
email: devs@getgrav.org
url: http://getgrav.org
url: https://getgrav.org
homepage: https://github.com/getgrav/grav-plugin-problems
keywords: problems, plugin, detector, assistant, required
bugs: https://github.com/getgrav/grav-plugin-problems/issues

View file

@ -52,7 +52,7 @@ class Apache extends Problem
$this->details = ['errors' => $apache_errors, 'success' => $apache_success];
} else {
$this->msg = 'Apache not installed, skipping...';
$this->msg = 'Apache is not installed or PHP is not installed as Apache module, skipping...';
}
return $this;

View file

@ -51,6 +51,7 @@ class EssentialFolders extends Problem
foreach ($essential_folders as $file => $check_writable) {
$file_path = (!preg_match('`^(/|[a-z]:[\\\/])`ui', $file) ? GRAV_ROOT . '/' : '') . $file;
$file_path = preg_replace('`^/+`', '/', $file_path);
if (!is_dir($file_path)) {
$file_errors[$file_path] = 'does not exist';

View file

@ -11,6 +11,10 @@ use Grav\Plugin\Problems\Base\Problem;
*/
class PHPModules extends Problem
{
protected $modules_errors = [];
protected $modules_warning = [];
protected $modules_success = [];
public function __construct()
{
$this->id = 'PHP Modules';
@ -21,37 +25,57 @@ class PHPModules extends Problem
$this->help = 'https://learn.getgrav.org/basics/requirements#php-requirements';
}
/**
* @param string $module PHP module name.
* @param bool $required If it is required for grav.
* @param string $module_show_name More common module name to display.
* @return void
*/
protected function check_php_module(string $module, bool $required, string $module_show_name = ''): void{
$msg = 'PHP ';
$msg .= (($module_show_name!=='') ? $module_show_name : $module);
$msg .= ' is %s installed';
if(extension_loaded($module)){
$this->modules_success[$module] = sprintf($msg, 'successfully');
}else if($required){
$this->modules_errors[$module] = sprintf($msg, 'required but not');
}else{
$this->modules_warning[$module] = sprintf($msg, 'recommended but not');
}
}
/**
* @param string $module PHP cache module name.
* @param string $module_show_name More common module name to display.
* @return void
*/
protected function check_cache_module(string $module, string $module_show_name = ''): void{
$msg = 'PHP (optional) Cache ';
$msg .= (($module_show_name!=='') ? $module_show_name : $module);
$msg .= ' is %s installed';
if( extension_loaded($module) ){
$this->modules_success[$module] = sprintf($msg, 'successfully');
} else {
$this->modules_warning[$module] = sprintf($msg, 'not');
}
}
/**
* @return $this
*/
public function process()
{
$modules_errors = [];
$modules_success = [];
// Check for PHP CURL library
$msg = 'PHP Curl (Data Transfer Library) is %s installed';
if (function_exists('curl_version')) {
$modules_success['curl'] = sprintf($msg, 'successfully');
} else {
$modules_errors['curl'] = sprintf($msg, 'required but not');
}
$this->check_php_module('curl', true, 'Curl (Data Transfer Library)');
// Check for PHP Ctype library
$msg = 'PHP Ctype is %s installed';
if (function_exists('ctype_print')) {
$modules_success['ctype'] = sprintf($msg, 'successfully');
} else {
$modules_errors['ctype'] = sprintf($msg, 'required but not');
}
$this->check_php_module('ctype', true, 'Ctype');
// Check for PHP Dom library
$msg = 'PHP DOM is %s installed';
if (class_exists('DOMDocument')) {
$modules_success['dom'] = sprintf($msg, 'successfully');
} else {
$modules_errors['dom'] = sprintf($msg, 'required but not');
}
$this->check_php_module('dom', true, 'DOM');
// Check for PHP fileinfo library
$this->check_php_module('fileinfo', false);
// Check for GD library
$msg = 'PHP GD (Image Manipulation Library) is %s installed';
@ -76,73 +100,68 @@ class PHPModules extends Problem
}
if ($problems_found) {
$msg .= ' but missing ' . $gda_msg;
$this->modules_warning['gd'] = $msg . ' but missing ' . $gda_msg;
}
$modules_success['gd'] = $msg;
$this->modules_success['gd'] = $msg;
} else {
$modules_errors['gd'] = sprintf($msg, 'required but not');
$this->modules_errors['gd'] = sprintf($msg, 'required but not');
}
// Check for PHP MbString library
$msg = 'PHP Mbstring (Multibyte String Library) is %s installed';
if (extension_loaded('mbstring')) {
$modules_success['mbstring'] = sprintf($msg, 'successfully');
} else {
$modules_errors['mbstring'] = sprintf($msg, 'required but not');
}
$this->check_php_module('mbstring', true, 'Mbstring (Multibyte String Library)');
// Check for PHP iconv library
$this->check_php_module('iconv', false);
// Check for PHP intl library
$this->check_php_module('intl', false, 'intl (Internationalization Functions)');
// Check for PHP Open SSL library
$msg = 'PHP OpenSSL (Secure Sockets Library) is %s installed';
if (defined('OPENSSL_VERSION_TEXT') && extension_loaded('openssl')) {
$modules_success['openssl'] = sprintf($msg, 'successfully');
} else {
$modules_errors['openssl'] = sprintf($msg, 'required but not');
}
$this->check_php_module('openssl', true, 'OpenSSL (Secure Sockets Library)');
// Check for PHP XML library
$msg = 'PHP JSON Library is %s installed';
if (extension_loaded('json')) {
$modules_success['json'] = sprintf($msg, 'successfully');
} else {
$modules_errors['json'] = sprintf($msg, 'required but not');
}
// Check for PHP JSON library
$this->check_php_module('json', true, 'JSON Library');
// Check for PHP XML library
$msg = 'PHP XML Library is %s installed';
if (extension_loaded('xml')) {
$modules_success['xml'] = sprintf($msg, 'successfully');
} else {
$modules_errors['xml'] = sprintf($msg, 'required but not');
}
// Check for PHP libraries for symfony
$this->check_php_module('PCRE', true, 'PCRE (Perl Compatible Regular Expressions)');
$this->check_php_module('session', true);
// Check for PHP XML libraries
$this->check_php_module('libxml', true, 'libxml Library');
$this->check_php_module('simplexml', true, 'SimpleXML Library');
$this->check_php_module('xml', true, 'XML Library');
// Check for PHP yaml library
$this->check_php_module('yaml', false);
// Check for PHP Zip library
$msg = 'PHP Zip extension is %s installed';
if (extension_loaded('zip')) {
$modules_success['zip'] = sprintf($msg, 'successfully');
} else {
$modules_errors['zip'] = sprintf($msg, 'required but not');
}
$this->check_php_module('zip', true, 'Zip extension');
// Check Exif if enabled
if (Grav::instance()['config']->get('system.media.auto_metadata_exif')) {
$msg = 'PHP Exif (Exchangeable Image File Format) is %s installed';
if (extension_loaded('exif')) {
$modules_success['exif'] = sprintf($msg, 'successfully');
} else {
$modules_errors['exif'] = sprintf($msg, 'required but not');
}
}
$required = Grav::instance()['config']->get('system.media.auto_metadata_exif');
$this->check_php_module('exif', $required, 'Exif (Exchangeable Image File Format)');
if (empty($modules_errors)) {
// Check cache modules
$this->check_cache_module('apcu', 'APC User Cache');
$this->check_cache_module('memcache');
$this->check_cache_module('memcached');
$this->check_cache_module('redis');
$this->check_cache_module('wincache', 'WinCache');
$this->check_cache_module('zend opcache', 'Zend OPcache');
if (empty($this->modules_errors)) {
$this->status = true;
$this->msg = 'All modules look good!';
$this->msg = 'All required modules look good!';
if(!empty($this->modules_warning)) {
$this->msg .= ' Some recommendations do exist.';
}
} else {
$this->status = false;
$this->msg = 'There were problems with required modules:';
}
$this->details = ['errors' => $modules_errors, 'success' => $modules_success];
$this->details = ['errors' => $this->modules_errors, 'warning' => $this->modules_warning, 'success' => $this->modules_success];
return $this;
}

View file

@ -25,6 +25,12 @@ class Permissions extends Problem
*/
public function process()
{
if (PHP_OS_FAMILY === 'Windows') {
$this->msg = 'Permission check is not available for Windows.';
$this->status = true;
return $this;
}
umask($umask = umask(022));
$msg = 'Your default file umask is <strong>%s</strong> which %s';

View file

@ -69,6 +69,7 @@ class CheckCommand extends ConsoleCommand
if (is_array($details)) {
$errors_row = [];
$warning_row = [];
$success_row = [];
if (isset($details['errors'])) {
@ -77,6 +78,12 @@ class CheckCommand extends ConsoleCommand
}
}
if (isset($details['warning'])) {
foreach ($details['warning'] as $key => $value) {
$warning_row[] = "<yellow>⚑</yellow> {$key}{$value}";
}
}
if (isset($details['success'])) {
foreach ($details['success'] as $key => $value) {
$success_row[] = "<green>✔</green> {$key}{$value}";
@ -86,6 +93,10 @@ class CheckCommand extends ConsoleCommand
foreach($errors_row as $e_row) {
$rows[] = ['', new TableCell($e_row, array('colspan' => 3)), ];
}
foreach($warning_row as $e_row) {
$rows[] = ['', new TableCell($e_row, array('colspan' => 3)), ];
}
foreach($success_row as $e_row) {
$rows[] = ['', new TableCell($e_row, array('colspan' => 3)), ];

View file

@ -24,7 +24,7 @@
{% include 'reports/problems-report.html.twig' %}
<p class="footer text-center">
<a href="http://getgrav.org">Grav</a> was <img src="{{ problems_url }}/assets/code-3.svg" /> with <img class="love" src="{{ problems_url }}/assets/heart.svg" /> by <a href="https://trilby.media">Trilby Media</a>.
<a href="https://getgrav.org">Grav</a> was <img src="{{ problems_url }}/assets/code-3.svg" /> with <img class="love" src="{{ problems_url }}/assets/heart.svg" /> by <a href="https://trilby.media">Trilby Media</a>.
</p>
</div>

View file

@ -18,6 +18,15 @@
</li>
{% endfor %}
{% for key,value in problem.details.warning %}
<li class="menu-item">
<div class="menu-badge">
<label class="label label-warning"><i class="icon icon-flag"></i></label>
</div>
<span class=""><code>{{ key }}</code> - {{ value|raw }}</span>
</li>
{% endfor %}
{% for key,value in problem.details.success %}
<li class="menu-item">
<div class="menu-badge">

View file

@ -1366,9 +1366,9 @@ inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
ini@^1.3.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.7"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84"
integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==
interpret@^1.0.0:
version "1.2.0"
@ -3234,9 +3234,9 @@ wrappy@1:
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
yallist@^2.1.2:
version "2.1.2"