/** * Возвращает дерево каталогов и файлов по указанному пути в виде * рекурсивного массива * @param string $path * @return array */ function files_tree_to_array($path) { $data = array(); $dir = new DirectoryIterator($path); foreach ($dir as $node) { if ($node->isDir() && !$node->isDot()) { $data[$node->getFilename()] = files_tree_to_array($node->getPathname()); } else { if ($node->isFile()) { $data[] = $node->getFilename(); } } } return $data; }
private function getPackageContentsList() { $path = cmsConfig::get('upload_path') . $this->installer_upload_path . '/' . 'package'; if (!is_dir($path)) { return false; } return files_tree_to_array($path); }