]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Fix restore group most recent backups for MySQL
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 9 Jan 2016 07:44:52 +0000 (08:44 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 9 Jan 2016 07:47:44 +0000 (08:47 +0100)
gui/baculum/protected/Class/JobManager.php

index c2670edcfd98311c9bdc69325d1ed25598310210..bb90b4401bdf44c9c8f34371e8e2a92fbcb88b80 100644 (file)
@@ -63,8 +63,17 @@ class JobManager extends TModule {
        }
 
        public function getRecentJobids($jobname, $clientid) {
-               $sql = "name='$jobname' AND clientid='$clientid' AND jobstatus IN ('T', 'W') AND level IN ('F', 'I', 'D') ORDER BY endtime DESC";
+               $sql = "name='$jobname' AND clientid='$clientid' AND jobstatus IN ('T', 'W') AND level IN ('F', 'I', 'D')";
                $finder = JobRecord::finder();
+               $criteria = new TActiveRecordCriteria;
+               $order = 'endtime';
+               $cfg = $this->Application->getModule('configuration');
+               $appCfg = $cfg->getApplicationConfig();
+               if($cfg->isPostgreSQLType($appCfg['db']['type'])) {
+                   $order = strtolower($order);
+               }
+               $criteria->OrdersBy[$order] = 'desc';
+               $criteria->Condition = $sql;
                $jobs = $finder->findAll($sql);
 
                $jobids = array();