Upgrade maintenance.php to handle remote server pointer arrays instead of flat files.

This commit is contained in:
Retro_Guy 2024-10-08 04:57:01 -07:00
parent bb7aae6656
commit 12b4660b19
1 changed files with 15 additions and 21 deletions

View File

@ -248,23 +248,17 @@ function reset_group($group, $remove = 0)
'.',
'outgoing'
));
foreach ($config_files as $config_file) {
$output = array();
echo $config_location . '/' . $config_file . "\n";
$thisfile = file($config_location . '/' . $config_file);
foreach ($thisfile as $thisgroupline) {
$onegroup = explode(':', $thisgroupline);
if (trim($onegroup[0]) == $group) {
echo "FOUND: " . $group . " in " . $section . "\n";
if ($remove == 0) {
$output[] = $group . "\n";
}
} else {
$output[] = $thisgroupline;
}
if (!str_ends_with($config_file, '_groups.dat')) {
continue;
}
file_put_contents($config_location . '/' . $config_file, $output);
$groups_array = unserialize(file_get_contents($config_location . '/' . $config_file));
if (isset($groups_array[$group])) {
echo "Current group pointer for " . $group . ": " . $groups_array[$group] . "\n";
$groups_array[$group] = '1';
echo "New group pointer for " . $group . ": " . $groups_array[$group] . "\n";
}
file_put_contents($config_location . '/' . $config_file, serialize($groups_array));
}
}
@ -298,12 +292,12 @@ function remove_articles($group)
$clear_stmt->execute();
$history_dbh = null;
rename($spooldir . '/' . $group . '-articles.db3', $spooldir . '/' . $group . '-articles.db3-removed');
unlink($spooldir . '/' . $group . '-data.db3');
unlink($spooldir . '/' . $group . '-info.txt');
unlink($spooldir . '/' . $group . '-cache.txt');
unlink($spooldir . '/' . $group . '-lastarticleinfo.dat');
unlink($spooldir . '/' . $group . '-overboard.dat');
@rename($spooldir . '/' . $group . '-articles.db3', $spooldir . '/' . $group . '-articles.db3-removed');
@unlink($spooldir . '/' . $group . '-data.db3');
@unlink($spooldir . '/' . $group . '-info.txt');
@unlink($spooldir . '/' . $group . '-cache.txt');
@unlink($spooldir . '/' . $group . '-lastarticleinfo.dat');
@unlink($spooldir . '/' . $group . '-overboard.dat');
}
function import_articles($group)