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){
// 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]));
}
}