Exemplo n.º 1
0
                    $oDBRS = new DBRestore($sDBHost, $sDBUser, $sDBPwd, $sDBName, $sDBSubName);
                    $oDBRS->SetMySQLBinDir($sMySQLBinDir);
                    $sBackupDir = APPROOT . 'data/backups/';
                    $sBackupFile = $sBackupDir . $sFile;
                    $sRes = $oDBRS->RestoreFromZip($sBackupFile, $sEnvironment);
                    IssueLog::Info('Backup Restore - Done, releasing the LOCK');
                    $oRestoreMutex->Unlock();
                } catch (Exception $e) {
                    $oRestoreMutex->Unlock();
                    $oPage->p('Error: ' . $e->getMessage());
                }
            }
            $oPage->output();
            break;
        case 'download':
            require_once APPROOT . '/application/startup.inc.php';
            require_once APPROOT . '/application/loginwebpage.class.inc.php';
            LoginWebPage::DoLogin(true);
            // Check user rights and prompt if needed (must be admin)
            if (utils::GetConfig()->Get('demo_mode')) {
                throw new Exception('iTop is in demonstration mode: the feature is disabled');
            }
            $sFile = utils::ReadParam('file', '', false, 'raw_data');
            $oBackup = new DBBackupScheduled();
            $sBackupDir = APPROOT . 'data/backups/';
            $oBackup->DownloadBackup($sBackupDir . $sFile);
            break;
    }
} catch (Exception $e) {
    IssueLog::Error($e->getMessage());
}