Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 14, 2021
2 parents cb50b02 + 9a127b4 commit b4a1170
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v2.1.1
## 04/14/2021

1. [](#bugfix)
* Fixed a check for loading problem classes [#32](https://github.com/getgrav/grav-plugin-problems/issues/32)
* Regression: folders check fails in Windows [#31](https://github.com/getgrav/grav-plugin-problems/issues/31)

# v2.1.0
## 04/13/2021

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Problems
slug: problems
type: plugin
version: 2.1.0
version: 2.1.1
description: Detects and reports problems found in the site.
icon: exclamation-circle
author:
Expand Down
13 changes: 8 additions & 5 deletions classes/Problems/Base/ProblemChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ public function check($problems_dir = null): bool
$problems = [];
$problems_found = false;

foreach (new \DirectoryIterator($problems_dir) as $file) {
if ($file->isDot() || $file->isDir()) {
$iterator = new \DirectoryIterator($problems_dir);
foreach ($iterator as $file) {
if (!$file->isFile() || $file->getExtension() !== 'php') {
continue;
}
$classname = 'Grav\\Plugin\\Problems\\' . $file->getBasename('.php');
/** @var Problem $problem */
$problem = new $classname();
$problems[$problem->getId()] = $problem;
if (class_exists($classname)) {
/** @var Problem $problem */
$problem = new $classname();
$problems[$problem->getId()] = $problem;
}
}

// Fire event to allow other plugins to add problems
Expand Down
2 changes: 1 addition & 1 deletion classes/Problems/EssentialFolders.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function process()
$file_success = [];

foreach ($essential_folders as $file => $check_writable) {
$file_path = (!str_starts_with($file, '/') ? GRAV_ROOT . '/' : '') . $file;
$file_path = (!preg_match('`^(/|[a-z]:[\\\/])`ui', $file) ? GRAV_ROOT . '/' : '') . $file;

if (!is_dir($file_path)) {
$file_errors[$file_path] = 'does not exist';
Expand Down

0 comments on commit b4a1170

Please sign in to comment.