From f2451ac8523209909e488a40e47674e13e8048f9 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sat, 9 Jan 2016 08:44:52 +0100 Subject: [PATCH] baculum: Fix restore group most recent backups for MySQL --- gui/baculum/protected/Class/JobManager.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gui/baculum/protected/Class/JobManager.php b/gui/baculum/protected/Class/JobManager.php index c2670edcfd..bb90b4401b 100644 --- a/gui/baculum/protected/Class/JobManager.php +++ b/gui/baculum/protected/Class/JobManager.php @@ -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(); -- 2.39.5