Fix error when user/data/comments does not exist, fix #2
This commit is contained in:
parent
27158eaea0
commit
50d3b3c3c5
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Grav\Plugin;
|
namespace Grav\Plugin;
|
||||||
|
|
||||||
|
use Grav\Common\Filesystem\Folder;
|
||||||
use Grav\Common\GPM\GPM;
|
use Grav\Common\GPM\GPM;
|
||||||
use Grav\Common\Grav;
|
use Grav\Common\Grav;
|
||||||
use Grav\Common\Page\Page;
|
use Grav\Common\Page\Page;
|
||||||
|
@ -205,6 +206,10 @@ class CommentsPlugin extends Plugin
|
||||||
$path = DATA_DIR . 'comments';
|
$path = DATA_DIR . 'comments';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
Folder::mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
$dirItr = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
$dirItr = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
$filterItr = new RecursiveFolderFilterIterator($dirItr);
|
$filterItr = new RecursiveFolderFilterIterator($dirItr);
|
||||||
$itr = new \RecursiveIteratorIterator($filterItr, \RecursiveIteratorIterator::SELF_FIRST);
|
$itr = new \RecursiveIteratorIterator($filterItr, \RecursiveIteratorIterator::SELF_FIRST);
|
||||||
|
|
Loading…
Reference in New Issue