Skip to content

Commit 7507f0c

Browse files
author
Yutaro Iiyama
committed
web bugfix
1 parent dc7d095 commit 7507f0c

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

web/cgi-bin/dynamo/detox/check_cache.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ function check_cache($history_db, $cycle, $partition_id, $snapshot_spool_path, $
2626
$stmt->close();
2727

2828
if ($num_replica_table == 0 || $num_site_table == 0) {
29-
$sqlite_file_name = sprintf('%s/snapshot_%d.db', $snapshot_spool_path, $cycle);
29+
$sqlite_file_name = sprintf('%s/snapshot_%09d.db', $snapshot_spool_path, $cycle);
3030

3131
if (!file_exists($sqlite_file_name)) {
3232
$srun = sprintf('%09d', $cycle);
33-
$xz_file_name = sprintf('%s/%s/%s/snapshot_%d.db.xz', $snapshot_archive_path, substr($srun, 0, 3), substr($srun, 3, 3), $cycle);
33+
$xz_file_name = sprintf('%s/%s/%s/snapshot_%09d.db.xz', $snapshot_archive_path, substr($srun, 0, 3), substr($srun, 3, 3), $cycle);
3434
if (!file_exists($xz_file_name))
3535
return false;
3636

@@ -39,6 +39,7 @@ function check_cache($history_db, $cycle, $partition_id, $snapshot_spool_path, $
3939
return false;
4040

4141
exec(sprintf('unxz -k -c %s > %s', $xz_file_name, $sqlite_file_name));
42+
chmod($sqlite_file_name, 0666);
4243
}
4344

4445
$snapshot_db = new SQLite3($sqlite_file_name);

web/cgi-bin/dynamo/detox/main.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@
123123
$dataset_pattern = str_replace('_', '\_', $pattern);
124124
$dataset_pattern = str_replace('*', '%', $dataset_pattern);
125125
$dataset_pattern = str_replace('?', '_', $dataset_pattern);
126-
126+
127127
$stmt = $history_db->prepare($query);
128128
$stmt->bind_param('s', $dataset_pattern);
129129
$stmt->bind_result($site_name, $dataset_name, $size, $decision, $condition_id);
130130
$stmt->execute();
131-
131+
132132
$condition_ids = array();
133133

134134
$json_data = array();
@@ -256,6 +256,7 @@
256256

257257
$query = 'SELECT s.`id`, s.`name`, c.`status`, c.`quota` FROM ' . $site_cache_table_name . ' AS c';
258258
$query .= ' INNER JOIN `sites` AS s ON s.`id` = c.`site_id`';
259+
$query .= ' ORDER BY s.`name`';
259260

260261
$stmt = $history_db->prepare($query);
261262
$stmt->bind_result($site_id, $site_name, $status, $quota);
@@ -291,7 +292,7 @@
291292
$stmt->bind_result($site_id, $decision, $size);
292293
$stmt->execute();
293294
while ($stmt->fetch()) {
294-
if (!in_array($site_id, $id_to_site))
295+
if (!array_key_exists($site_id, $id_to_site))
295296
continue;
296297

297298
$idx = $id_to_site[$site_id];
@@ -312,7 +313,7 @@
312313
$stmt->bind_result($site_id, $decision, $size);
313314
$stmt->execute();
314315
while ($stmt->fetch()) {
315-
if (!in_array($site_id, $id_to_site))
316+
if (!array_key_exists($site_id, $id_to_site))
316317
continue;
317318

318319
$idx = $id_to_site[$site_id];

0 commit comments

Comments
 (0)