diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-06-19 16:20:00 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-06-19 16:20:00 -0300 |
commit | 692c21fd3788af7a5c22cca2c271650b0a9f24e8 (patch) | |
tree | 07c9c131df5293468765dded0cc7ddcae0648593 /etc/inc | |
parent | 3f0c20c3cd022925063d4c9b8d24a1f91fd8ca07 (diff) | |
download | pfsense-692c21fd3788af7a5c22cca2c271650b0a9f24e8.zip pfsense-692c21fd3788af7a5c22cca2c271650b0a9f24e8.tar.gz |
Remove more backtick abuse
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/config.lib.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 64cbf0a..69a4811 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -190,13 +190,17 @@ function generate_config_cache($config) { } function discover_last_backup() { - $backups = explode("\n", `cd /cf/conf/backup && ls -ltr *.xml | awk '{print \$9}'`); + $backups = glob('/cf/conf/backup/*.xml'); $last_backup = ""; - foreach($backups as $backup) - if($backup) - $last_backup = $backup; + $last_mtime = 0; + foreach($backups as $backup) { + if(filemtime($backup) > $last_mtime) { + $last_mtime = filemtime($backup); + $last_backup = $backup; + } + } - return $last_backup; + return basename($last_backup); } function restore_backup($file) { |