Skip to content

Commit

Permalink
Fixed SQL data storage initialization if PDO is set to throw exceptio…
Browse files Browse the repository at this point in the history
…n on error, bumped version to 1.8.1, updated changelog.
  • Loading branch information
itsgoingd committed Jul 6, 2015
1 parent 3971c52 commit 2eb7658
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
1.8.1
- fixed SQL data storage initialization if PDO is set to throw exception on error (thanks YOzaz)

1.8
- added SQL data storage implementation
- added new config options for data storage for Laravel
- added new config options for data storage for Laravel (please re-publish the config file)
- fixed not being able to use the Larvel route caching when using Clockwork (thanks Garbee, kylestev, cbakker86)

1.7
Expand Down
2 changes: 1 addition & 1 deletion Clockwork/Clockwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Clockwork implements LoggerInterface
/**
* Clockwork version
*/
const VERSION = '1.8';
const VERSION = '1.8.1';

/**
* Array of data sources, these objects provide data to be stored in a request object
Expand Down
8 changes: 7 additions & 1 deletion Clockwork/Storage/SqlStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ public function store(Request $request)
*/
public function initialize()
{
if ($this->pdo->query("SELECT 1 FROM {$this->table} LIMIT 1") !== false) {
try {
$initialized = $this->pdo->query("SELECT 1 FROM {$this->table} LIMIT 1");
} catch (\Exception $e) {
$initialized = false;
}

if ($initialized !== false) {
return;
}

Expand Down

0 comments on commit 2eb7658

Please sign in to comment.