main
fuzzykitten 2025-07-04 14:03:53 -04:00
parent e42690dd75
commit 86bb32926c
2 changed files with 20 additions and 15 deletions

View File

@ -254,14 +254,16 @@ function dolly_check($db, $settings, $post)
$statement->execute();
$import_message = "message $post_id from sub $sub imported";
log_event($db, $settings, 'import', $import_message, '');
// echo "$import_message";
} else {
$import_message = "message $post_id from sub $sub"
. " existed already and was not imported";
log_event($db, $settings, 'import', $import_message, '');
if ( $post_id == $org_id ) {
return TRUE;
}
// echo "$import_message";
// if ( $post_id == $org_id ) {
// return TRUE;
// }
}
}
@ -291,7 +293,9 @@ function dolly_collect($db, $settings)
// get posts from a single host
function dolly_get($db, $settings, $context, $clone)
{
$watermark_file = $settings['work_dir'] . 'watermark_' . $clone . '.txt';
$name = filter($clone, 'alnum', 100);
// 100 chars should be enough
$watermark_file = $settings['work_dir'] . 'watermark_' . $name . '.txt';
if ( file_exists($watermark_file) ) {
$start_value = file_get_contents($watermark_file);
@ -320,11 +324,12 @@ function dolly_get($db, $settings, $context, $clone)
file_put_contents($watermark_file, $stop);
foreach($board_list as $post) {
$complete = dolly_check($db, $settings, $post);
// $complete = dolly_check($db, $settings, $post);
dolly_check($db, $settings, $post);
if ( $complete == TRUE ) {
return;
}
// if ( $complete == TRUE ) {
// return;
// }
}
}
@ -334,13 +339,15 @@ function dolly_get($db, $settings, $context, $clone)
// Dump the contents of the board to a json
// file and send it to the browser/other host.
function dolly_share($db, $start, $end, $settings)
function dolly_share($db, $start, $settings)
{
header( 'Content-Type: application/json' );
$json_dump = array();
$end = $settings['dolly_step'];
$statement = $db->prepare("SELECT post_id, text, global_id, org_id,
timestamp, name, host, replied_to,
sub
@ -1004,9 +1011,9 @@ function set_quote()
{
if (get_pretty_vars_count() == 6) {
$quote = read_pretty_vars(4, 'alnum', 10);
$quote = read_pretty_vars(4, 'email', 30);
// read from fourth position, and a post id does not need more
// than 10 digits
// than 30 digits
} else {
$quote = '';
}

View File

@ -410,9 +410,7 @@ switch($mode) {
case 'dolly':
$start = read_pretty_vars(2, 'number', 10);
// 10 digits is enough (means billions of posts)
$stop = read_pretty_vars(3, 'number', 10);
// 10 digits is enough (means billions of posts)
dolly_share($db, $start, $stop, $settings);
dolly_share($db, $start, $settings);
quit($db, "");
// exports a thread, a sub or the whole board to a json file