Habari\InstallHandler::get_create_table_queries PHP Метод

get_create_table_queries() приватный Метод

Install schema tables from the respective RDBMS schema
private get_create_table_queries ( $db_type, $table_prefix, $db_schema ) : array
$db_type string The schema string for the database
$table_prefix string The prefix to use on each table name
$db_schema string The database name
Результат array Array of queries to execute
    private function get_create_table_queries($db_type, $table_prefix, $db_schema)
    {
        /* Grab the queries from the RDBMS schema file */
        $file_path = HABARI_PATH . "/system/schema/{$db_type}/schema.sql";
        $schema_sql = trim(file_get_contents($file_path), "\r\n ");
        $schema_sql = str_replace('{$schema}', $db_schema, $schema_sql);
        $schema_sql = str_replace('{$prefix}', $table_prefix, $schema_sql);
        /*
         * Just in case anyone creates a schema file with separate statements
         * not separated by two newlines, let's clean it here...
         * Likewise, let's clean up any separations of *more* than two newlines
         */
        $schema_sql = str_replace(array("\r\n", "\r"), array("\n", "\n"), $schema_sql);
        $schema_sql = preg_replace("/;\n([^\n])/", ";\n\n\$1", $schema_sql);
        $schema_sql = preg_replace("/\n{3,}/", "\n\n", $schema_sql);
        $queries = preg_split('/(\\r\\n|\\r|\\n)\\1/', $schema_sql);
        return $queries;
    }