From b00ce2f7c9aa11fa6bdbb1fbcc12d02a32ba03fc Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 18 Sep 2015 11:06:53 +0100 Subject: [PATCH] Get number of versions for this file --- lib/settings-common.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/settings-common.php b/lib/settings-common.php index 650404d..640ce7e 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -179,4 +179,40 @@ if (!function_exists('array_replace_recursive')) { return $base; } } + +// Get number of versions total for a file +function getVersionsCount($fileLoc,$fileName) { + $count = 0; + // Establish the base, host and date dirs within... + $backupDirBase = str_replace("\\","/",dirname(__FILE__))."/../backups/"; + $backupDirHost = isset($ftpSite) ? parse_url($ftpSite,PHP_URL_HOST) : "localhost"; + $backupDateDirs = scandir($backupDirBase.$backupDirHost); + // Get rid of . and .. from date dirs array + for ($i=0; $i