From 3122f858483d2fd7be208c151491f0fa48782055 Mon Sep 17 00:00:00 2001 From: Chad Chadbourne Date: Wed, 24 Mar 2021 07:31:20 -0400 Subject: [PATCH] fix a bug that prevented database creation for new installs --- src/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/functions.php b/src/functions.php index 3ba8f61..ef5727d 100644 --- a/src/functions.php +++ b/src/functions.php @@ -70,6 +70,12 @@ function is_tag() { */ function is_legacy_db() { $file = $_SERVER['alfred_workflow_data'] . '/gifomattic.db'; + + // Check if a database exists. If not, set up a workflow folder to put the database in. + if ( ! file_exists( $file ) ) { + mkdir( $_SERVER['alfred_workflow_data'] ); + } + $db = new sqlite3( $file ); $query = 'PRAGMA table_info( gifs )'; $result = $db->query( $query );