From 20dff36e4edaff47ae22e3974101d50cfb0c4ec0 Mon Sep 17 00:00:00 2001 From: "Robert J. Lang" Date: Wed, 28 Dec 2022 07:00:53 -0800 Subject: [PATCH 1/2] Update santize script to include CiviCRM db backups if they exist --- index.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 588a778..7863c39 100755 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ $name) { - $databases = array(); - $files = array(); - - exec("ls $path/sanitized/*.sql.gz", $databases); + $dbs = $dbs_civi = $files = array(); + exec("ls $path/sanitized/*.sql.gz", $dbs); + exec("ls $path/sanitized_civi/*.sql.gz", $dbs_civi); exec("ls $path/files_backups/*.tar.gz", $files); - foreach (array_reverse($databases) as $id => $database) { - create_row($name, $database, array_reverse($files)[$id]); + $r_dbs = array_reverse($dbs); + $r_dbs_civi = array_reverse($dbs_civi); + $r_files = array_reverse($files); + foreach ($r_dbs as $id => $db) { + create_row($name, $db, (isset($r_dbs_civi[$id]) ? $r_dbs_civi[$id] : ''), $r_files[$id]); } } } @@ -25,7 +27,7 @@ function table_rows() { /** * Print the HTML for a single table row. */ -function create_row($name, $db_path, $file_path) { +function create_row($name, $db_path, $db_civi_path, $file_path) { $class = ''; $db_path_parts = explode('/', $db_path); $db_filename_parts = explode('-', $db_path_parts[2]); @@ -40,12 +42,13 @@ function create_row($name, $db_path, $file_path) { $host = filter_input(INPUT_SERVER, 'HTTP_HOST'); $db_link = sprintf('Database', $host, $db_path); + $db_civi_link = sprintf('CiviCRM', $host, $db_civi_path); $file_link = sprintf('Files', $host, $file_path); print ' ' . $name . ' ' . $date . ' - ' . $db_link . ' :: ' . $file_link . ' + ' . $db_link . ' :: ' . (!empty($db_civi_path) ? $db_civi_link . ' :: ' : '') . $file_link . ' '; } ?> From 0bdc7f7d880e7dccd43e12c2edecdf55958328e1 Mon Sep 17 00:00:00 2001 From: "Robert J. Lang" Date: Wed, 28 Dec 2022 17:47:40 -0800 Subject: [PATCH 2/2] Swap argument order. --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 7863c39..4a39e44 100755 --- a/index.php +++ b/index.php @@ -19,7 +19,7 @@ function table_rows() { $r_dbs_civi = array_reverse($dbs_civi); $r_files = array_reverse($files); foreach ($r_dbs as $id => $db) { - create_row($name, $db, (isset($r_dbs_civi[$id]) ? $r_dbs_civi[$id] : ''), $r_files[$id]); + create_row($name, $db, $r_files[$id], (isset($r_dbs_civi[$id]) ? $r_dbs_civi[$id] : '')); } } } @@ -27,7 +27,7 @@ function table_rows() { /** * Print the HTML for a single table row. */ -function create_row($name, $db_path, $db_civi_path, $file_path) { +function create_row($name, $db_path, $file_path, $db_civi_path) { $class = ''; $db_path_parts = explode('/', $db_path); $db_filename_parts = explode('-', $db_path_parts[2]);