Conditions | 6 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public static function database(&$dice) |
||
23 | { |
||
24 | $f3 = \Base::instance(); |
||
25 | $cache = \Cache::instance(); |
||
26 | // cli mode will not use cache on cli and will check db every time if in dev mode |
||
27 | if ($f3->get('db.create') && (!$cache->exists('tables', $tables) || PHP_SAPI == 'cli' || 'dev' == $f3->get('app.env'))) { |
||
28 | $db = $dice->create('DB\\SQL'); |
||
29 | $tables = $db->exec('SHOW TABLES'); |
||
30 | if (empty($tables)) { |
||
31 | $sql = $f3->get('HOMEDIR') . '/data/db/sql/create.sql'; |
||
32 | $db->exec(file_get_contents($sql)); |
||
33 | $tables = $db->exec('SHOW TABLES'); |
||
34 | } |
||
35 | $cache->set('tables', $tables, 600); |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |