Skip to content

Commit

Permalink
phoromatic: Don't attempt to open DB in read-only mode if phoromatic.…
Browse files Browse the repository at this point in the history
…db not yet made
  • Loading branch information
michaellarabel committed Mar 23, 2015
1 parent 42d7246 commit 0463bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGE-LOG
Expand Up @@ -12,6 +12,7 @@ Phoronix Test Suite (Git)
- phoromatic: Add universal search functionality from web interface
- phoromatic: Improve formatting of annotations
- phoromatic: Mark system state as unknown when communication fails and hits the event server check
- phoromatic: Don't attempt to open DB in read-only mode if phoromatic.db not yet made

Phoronix Test Suite 5.6 Milestone 5
11 March 2015
Expand Down
8 changes: 5 additions & 3 deletions pts-core/objects/phoromatic_server.php
Expand Up @@ -84,18 +84,20 @@ public static function prepare_database($read_only = false)
}

$db_file = self::phoromatic_path() . 'phoromatic.db';

$db_flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE;
if($read_only)

if($read_only && is_file($db_file))
{
$db_flags = SQLITE3_OPEN_READONLY;
}

self::$db = new SQLite3($db_file, $db_flags);
self::$db->busyTimeout(5000);

if($read_only)
if($read_only && is_file($db_file))
{
return true;
}

switch(self::read_database_version())
{
Expand Down

0 comments on commit 0463bb4

Please sign in to comment.