aboutsummaryrefslogtreecommitdiff
path: root/caches/SQLiteCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'caches/SQLiteCache.php')
-rw-r--r--caches/SQLiteCache.php38
1 files changed, 11 insertions, 27 deletions
diff --git a/caches/SQLiteCache.php b/caches/SQLiteCache.php
index 2f798714..339e4119 100644
--- a/caches/SQLiteCache.php
+++ b/caches/SQLiteCache.php
@@ -13,38 +13,32 @@ class SQLiteCache implements CacheInterface
public function __construct()
{
if (!extension_loaded('sqlite3')) {
- print render('error.html.php', ['message' => '"sqlite3" extension not loaded. Please check "php.ini"']);
- exit;
+ throw new \Exception('"sqlite3" extension not loaded. Please check "php.ini"');
}
if (!is_writable(PATH_CACHE)) {
- returnServerError(
- 'RSS-Bridge does not have write permissions for '
- . PATH_CACHE . '!'
- );
+ throw new \Exception('The cache folder is not writable');
}
$section = 'SQLiteCache';
$file = Configuration::getConfig($section, 'file');
if (empty($file)) {
- $message = sprintf('Configuration for %s missing. Please check your %s', $section, FILE_CONFIG);
- print render('error.html.php', ['message' => $message]);
- exit;
+ throw new \Exception(sprintf('Configuration for %s missing.', $section));
}
+
if (dirname($file) == '.') {
$file = PATH_CACHE . $file;
} elseif (!is_dir(dirname($file))) {
- $message = sprintf('Invalid configuration for %s. Please check your %s', $section, FILE_CONFIG);
- print render('error.html.php', ['message' => $message]);
- exit;
+ throw new \Exception(sprintf('Invalid configuration for %s', $section));
}
if (!is_file($file)) {
- $this->db = new SQLite3($file);
+ // The instantiation creates the file
+ $this->db = new \SQLite3($file);
$this->db->enableExceptions(true);
$this->db->exec("CREATE TABLE storage ('key' BLOB PRIMARY KEY, 'value' BLOB, 'updated' INTEGER)");
} else {
- $this->db = new SQLite3($file);
+ $this->db = new \SQLite3($file);
$this->db->enableExceptions(true);
}
$this->db->busyTimeout(5000);
@@ -55,8 +49,8 @@ class SQLiteCache implements CacheInterface
$Qselect = $this->db->prepare('SELECT value FROM storage WHERE key = :key');
$Qselect->bindValue(':key', $this->getCacheKey());
$result = $Qselect->execute();
- if ($result instanceof SQLite3Result) {
- $data = $result->fetchArray(SQLITE3_ASSOC);
+ if ($result instanceof \SQLite3Result) {
+ $data = $result->fetchArray(\SQLITE3_ASSOC);
if (isset($data['value'])) {
return unserialize($data['value']);
}
@@ -81,7 +75,7 @@ class SQLiteCache implements CacheInterface
$Qselect = $this->db->prepare('SELECT updated FROM storage WHERE key = :key');
$Qselect->bindValue(':key', $this->getCacheKey());
$result = $Qselect->execute();
- if ($result instanceof SQLite3Result) {
+ if ($result instanceof \SQLite3Result) {
$data = $result->fetchArray(SQLITE3_ASSOC);
if (isset($data['updated'])) {
return $data['updated'];
@@ -98,10 +92,6 @@ class SQLiteCache implements CacheInterface
$Qdelete->execute();
}
- /**
- * Set scope
- * @return self
- */
public function setScope($scope)
{
if (is_null($scope) || !is_string($scope)) {
@@ -112,10 +102,6 @@ class SQLiteCache implements CacheInterface
return $this;
}
- /**
- * Set key
- * @return self
- */
public function setKey($key)
{
if (!empty($key) && is_array($key)) {
@@ -131,8 +117,6 @@ class SQLiteCache implements CacheInterface
return $this;
}
- ////////////////////////////////////////////////////////////////////////////
-
private function getCacheKey()
{
if (is_null($this->key)) {
on> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/child-process-stdio.test.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-01-21Remove UB with `semver.String`Gravatar Jarred Sumner 4-35/+47
2023-01-21[buffer] Add faster path for Uint8ArrayGravatar Jarred Sumner 2-1/+13
2023-01-21Handle string subclasses and new String() in new BufferGravatar Jarred Sumner 1-2/+11
2023-01-21Make Buffer.alloc* 3ns fasterGravatar Jarred Sumner 1-11/+17
2023-01-21[buffer] Make Buffer.from pass more testsGravatar Jarred Sumner 4-92/+179
2023-01-20constructor parameter properties in class expressions (#1867)Gravatar Dylan Conway 2-8/+48
2023-01-20Update transpiler.test.jsbun-v0.5.1Gravatar Jarred Sumner 1-1/+1
2023-01-20Update transpiler.test.jsGravatar Jarred Sumner 1-1/+1
2023-01-20push super before generated statements (#1856)Gravatar Dylan Conway 2-29/+53
2023-01-20Clear the errorsGravatar Jarred Sumner 1-0/+2
2023-01-20one less hash tableGravatar Jarred Sumner 1-2/+13
2023-01-20Add another testGravatar Jarred Sumner 2-1/+11
2023-01-20fix hanging testGravatar Jarred Sumner 1-38/+42
2023-01-20Further cleanup buffer encodingGravatar Jarred Sumner 1-48/+26
2023-01-20Fixes #1855Gravatar Jarred Sumner 2-5/+57
2023-01-20Fix assertion failure with boringssl messagesGravatar Jarred Sumner 3-5/+132
2023-01-19Revert "ignore sighup"Gravatar Jarred Sumner 1-45/+10
2023-01-19ignore sighupGravatar Jarred Sumner 1-10/+45
2023-01-19make this code easier to readGravatar Jarred Sumner 3-29/+26
2023-01-19Update types.zigGravatar Jarred Sumner 1-4/+0
2023-01-19BumpGravatar Jarred Sumner 2-2/+2
2023-01-19Fix buffer encoding bugGravatar Jarred Sumner 2-4/+17
2023-01-19use `String.from()` (#1850)Gravatar Alex Lam S.L 4-5/+12
2023-01-19Bump zigGravatar Jarred Sumner 2-2/+2
2023-01-19make it packedGravatar Jarred Sumner 1-2/+2
2023-01-20Bugfixes to install (#1848)Gravatar Jarred Sumner 5-26/+119
2023-01-19repopulate `alias_map` correctly (#1847)Gravatar Alex Lam S.L 5-70/+240
2023-01-19Add a commentGravatar Jarred Sumner 1-0/+6
2023-01-19Add a debug safety check for UAF in AST nodesGravatar Jarred Sumner 1-0/+5
2023-01-19Fix UAF when opening workspacesGravatar Jarred Sumner 1-2/+0
2023-01-19Improve error message when a workspace is not foundGravatar Jarred Sumner 2-9/+97