You are here

class DrupalMySQLiSource in Backup and Migrate 8.4

Class DrupalMySQLiSource.

@package BackupMigrate\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/Source/DrupalMySQLiSource.php, line 14

Namespace

BackupMigrate\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)) {

        //        if (_backup_migrate_check_timeout()) {
        //          return FALSE;
        //        }
        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. These configuration options can be overriden by the config options but will not be overwritten. If the object is re-configured after construction any missing configuration options will revert to these values.
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::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. Each entry must have at least a 'name' key containing the table name. Overrides DatabaseSourceInterface::getTables
DatabaseSource::_getTableNames protected function Get the list of tables from this db.
DrupalMySQLiSource::importFromFile public function Import to this source from the given backup file. This is the main restore function for this source. 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
MySQLiSource::exportToFile public function Export this source to the given temp file. This should be the main back up function for this source. Overrides SourceInterface::exportToFile
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::_getTables protected function Get a list of tables in the db. Overrides DatabaseSource::_getTables
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.