You are here

protected function MySQLiSource::_getSQLHeader in Backup and Migrate 8.4

Get the header for the top of the SQL file.

Return value

string

1 call to MySQLiSource::_getSQLHeader()
MySQLiSource::exportToFile in lib/backup_migrate_core/src/Source/MySQLiSource.php
Export this source to the given temp file. This should be the main back up function for this source.

File

lib/backup_migrate_core/src/Source/MySQLiSource.php, line 199

Class

MySQLiSource
Class MySQLiSource.

Namespace

BackupMigrate\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');
  return <<<HEADER
-- Backup and Migrate MySQL Dump
-- http://github.com/backupmigrate
--
-- Generator: {<span class="php-variable">$generator</span>}
-- Host: {<span class="php-variable">$host</span>}
-- Database: {<span class="php-variable">$db</span>}
-- Generation Time: {<span class="php-variable">$timestamp</span>}
-- 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 */;

/* @TODO expose these options in config with the ability to turn on and off */

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

HEADER;
}