You are here

protected function MySQLiSource::_getSqlHeader in Backup and Migrate 5.0.x

Get the header for the top of the SQL file.

Return value

string

1 call to MySQLiSource::_getSqlHeader()
MySQLiSource::exportToFile in src/Core/Source/MySQLiSource.php
Export this source to the given temp file.

File

src/Core/Source/MySQLiSource.php, line 211

Class

MySQLiSource
@package Drupal\backup_migrate\Core\Source

Namespace

Drupal\backup_migrate\Core\Source

Code

protected function _getSqlHeader() {
  $info = $this
    ->_dbInfo();
  $version = $info['version'];
  $host = $this
    ->confGet('host');
  $db = $this
    ->confGet('database');
  $timestamp = gmdate('r');
  $generator = $this
    ->confGet('generator');

  // @todo Expose these options in config with the ability to turn on and off.
  return <<<HEADER
-- Generator: Backup and Migrate
-- https://www.drupal.org/project/backup_migrate
--
-- Host: {<span class="php-variable">$host</span>}
-- Database: {<span class="php-variable">$db</span>}
-- Generation Time: {<span class="php-variable">$timestamp</span>}
-- Database Type: MySQL
-- MySQL Version: {<span class="php-variable">$version</span>}

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;

SET AUTOCOMMIT = 0;
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET NAMES utf8mb4;

HEADER;
}