Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backup_migrate
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
backup_migrate
Commits
7f8e21bf
There was an error fetching the commit references. Please try again later.
Commit
7f8e21bf
authored
9 years ago
by
Ronan Dowling
Browse files
Options
Downloads
Patches
Plain Diff
Combine archive reader and writer
parent
bf88f84e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
backup_migrate.module
+44
-4
44 additions, 4 deletions
backup_migrate.module
src/Config/DrupalConfigHelper.php
+4
-0
4 additions, 0 deletions
src/Config/DrupalConfigHelper.php
src/Form/BackupMigrateAdvancedBackupForm.php
+18
-4
18 additions, 4 deletions
src/Form/BackupMigrateAdvancedBackupForm.php
with
66 additions
and
8 deletions
backup_migrate.module
+
44
−
4
View file @
7f8e21bf
...
...
@@ -60,7 +60,7 @@ function backup_migrate_get_service_object($config_array = []) {
// Set the configuration overrides if any were passed in.
if
(
$config_array
)
{
$bam
->
setConfig
(
new
\BackupMigrate\Core\Config\
Config
(
$config_array
));
$bam
->
setConfig
(
new
Config
(
$config_array
));
}
return
$bam
;
...
...
@@ -88,6 +88,8 @@ function backup_migrate_backup_migrate_services_alter(\BackupMigrate\Core\Servic
new
\BackupMigrate\Drupal\Environment\DrupalSetMessageLogger
()
);
$services
->
add
(
'ArchiveWriter'
,
new
\BackupMigrate\Core\Service\PearTarArchiver
());
}
...
...
@@ -106,11 +108,15 @@ function backup_migrate_backup_migrate_plugins_alter(\BackupMigrate\Core\Plugin\
if
(
$info
[
'driver'
]
==
'mysql'
)
{
$plugins
->
add
(
'db'
,
new
\BackupMigrate\Core\Source\MySQLiSource
(
new
\BackupMigrate\Core\Config\Config
(
$info
)
));
new
\BackupMigrate\Core\Source\MySQLiSource
(
new
Config
(
$info
)));
}
// Add the public files
$plugins
->
add
(
'files_public'
,
new
\BackupMigrate\Core\Source\FileDirectorySource
(
new
Config
([
'directory'
=>
'public://'
]))
);
// Add a download destination.
$plugins
->
add
(
'download'
,
new
\BackupMigrate\Drupal\Destination\DrupalBrowserDownloadDestination
());
...
...
@@ -143,3 +149,37 @@ function backup_migrate_backup_migrate_plugins_alter(\BackupMigrate\Core\Plugin\
}
/**
* @param \BackupMigrate\Core\Main\BackupMigrate $bam
* @return array
*/
function
_backup_migrate_get_source_pulldown
(
\BackupMigrate\Core\Main\BackupMigrate
$bam
)
{
$sources
=
$bam
->
plugins
()
->
getAllByOp
(
'exportToFile'
);
$source_ids
=
array
();
foreach
(
$sources
as
$key
=>
$source
)
{
$source_ids
[
$key
]
=
$key
;
}
return
[
'#type'
=>
'select'
,
'#title'
=>
t
(
'Source'
),
'#options'
=>
$source_ids
,
];
}
/**
* @param \BackupMigrate\Core\Main\BackupMigrate $bam
* @return array
*/
function
_backup_migrate_get_destination_pulldown
(
\BackupMigrate\Core\Main\BackupMigrate
$bam
)
{
$destinations
=
$bam
->
plugins
()
->
getAllByOp
(
'saveFile'
);
$destination_ids
=
array
();
foreach
(
$destinations
as
$key
=>
$destination
)
{
$destination_ids
[
$key
]
=
$key
;
}
return
[
'#type'
=>
'select'
,
'#title'
=>
t
(
'Destination'
),
'#options'
=>
$destination_ids
,
];
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Config/DrupalConfigHelper.php
+
4
−
0
View file @
7f8e21bf
...
...
@@ -44,6 +44,10 @@ class DrupalConfigHelper {
switch
(
$item
[
'type'
])
{
case
'text'
:
$form_item
[
'#type'
]
=
'textfield'
;
if
(
!
empty
(
$item
[
'multiple'
]))
{
$form_item
[
'#type'
]
=
'textarea'
;
$item
[
'description'
]
.
=
t
(
' Add one item per line.'
);
}
break
;
case
'password'
:
$form_item
[
'#type'
]
=
'password'
;
...
...
This diff is collapsed.
Click to expand it.
src/Form/BackupMigrateAdvancedBackupForm.php
+
18
−
4
View file @
7f8e21bf
...
...
@@ -34,6 +34,11 @@ class BackupMigrateAdvancedBackupForm extends FormBase {
// @FIXME
// $form['#theme'] = 'backup_migrate_ui_manual_quick_backup_form_inline';
// $form['quickbackup']['destination'] = _backup_migrate_get_destination_pulldown('manual backup', \Drupal::config('backup_migrate.settings')->get('backup_migrate_destination_id'), \Drupal::config('backup_migrate.settings')->get('backup_migrate_copy_destination_id'));
$bam
=
backup_migrate_get_service_object
();
$form
[
'source'
]
=
array
(
'#type'
=>
'fieldset'
,
"#title"
=>
t
(
"Source"
),
...
...
@@ -41,13 +46,22 @@ class BackupMigrateAdvancedBackupForm extends FormBase {
"#collapsed"
=>
FALSE
,
"#tree"
=>
FALSE
,
);
$form
[
'source'
][
'source_id'
]
=
_backup_migrate_get_source_pulldown
(
$bam
);
$form
[
'source'
][
'source_id'
][
'#default_value'
]
=
\Drupal
::
config
(
'backup_migrate.settings'
)
->
get
(
'backup_migrate_source_id'
);
$bam
=
backup_migrate_get_service_object
();
$conf_schema
=
$bam
->
plugins
()
->
map
(
'configSchema'
,
array
(
'operation'
=>
'backup'
));
$form
+=
DrupalConfigHelper
::
buildFormFromSchema
(
$conf_schema
,
$bam
->
plugins
()
->
config
());
// $form['quickbackup']['source_id'] = _backup_migrate_get_source_pulldown(\Drupal::config('backup_migrate.settings')->get('backup_migrate_source_id'));
// $form['quickbackup']['destination'] = _backup_migrate_get_destination_pulldown('manual backup', \Drupal::config('backup_migrate.settings')->get('backup_migrate_destination_id'), \Drupal::config('backup_migrate.settings')->get('backup_migrate_copy_destination_id'));
$form
[
'destination'
]
=
array
(
'#type'
=>
'fieldset'
,
"#title"
=>
t
(
"Destination"
),
"#collapsible"
=>
TRUE
,
"#collapsed"
=>
FALSE
,
"#tree"
=>
FALSE
,
);
$form
[
'destination'
][
'destination_id'
]
=
_backup_migrate_get_destination_pulldown
(
$bam
);
$form
[
'destination'
][
'destination_id'
][
'#default_value'
]
=
\Drupal
::
config
(
'backup_migrate.settings'
)
->
get
(
'backup_migrate_destination_id'
);
$form
[
'quickbackup'
][
'submit'
]
=
array
(
'#type'
=>
'submit'
,
...
...
@@ -81,7 +95,7 @@ class BackupMigrateAdvancedBackupForm extends FormBase {
*/
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$config
=
$form_state
->
getValues
();
backup_migrate_perform_backup
(
'db'
,
'download'
,
$config
);
backup_migrate_perform_backup
(
$config
[
'source_id'
]
,
'download'
,
$config
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment