diff --git a/webfiori/framework/App.php b/webfiori/framework/App.php index 191f6ba84..49771f9ef 100644 --- a/webfiori/framework/App.php +++ b/webfiori/framework/App.php @@ -542,7 +542,7 @@ private function initFrameworkVersionInfo() { * * @since 2.1 */ - define('WF_VERSION', '3.0.0-Beta.6'); + define('WF_VERSION', '3.0.0-Beta.7'); /** * A constant that tells the type of framework version. * @@ -558,7 +558,7 @@ private function initFrameworkVersionInfo() { * * @since 2.1 */ - define('WF_RELEASE_DATE', '2024-05-12'); + define('WF_RELEASE_DATE', '2024-05-13'); } /** diff --git a/webfiori/framework/cli/commands/RunSQLQueryCommand.php b/webfiori/framework/cli/commands/RunSQLQueryCommand.php index d1e2a6690..34810332a 100644 --- a/webfiori/framework/cli/commands/RunSQLQueryCommand.php +++ b/webfiori/framework/cli/commands/RunSQLQueryCommand.php @@ -122,7 +122,11 @@ private function connectionBased($dbConnections) : int { if ($file !== null) { $fileObj = new File(ROOT_PATH.DS.$file); - + + if (!$fileObj->isExist()) { + $fileObj = new File($file); + } + if ($fileObj->isExist()) { $fileObj->read(); $mime = $fileObj->getMIME(); @@ -135,7 +139,12 @@ private function connectionBased($dbConnections) : int { return -1; } } else { - $this->error('No such file: '.$file); + $path = $fileObj->getAbsolutePath(); + + if (strlen($path) == 0) { + $path = $file; + } + $this->error('No such file: '.$path); return -1; } @@ -201,24 +210,30 @@ private function queryFromFile($schema) { while (!File::isFileExist($filePath)) { $filePath = $this->getInput('File path:'); - + $modified = ROOT_PATH.DS.$filePath; + + if (File::isFileExist($modified)) { + $filePath = $modified; + } + if (File::isFileExist($filePath)) { $file = new File($filePath); $file->read(); - - if ($file->getMIME() == 'application/sql') { + $mime = $file->getMIME(); + + if ($mime == 'application/sql' || $mime == 'application/x-sql') { break; } else { $this->error('Provided file is not SQL file!'); } } else { - $this->error('No such file!'); + $this->error('No such file: '.$filePath); } } return $this->runFileQuery($schema, $file); } - + private function queryOnSchema(DB $schema) { if ($this->isArgProvided('--create')) { $schema->createTables();