Пример #1
0
 protected function runUntrustedAction($action)
 {
     switch ($action) {
         case 'backup':
             include_once 'HTTP/Download.php';
             include_once 'Archive/Tar.php';
             if (!$this->data_engine->dump(TIP::buildDataPath('dump'))) {
                 TIP::notifyError('backup');
                 return false;
             }
             $tar_file = TIP::buildCachePath($this->id . '-' . TIP::formatDate('date_sql') . '.tar.gz');
             $tar_object = new Archive_Tar($tar_file, 'gz');
             $result = $tar_object->createModify(TIP::buildDataPath(), '', TIP::buildPath());
             unset($tar_object);
             if ($result !== true) {
                 return false;
             }
             HTTP_Download::staticSend(array('file' => $tar_file, 'contenttype' => 'application/x-gzip', 'contentdisposition' => HTTP_DOWNLOAD_ATTACHMENT));
             exit;
     }
     return null;
 }