From ae5afc643d0cca1ce94865c0826a65064cb70243 Mon Sep 17 00:00:00 2001 From: Armanveer Gill Date: Tue, 28 Jan 2025 14:59:38 -0500 Subject: [PATCH] FIx remove data features --- config/backuprestore.php | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/config/backuprestore.php b/config/backuprestore.php index 6986a2c8..e2c574d1 100644 --- a/config/backuprestore.php +++ b/config/backuprestore.php @@ -241,7 +241,7 @@ else if (get_value_from_array($_POST, 'action') == 'clean_judges') { if ($deletable->rowCount() > 0){ // delete old data one by one while ($old_judge_data = $deletable->fetch(PDO::FETCH_ASSOC)){ - if (!is_array($old_judge_data['type'])){ + if (!isset($old_judge_data['type']) && !is_array($old_judge_data['type'])){ $old_judge_data['types'] = array($old_judge_data['types']); } user_purge($old_judge_data, 'judge'); @@ -262,15 +262,11 @@ else if (get_value_from_array($_POST, 'action') == 'clean_judges') { $stmt = $pdo->prepare("OPTIMIZE TABLE users, users_judge"); $stmt->execute(); - $str = $pdo->errorInfo(); - - echo $str; - - if($str == '') + if($pdo->errorInfo()[0] == 00000) { echo happy(i18n("Old judge data purged.")); - - else{ - error(i18n($str));} + } else { + error(i18n($pdo->errorInfo()[0])); + } } else if (get_value_from_array($_POST, 'action') == 'clean_parents') { @@ -296,15 +292,11 @@ else if (get_value_from_array($_POST, 'action') == 'clean_parents') { $stmt = $pdo->prepare("OPTIMIZE TABLE users, users_parent"); $stmt->execute(); - $str = $pdo->errorInfo(); - - echo $str; - - if($str == '') + if($pdo->errorInfo()[0] == 00000) { echo happy(i18n("Old parent data purged.")); - - else{ - error(i18n($str));} + } else { + error(i18n($pdo->errorInfo()[0])); + } }