Pimcore\Model\Tool\Setup\Dao::insertDump PHP Метод

insertDump() публичный Метод

public insertDump ( $file )
$file
    public function insertDump($file)
    {
        $sql = file_get_contents($file);
        //replace document root placeholder with current document root
        $docRoot = str_replace("\\", "/", PIMCORE_DOCUMENT_ROOT);
        // Windows fix
        $sql = str_replace("~~DOCUMENTROOT~~", $docRoot, $sql);
        // we have to use the raw connection here otherwise \Zend_Db uses prepared statements, which causes problems with inserts (: placeholders)
        // and mysqli causes troubles because it doesn't support multiple queries
        if ($this->db->getResource() instanceof \Zend_Db_Adapter_Mysqli) {
            $mysqli = $this->db->getConnection();
            $mysqli->multi_query($sql);
            // loop through results, because ->multi_query() is asynchronous
            do {
                if ($result = $mysqli->store_result()) {
                    $mysqli->free_result();
                }
            } while ($mysqli->next_result());
        } elseif ($this->db->getResource() instanceof \Zend_Db_Adapter_Pdo_Mysql) {
            $this->db->getConnection()->exec($sql);
        }
        \Pimcore\Db::reset();
        // set the id of the system user to 0
        $this->db->update("users", ["id" => 0], $this->db->quoteInto("name = ?", "system"));
    }