Fix recursion in subfolders
This commit is contained in:
		
							parent
							
								
									adec98c198
								
							
						
					
					
						commit
						d3438f190f
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -103,7 +103,11 @@ class CommentsPlugin extends Plugin
 | 
			
		|||
    private function getFilesOrderedByModifiedDate($path = '') {
 | 
			
		||||
        $files = [];
 | 
			
		||||
 | 
			
		||||
        $dirItr     = new \RecursiveDirectoryIterator(DATA_DIR . 'comments' . $path, \RecursiveDirectoryIterator::SKIP_DOTS);
 | 
			
		||||
        if (!$path) {
 | 
			
		||||
            $path = DATA_DIR . 'comments';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $dirItr     = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
 | 
			
		||||
        $filterItr  = new RecursiveFolderFilterIterator($dirItr);
 | 
			
		||||
        $itr        = new \RecursiveIteratorIterator($filterItr, \RecursiveIteratorIterator::SELF_FIRST);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +125,7 @@ class CommentsPlugin extends Plugin
 | 
			
		|||
 | 
			
		||||
        foreach ($itr as $file) {
 | 
			
		||||
            if ($file->isDir()) {
 | 
			
		||||
                $this->getFilesOrderedByModifiedDate('/' . $file->getFilename());
 | 
			
		||||
                $this->getFilesOrderedByModifiedDate($file->getPath() . '/' . $file->getFilename());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue