getPath()) . '/Admin/Install/db.json'; if (!\file_exists($path)) { return; } $content = \file_get_contents($path); if ($content === false) { return; } $definitions = \json_decode($content, true); $builder = new SchemaBuilder($dbPool->get('schema')); $builder->prefix($dbPool->get('schema')->prefix); foreach ($definitions as $definition) { $builder->dropTable($definition['table'] ?? ''); } $builder->execute(); } /** * Unregister module from database. * * @param DatabasePool $dbPool Database instance * @param ModuleInfo $info Module info * * @return void * * @since 1.0.0 */ public static function unregisterFromDatabase(DatabasePool $dbPool, ModuleInfo $info) : void { $queryLoad = new Builder($dbPool->get('delete')); $queryLoad->prefix($dbPool->get('delete')->prefix); $queryLoad->delete() ->from('module_load') ->where('module_load_from', '=', $info->getInternalName()) ->execute(); $queryModule = new Builder($dbPool->get('delete')); $queryModule->prefix($dbPool->get('delete')->prefix); $queryModule->delete() ->from('module') ->where('module_id', '=', $info->getInternalName()) ->execute(); } }