class DrupalMySQLiSource in Backup and Migrate 8.4
Class DrupalMySQLiSource.
@package BackupMigrate\Drupal\Source
Hierarchy
- class \BackupMigrate\Core\Plugin\PluginBase implements ConfigurableInterface, PluginInterface uses ConfigurableTrait
- class \BackupMigrate\Core\Source\DatabaseSource implements FileProcessorInterface, DatabaseSourceInterface uses FileProcessorTrait
- class \BackupMigrate\Core\Source\MySQLiSource implements PluginCallerInterface uses PluginCallerTrait
- class \BackupMigrate\Drupal\Source\DrupalMySQLiSource
- class \BackupMigrate\Core\Source\MySQLiSource implements PluginCallerInterface uses PluginCallerTrait
- class \BackupMigrate\Core\Source\DatabaseSource implements FileProcessorInterface, DatabaseSourceInterface uses FileProcessorTrait
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\SourceView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableTrait:: |
protected | property | The object's configuration object. | |
ConfigurableTrait:: |
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:: |
public | function | Get a specific value from the configuration. | |
ConfigurableTrait:: |
public | function | Get the configuration object for this item. | |
ConfigurableTrait:: |
public | function | Get any validation errors in the config. | |
ConfigurableTrait:: |
public | function | Set the configuration for all plugins. | 1 |
ConfigurableTrait:: |
public | function | 2 | |
DatabaseSource:: |
public | function |
Get the default values for the plugin. Overrides ConfigurableTrait:: |
|
DatabaseSource:: |
public | function |
Get a definition for user-configurable settings. Overrides ConfigurableTrait:: |
|
DatabaseSource:: |
public | function |
Get a list of tables in this source. Overrides DatabaseSourceInterface:: |
|
DatabaseSource:: |
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:: |
|
DatabaseSource:: |
protected | function | Get the list of tables from this db. | |
DrupalMySQLiSource:: |
public | function |
Import to this source from the given backup file. This is the main restore
function for this source. Overrides MySQLiSource:: |
|
FileProcessorTrait:: |
protected | property | ||
FileProcessorTrait:: |
public | function | Provide the file mime for the given file extension if known. | |
FileProcessorTrait:: |
public | function | Get the temp file manager. | |
FileProcessorTrait:: |
public | function | Inject the temp file manager. | |
MySQLiSource:: |
protected | property | ||
MySQLiSource:: |
public | function |
Export this source to the given temp file. This should be the main
back up function for this source. Overrides SourceInterface:: |
|
MySQLiSource:: |
protected | function | Run a db query on this destination's db. | |
MySQLiSource:: |
public | function |
Get a list of supported operations and their weight. Overrides PluginBase:: |
|
MySQLiSource:: |
protected | function | Get the version info for the given DB. | |
MySQLiSource:: |
protected | function | Get the sql to insert the data for a given table. | |
MySQLiSource:: |
protected | function | Return the first result of the query as an associated array. | |
MySQLiSource:: |
protected | function | Return the first field of the first result of a query. | |
MySQLiSource:: |
protected | function | Get the db connection for the specified db. | |
MySQLiSource:: |
protected | function | The footer of the sql dump file. | |
MySQLiSource:: |
protected | function | Get the header for the top of the SQL file. | |
MySQLiSource:: |
protected | function | Get the sql for the structure of the given table. | |
MySQLiSource:: |
protected | function |
Get a list of tables in the db. Overrides DatabaseSource:: |
|
MySQLiSource:: |
protected | function | Lock the list of given tables in the database. | |
MySQLiSource:: |
protected | function | Read a multiline sql command from a file. | |
MySQLiSource:: |
protected | function | Unlock all tables in the database. | |
PluginBase:: |
public | function |
What is the weight of the given operation for this plugin. Overrides PluginInterface:: |
|
PluginBase:: |
public | function |
Does this plugin implement the given operation. Overrides PluginInterface:: |
|
PluginCallerTrait:: |
protected | property | ||
PluginCallerTrait:: |
public | function | Get the plugin manager. | |
PluginCallerTrait:: |
public | function | Inject the plugin manager. | |
TranslatableTrait:: |
protected | property | ||
TranslatableTrait:: |
public | function | ||
TranslatableTrait:: |
public | function | Translate the given string if there is a translator service available. |