You are here

class DrupalMySQLiSource in Backup and Migrate 5.0.x

@package Drupal\backup_migrate\Drupal\Source

Hierarchy

Expanded class hierarchy of DrupalMySQLiSource

2 files declare their use of DrupalMySQLiSource
DefaultDBSourcePlugin.php in src/Plugin/BackupMigrateSource/DefaultDBSourcePlugin.php
EntireSiteSourcePlugin.php in src/Plugin/BackupMigrateSource/EntireSiteSourcePlugin.php

File

src/Drupal/Source/DrupalMySQLiSource.php, line 13

Namespace

Drupal\backup_migrate\Drupal\Source
View source
class DrupalMySQLiSource extends MySQLiSource {

  /**
   *
   */
  public function importFromFile(BackupFileReadableInterface $file) {
    $num = 0;
    if ($conn = $this
      ->_getConnection()) {

      // Open (or rewind) the file.
      $file
        ->openForRead();

      // Read one line at a time and run the query.
      while ($line = $this
        ->_readSqlCommand($file)) {

        // @todo Why was this commented out?
        // @code
        // if (_backup_migrate_check_timeout()) {
        //   return FALSE;
        // }
        // @endcode
        if ($line) {

          // Execute the sql query from the file.
          $stmt = $conn
            ->prepare($line);
          if (!$stmt) {
            return FALSE;
          }
          $stmt
            ->execute();
          $num++;
        }
      }

      // Close the file, we're done reading it.
      $file
        ->close();
    }
    return $num;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableTrait::$config protected property The object's configuration object.
ConfigurableTrait::$init protected property The initial configuration.
ConfigurableTrait::confGet public function Get a specific value from the configuration.
ConfigurableTrait::config public function Get the configuration object for this item.
ConfigurableTrait::configErrors public function Get any validation errors in the config.
ConfigurableTrait::setConfig public function Set the configuration for all plugins. 1
ConfigurableTrait::__construct public function 2
DatabaseSource::configDefaults public function Get the default values for the plugin. Overrides ConfigurableTrait::configDefaults
DatabaseSource::configSchema public function Get a definition for user-configurable settings. Overrides ConfigurableTrait::configSchema
DatabaseSource::getRawTableNames protected function Get the list of tables from this db.
DatabaseSource::getTableNames public function Get a list of tables in this source. Overrides DatabaseSourceInterface::getTableNames
DatabaseSource::getTables public function Get an array of tables with some info. Overrides DatabaseSourceInterface::getTables
DrupalMySQLiSource::importFromFile public function Import to this source from the given backup file. Overrides MySQLiSource::importFromFile
FileProcessorTrait::$tempfilemanager protected property
FileProcessorTrait::alterMime public function Provide the file mime for the given file extension if known.
FileProcessorTrait::getTempFileManager public function Get the temp file manager.
FileProcessorTrait::setTempFileManager public function Inject the temp file manager.
MySQLiSource::$connection protected property A MySQLi connection.
MySQLiSource::exportToFile public function Export this source to the given temp file. Overrides SourceInterface::exportToFile
MySQLiSource::getRawTables protected function Get a list of tables in the db. Overrides DatabaseSource::getRawTables
MySQLiSource::query protected function Run a db query on this destination's db.
MySQLiSource::supportedOps public function Get a list of supported operations and their weight. Overrides PluginBase::supportedOps
MySQLiSource::_dbInfo protected function Get the version info for the given DB.
MySQLiSource::_dumpTableSqlToFile protected function Get the sql to insert the data for a given table.
MySQLiSource::_fetchAssoc protected function Return the first result of the query as an associated array.
MySQLiSource::_fetchValue protected function Return the first field of the first result of a query.
MySQLiSource::_getConnection protected function Get the db connection for the specified db.
MySQLiSource::_getSqlFooter protected function The footer of the sql dump file.
MySQLiSource::_getSqlHeader protected function Get the header for the top of the SQL file.
MySQLiSource::_getTableCreateSql protected function Get the sql for the structure of the given table.
MySQLiSource::_lockTables protected function Lock the list of given tables in the database.
MySQLiSource::_readSqlCommand protected function Read a multiline sql command from a file.
MySQLiSource::_unlockTables protected function Unlock all tables in the database.
PluginBase::opWeight public function What is the weight of the given operation for this plugin. Overrides PluginInterface::opWeight
PluginBase::supportsOp public function Does this plugin implement the given operation. Overrides PluginInterface::supportsOp
PluginCallerTrait::$plugins protected property
PluginCallerTrait::plugins public function Get the plugin manager.
PluginCallerTrait::setPluginManager public function Inject the plugin manager.
TranslatableTrait::$translator protected property
TranslatableTrait::setTranslator public function
TranslatableTrait::t public function Translate the given string if there is a translator service available.