From e80a2610d5b29b35fa7a787bb5e8ae72c856c2c8 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 14 Nov 2018 00:02:29 +0100 Subject: Matching tournament prefixes and rounds in board DB against URI parts, not the other way around. Fixes #1 --- tdd/tdd-bootstrap.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tdd/tdd-bootstrap.php') diff --git a/tdd/tdd-bootstrap.php b/tdd/tdd-bootstrap.php index 6efbf7b..03dc621 100644 --- a/tdd/tdd-bootstrap.php +++ b/tdd/tdd-bootstrap.php @@ -14,7 +14,7 @@ class Protocol { static::$translations = json_decode(file_get_contents('translations.json'), TRUE); } $this->deals_by_tables = array(); - if(!file_exists($this->get_filename())) { + if (!file_exists($this->get_filename())) { throw new Exception('file not found: ' . $this->get_filename()); } } @@ -190,8 +190,9 @@ class Deal { define('TIMESTAMP_FILE', '.tdd-timestamps.cache'); define('RECORDS_FILE', '.tdd-records.cache'); -function load_deals_for_tables($prefix, $round, $board_in_teamy) { - $db = unserialize(file_get_contents(RECORDS_FILE)); +$board_database = unserialize(file_get_contents(RECORDS_FILE)); + +function load_deals_for_tables($db, $prefix, $round, $board_in_teamy) { if (isset($db[$prefix])) { if (isset($db[$prefix][$round])) { if (isset($db[$prefix][$round][$board_in_teamy])) { @@ -214,6 +215,7 @@ function get_files_timestamps($files = array()) { } function compile_record_database($files, $dbFile) { + global $board_database; $db = array(); foreach ($files as $filename) { $filename = basename($filename); @@ -263,6 +265,7 @@ function compile_record_database($files, $dbFile) { } } file_put_contents(RECORDS_FILE, serialize($db)); + $board_database = $db; } function refresh_board_database() { -- cgit v1.2.3