Microweber\Providers\UpdateManager::install_element PHP Method

install_element() public method

public install_element ( $module_name )
    public function install_element($module_name)
    {
        $params = array();
        $params['element'] = $module_name;
        $result = $this->call('get_download_link', $params);
        if (isset($result['elements'])) {
            foreach ($result['elements'] as $mod_k => $value) {
                $fname = basename($value);
                $dir_c = mw_cache_path() . 'downloads' . DS;
                if (!is_dir($dir_c)) {
                    mkdir_recursive($dir_c);
                }
                $dl_file = $dir_c . $fname;
                if (!is_file($dl_file)) {
                    $get = $this->app->url_manager->download($value, $post_params = false, $save_to_file = $dl_file);
                }
                if (is_file($dl_file)) {
                    $unzip = new \Microweber\Utils\Unzip();
                    $target_dir = MW_ROOTPATH;
                    // $result = $unzip -> extract($dl_file, $target_dir, $preserve_filepath = TRUE);
                    // skip_cache
                }
            }
            $params = array();
            $params['skip_cache'] = true;
            // $data = $this->app->modules->get($params);
        }
        return $result;
    }