/**
 * Gets information about all optional installed components.
 * The function is recursive to find files in all directory levels.
 *
 * TODO: Path must be provided as AOC_PATH is only for community plugin.
 * @since 0.7
 *
 * @param string $path Absolute path where to search for components.
 * @param boolean $core If we want to include the core components or not.
 * @param array $files An array with filenames to seach information in. If empty will search on $path.
 * @return array Array with all found components information.
 */
function ak_get_installed_components($path, $core = false, $files = array())
{
    if (empty($files)) {
        $files = ak_dir_content($path, 'extensions=php');
    }
    $components = array();
    foreach ($files as $subdir => $file) {
        if (is_array($file)) {
            $newdir = $path . '/' . $subdir;
            $data = ak_get_installed_components($newdir, $core, $file);
            if (is_array($data)) {
                $components = array_merge($components, $data);
            }
        } else {
            $data = ak_component_data($path . '/' . $file, $core);
            if (is_array($data)) {
                $components[$data['Component']] = $data;
            }
        }
    }
    return $components;
}
 /**
  * Loads component data.
  * As it is a child component, data is loaded into akModuleAbstract::child_data
  *
  * @return void
  */
 protected final function loadData()
 {
     if (empty($this->child_data)) {
         $component_data = ak_component_data($this->mod_file, true);
         $readme_data = ak_module_readme_data($this->mod_file);
         $this->child_data = array_merge($readme_data, $component_data);
         $this->PID = $this->child_data['Parent'];
         $this->mod_data = ak_get_object($this->PID)->getModData();
         if (empty($this->child_data['Version'])) {
             $this->version = $this->mod_data['Version'];
         } else {
             $this->version = $this->child_data['Version'];
         }
     }
 }