示例#1
0
 public static function doDBBackup()
 {
     if (lC_Backup_Admin::backup($_GET['compression'], false)) {
         $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     }
     echo json_encode($result);
 }
示例#2
0
 function __construct()
 {
     global $lC_Language;
     $this->_page_title = $lC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     if (!empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'backup':
                 if (lC_Backup_Admin::backup($_GET['compression'], isset($_GET['download_only']) && $_GET['download_only'] == 'yes' ? true : false)) {
                     return true;
                 } else {
                     return false;
                 }
                 break;
             case 'download':
                 $filename = basename($_GET['file']);
                 $extension = substr($filename, -3);
                 if ($extension == 'zip' || $extension == '.gz' || $extension == 'sql') {
                     if (file_exists(DIR_FS_BACKUP . $filename)) {
                         if ($fp = fopen(DIR_FS_BACKUP . $filename, 'rb')) {
                             $buffer = fread($fp, filesize(DIR_FS_BACKUP . $filename));
                             fclose($fp);
                             header('Content-type: application/x-octet-stream');
                             header('Content-disposition: attachment; filename=' . $filename);
                             echo $buffer;
                             exit;
                         }
                     }
                 }
                 break;
             case 'restoreLocal':
                 if (lC_Backup_Admin::restore()) {
                     $_SESSION['restoreLocal'] = true;
                     return true;
                 } else {
                     return false;
                 }
                 break;
         }
     }
 }
示例#3
0
 public static function batchDelete($batch)
 {
     foreach ($batch as $id) {
         lC_Backup_Admin::delete($id);
     }
     return true;
 }
示例#4
0
 /**
  * Restore from last DB backup
  *  
  * @access public      
  * @return boolean
  */
 public static function lastDBRestore()
 {
     $lastBackup = self::__getLastDBBackup();
     try {
         lC_Backup_Admin::restore($lastBackup['name']);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
示例#5
0
 public static function doForget()
 {
     if (lC_Backup_Admin::forget()) {
         $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     }
     echo json_encode($result);
 }