From b1623b2f3e9a97a7bed3aead1bbed6a50f3c9e4a Mon Sep 17 00:00:00 2001 From: Ying Date: Wed, 2 Aug 2023 18:17:09 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=A7=BB=E9=99=A4database=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/library/DataBase.php | 59 --------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 app/common/library/DataBase.php diff --git a/app/common/library/DataBase.php b/app/common/library/DataBase.php deleted file mode 100644 index e2c4797..0000000 --- a/app/common/library/DataBase.php +++ /dev/null @@ -1,59 +0,0 @@ -exec($line); - } catch (\Throwable $th) { - Log::info($th->getMessage()); - } - } - } - } - - /** - * 获取数据库文件表名 - * @param string $sqlFile - * @return array - */ - public static function getSqlTables(string $sqlFile): array - { - $regex = "/^CREATE\s+TABLE\s+(IF\s+NOT\s+EXISTS\s+)?`?([a-zA-Z_]+)`?/mi"; - $tables = []; - if (is_file($sqlFile)) { - preg_match_all($regex, file_get_contents($sqlFile), $matches); - if (isset($matches[2])) { - foreach ($matches[2] as $match) { - $tables[] = str_replace('__PREFIX__', get_env('DATABASE_PREFIX'), $match); - } - } - } - - return $tables; - } -} \ No newline at end of file