Microweber\Utils\Database::import_sql_file PHP Method

import_sql_file() public method

Imposts SQL file in the DB.
public import_sql_file ( $full_path_to_file ) : boolean
$full_path_to_file
return boolean
    public function import_sql_file($full_path_to_file)
    {
        $dbms_schema = $full_path_to_file;
        if (is_file($dbms_schema)) {
            $prefix = get_table_prefix();
            $sql_query = fread(fopen($dbms_schema, 'r'), filesize($dbms_schema)) or die('problem ' . __FILE__ . __LINE__);
            $sql_query = str_ireplace('{MW_TABLE_PREFIX}', $prefix, $sql_query);
            $sql_query = $this->remove_sql_remarks($sql_query);
            $sql_query = $this->remove_comments_from_sql_string($sql_query);
            $sql_query = $this->split_sql_file($sql_query, ';');
            $i = 1;
            foreach ($sql_query as $sql) {
                $sql = trim($sql);
                DB::statement($sql);
            }
            return true;
        } else {
            return false;
        }
    }