Skip to content

Commit

Permalink
Moved add_message() for archiving to step.php where it's most correct
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Migurski committed Mar 4, 2012
1 parent e9674ef commit bab344e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions site/www/scan.php
Expand Up @@ -81,19 +81,7 @@
add_log($dbh, "Posting additional details to scan {$print['id']}");

$dbh->query('START TRANSACTION');

$scan = set_scan($dbh, $scan);

$message = array('action' => 'archive',
'manifest' => "{$scan['base_url']}/manifest.txt",
'href' => 'http://'.get_domain_name().get_base_dir().'/scan.php?id='.urlencode($scan['id']),
'access' => ARCHIVE_ACCESS_KEY,
'secret' => ARCHIVE_SECRET_KEY,
'bucket' => "walkingpapers-scan-{$scan['id']}-by-{$scan['user_id']}");

if(ARCHIVE_SECRET_KEY)
add_message($dbh, json_encode($message));

$dbh->query('COMMIT');
}
}
Expand Down
14 changes: 14 additions & 0 deletions site/www/step.php
Expand Up @@ -70,6 +70,20 @@
} else {
add_log($dbh, "Adding step {$step_number} to scan {$scan_id}");
add_step($dbh, $scan_id, $step_number);

if(ARCHIVE_SECRET_KEY && $step_number == STEP_FINISHED)
{
$scan = get_scan($dbh, $scan_id);

$message = array('action' => 'archive',
'manifest' => "{$scan['base_url']}/manifest.txt",
'href' => 'http://'.get_domain_name().get_base_dir().'/scan.php?id='.urlencode($scan['id']),
'access' => ARCHIVE_ACCESS_KEY,
'secret' => ARCHIVE_SECRET_KEY,
'bucket' => "paperwalking-scan-{$scan['id']}-by-{$scan['user_id']}");

add_message($dbh, json_encode($message));
}
}

echo "OK\n";
Expand Down

0 comments on commit bab344e

Please sign in to comment.