Fix error when user/data/comments does not exist, fix #2

This commit is contained in:
Flavio Copes 2015-11-11 11:00:50 +01:00
parent 27158eaea0
commit 50d3b3c3c5
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Filesystem\Folder;
use Grav\Common\GPM\GPM;
use Grav\Common\Grav;
use Grav\Common\Page\Page;
@ -205,6 +206,10 @@ class CommentsPlugin extends Plugin
$path = DATA_DIR . 'comments';
}
if (!file_exists($path)) {
Folder::mkdir($path);
}
$dirItr = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
$filterItr = new RecursiveFolderFilterIterator($dirItr);
$itr = new \RecursiveIteratorIterator($filterItr, \RecursiveIteratorIterator::SELF_FIRST);