require_once 'database/DBConfig.php';
require_once 'database/Database.php';
###################################################################
#                      INSTALL AND UNINSTALL                      #
###################################################################
$installationManager = new InstallationManager();
$installationMangerView = new InstallationManagerView();
// display menu
echo $installationMangerView->doManagerBox();
// if cliced Install button: install
if ($installationMangerView->doInstall()) {
    $installationManager->install();
}
// if cliced Uninstall button: uninstall
if ($installationMangerView->doUninstall()) {
    $installationManager->uninstall();
}
###################################################################
/**
 * MANAGER
 */
class InstallationManager
{
    // table names
    const TABLE_MEMBER = 'member';
    const TABLE_RECORDING = 'recording';
    private $m_db = null;
    public function __construct()
    {
        // DB
        $dbConfig = new \permag\database\DBConfig();
Example #2
0
 protected function action_uninstall()
 {
     if (!Permissions::has('sys_access') or !Permissions::has('sys_installation_uninstall')) {
         return $this->redirectForbidden();
     }
     $lang = i18n::load('diamondmvc-backend');
     if (!isset($_REQUEST['id']) or empty($_REQUEST['id'])) {
         $this->addMessage('Whoops!', $lang->get('ERROR_MISSING_ARGUMENTS'), 'error');
         $this->result = array('success' => false, 'msg' => $lang->get('ERROR_MISSING_ARGUMENTS'));
         return;
     }
     $path = jailpath(DIAMONDMVC_ROOT . DS . 'registry', $_REQUEST['id'] . '.json');
     if (!is_file($path)) {
         $this->addMessage('Whoops!', $lang->get('ERROR_NO_META', 'ControllerSystem.Installation', 'error'));
         $this->result = array('success' => false, 'msg' => $lang->get('ERROR_NO_META', 'ControllerSystem.Installation'));
         return;
     }
     try {
         InstallationManager::uninstall($path);
         $this->result = array('success' => true);
     } catch (Exception $ex) {
         $this->result = array('success' => false, 'msg' => $ex->getMessage());
         $this->addMessage('Whoops!', 'An exception occurred: ' . $ex->getMessage(), 'error');
         logMsg('DiamondMVC: failed to uninstall installation ' . $_REQUEST['id'] . ' with exception: ' . $ex->getMessage(), 9, false);
     }
 }