<?php
/* * *******************************************************************************
* The content of this file is subject to the ITS4YouKanbanView license.
* ("License"); You may not use this file except in compliance with the License
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
* All Rights Reserved.
* ****************************************************************************** */

class Settings_ITS4YouKanbanView_Uninstall_Action extends Settings_Vtiger_Basic_Action {

    function __construct() {
        parent::__construct();
    }

    function process(Vtiger_Request $request) {

        include_once('vtlib/Vtiger/Module.php');
        $adb = PearDatabase::getInstance();
        $module = Vtiger_Module::getInstance('ITS4YouKanbanView');
        if ($module) {
            $module->delete();

            $adb->pquery("DROP TABLE IF EXISTS its4you_kanban_view_settings",array());
            $adb->pquery("DROP TABLE IF EXISTS its4you_kanban_view_version",array());
            $adb->pquery("DROP TABLE IF EXISTS its4you_kanban_view_license",array());
            
            @shell_exec('rm -r modules/ITS4YouKanbanView');
            @shell_exec('rm -r modules/Settings/ITS4YouKanbanView');

            @shell_exec('rm -r layouts/vlayout/modules/ITS4YouKanbanView');
            @shell_exec('rm -r layouts/vlayout/modules/Settings/ITS4YouKanbanView');

            @shell_exec('rm -r layouts/v7/modules/ITS4YouKanbanView');
            @shell_exec('rm -r layouts/v7/modules/Settings/ITS4YouKanbanView');

            @shell_exec('rm -f languages/ar_ae/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/ar_ae/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/cz_cz/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/cz_cz/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/de_de/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/de_de/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/en_gb/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/en_gb/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/en_us/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/en_us/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/es_es/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/es_es/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/es_mx/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/es_mx/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/fr_fr/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/fr_fr/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/hi_hi/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/hi_hi/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/hu_hu/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/hu_hu/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/it_it/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/it_it/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/nl_nl/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/nl_nl/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/pl_pl/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/pl_pl/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/pt_br/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/pt_br/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/ro_ro/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/ro_ro/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/ru_ru/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/ru_ru/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/sk_sk/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/sk_sk/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/sv_se/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/sv_se/Settings/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/tr_tr/ITS4YouKanbanView.php');
            @shell_exec('rm -f languages/tr_tr/Settings/ITS4YouKanbanView.php');

            $result = array('success' => true);
        } else {
            $result = array('success' => false);
        }

        ob_clean();
        $response = new Vtiger_Response();
        $response->setResult($result);
        $response->emit();
    }
}
