FIx remove data features

This commit is contained in:
Armanveer Gill 2025-01-28 14:59:38 -05:00
parent bb807eab04
commit ae5afc643d

View File

@ -241,7 +241,7 @@ else if (get_value_from_array($_POST, 'action') == 'clean_judges') {
if ($deletable->rowCount() > 0){ if ($deletable->rowCount() > 0){
// delete old data one by one // delete old data one by one
while ($old_judge_data = $deletable->fetch(PDO::FETCH_ASSOC)){ 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']); $old_judge_data['types'] = array($old_judge_data['types']);
} }
user_purge($old_judge_data, 'judge'); 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 = $pdo->prepare("OPTIMIZE TABLE users, users_judge");
$stmt->execute(); $stmt->execute();
$str = $pdo->errorInfo(); if($pdo->errorInfo()[0] == 00000) {
echo $str;
if($str == '')
echo happy(i18n("Old judge data purged.")); echo happy(i18n("Old judge data purged."));
} else {
else{ error(i18n($pdo->errorInfo()[0]));
error(i18n($str));} }
} }
else if (get_value_from_array($_POST, 'action') == 'clean_parents') { 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 = $pdo->prepare("OPTIMIZE TABLE users, users_parent");
$stmt->execute(); $stmt->execute();
$str = $pdo->errorInfo(); if($pdo->errorInfo()[0] == 00000) {
echo $str;
if($str == '')
echo happy(i18n("Old parent data purged.")); echo happy(i18n("Old parent data purged."));
} else {
else{ error(i18n($pdo->errorInfo()[0]));
error(i18n($str));} }
} }