]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Use new bvfs cleanup endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 2 Feb 2019 05:32:29 +0000 (06:32 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 2 Feb 2019 05:32:29 +0000 (06:32 +0100)
gui/baculum/protected/API/Pages/API/RestoreRun.php
gui/baculum/protected/Web/Pages/RestoreWizard.php

index b01d138c3fc50b9481a405f9c722f51486f910ff..31ff347d91cab6854beccbe8b9d4195bf98274aa 100644 (file)
@@ -115,35 +115,8 @@ class RestoreRun extends BaculumAPIServer {
                $command[] = 'yes';
 
                $restore = $this->getModule('bconsole')->bconsoleCommand($this->director, $command);
-               $this->removeTmpRestoreTable($rfile);
                $this->output = $restore->output;
                $this->error = $restore->exitcode;
        }
-
-       private function removeTmpRestoreTable($tableName) {
-               $misc = $this->getModule('misc');
-               if (preg_match($misc::RPATH_PATTERN, $tableName) === 1) {
-                       // @TODO: Move it to API module. It shouldn't look like here.
-                       $db_params = $this->getModule('api_config')->getConfig('db');
-                       $connection = APIDbModule::getAPIDbConnection($db_params);
-                       $connection->setActive(true);
-                       $sql = "DROP TABLE $tableName";
-                       $pdo = $connection->getPdoInstance();
-                       try {
-                               $pdo->exec($sql);
-                       } catch(PDOException $e) {
-                               $emsg = 'Problem during delete temporary Bvfs table. ' . $e->getMessage();
-                               $this->getModule('logging')->log(
-                                       __FUNCTION__,
-                                       $emsg,
-                                       Logging::CATEGORY_APPLICATION,
-                                       __FILE__,
-                                       __LINE__
-                               );
-                       }
-                       $pdo = null;
-               }
-       }
 }
-
 ?>
index ecb4cda8c80d1331930706a39231eca36e601d0d..941d2a8b9b71195aad6fd33f39050229016b7ae4 100644 (file)
@@ -813,6 +813,8 @@ class RestoreWizard extends BaculumWebPage
 
                        $ret = $this->getModule('api')->create(array('jobs', 'restore'), $restore_props);
                        $jobid = $this->getModule('misc')->findJobIdStartedJob($ret->output);
+                       // Remove temporary BVFS table
+                       $this->getModule('api')->set(array('bvfs', 'cleanup'), array('path' => $path));
                }
                $url_params = array();
                if (is_numeric($jobid)) {