Microweber\Install\TemplateInstaller::installTemplateContent PHP Method

installTemplateContent() private method

private installTemplateContent ( $template_name )
    private function installTemplateContent($template_name)
    {
        $default_content_folder = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR;
        $default_content_file = $default_content_folder . 'mw_default_content.zip';
        if ($template_name) {
            if (function_exists('templates_path')) {
                $template_dir = templates_path() . DS . $template_name;
                $template_dir = normalize_path($template_dir, true);
                if (is_dir($template_dir)) {
                    $template_default_content = $template_dir . 'mw_default_content.zip';
                    if (is_file($template_default_content) and is_readable($template_default_content)) {
                        $default_content_file = $template_default_content;
                        $default_content_folder = $template_dir;
                    }
                }
            }
        }
        if (is_file($default_content_file)) {
            $restore = new \Microweber\Utils\Backup();
            $restore->backups_folder = $default_content_folder;
            $restore->backup_file = 'mw_default_content.zip';
            ob_start();
            try {
                $rest = $restore->exec_restore();
            } catch (Exception $e) {
                return false;
            }
            ob_get_clean();
            return true;
        } else {
            return false;
        }
    }