Feature to restore database implemented
This commit is contained in:
parent
a6a149a156
commit
1cd5758f05
28
vimbadmin.cf
28
vimbadmin.cf
|
@ -4,11 +4,13 @@
|
||||||
|
|
||||||
bundle agent vimbadmin(cfg)
|
bundle agent vimbadmin(cfg)
|
||||||
{
|
{
|
||||||
vars:
|
classes:
|
||||||
"r" int => randomint(1,5),
|
"vimbadmin_restore_db_file" expression => isvariable("cfg[restore_db_file]");
|
||||||
handle => "rand_assigned";
|
|
||||||
|
|
||||||
|
vimbadmin_restore_db_file::
|
||||||
|
"vimbadmin_restore_db" expression => fileexists("$(cfg[restore_db_file])");
|
||||||
|
|
||||||
|
vars:
|
||||||
"vsettings[resources.doctrine2.connection.options.driver]" string => "'$(cfg[db_driver])'";
|
"vsettings[resources.doctrine2.connection.options.driver]" string => "'$(cfg[db_driver])'";
|
||||||
"vsettings[resources.doctrine2.connection.options.dbname]" string => "'$(cfg[db_name])'";
|
"vsettings[resources.doctrine2.connection.options.dbname]" string => "'$(cfg[db_name])'";
|
||||||
"vsettings[resources.doctrine2.connection.options.user]" string => "'$(cfg[db_user])'";
|
"vsettings[resources.doctrine2.connection.options.user]" string => "'$(cfg[db_user])'";
|
||||||
|
@ -88,11 +90,17 @@ files:
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|
||||||
"!mysql_$(cfg[db_name])_admin_exists"::
|
"(!mysql_$(cfg[db_name])_admin_exists)&(!vimbadmin_restore_db)"::
|
||||||
"cd $(cfg[install_dir]) && ./bin/doctrine2-cli.php orm:schema-tool:create "
|
"cd $(cfg[install_dir]) && ./bin/doctrine2-cli.php orm:schema-tool:create "
|
||||||
contain => wmde_cmd_useshell,
|
contain => wmde_cmd_useshell,
|
||||||
|
handle => "vimbadmin_db_initialized",
|
||||||
depends_on => {"vimbadmin_appini_edited"};
|
depends_on => {"vimbadmin_appini_edited"};
|
||||||
|
|
||||||
|
"(!mysql_$(cfg[db_name])_admin_exists)&vimbadmin_restore_db"::
|
||||||
|
"mysql -u $(cfg[db_user]) -p$(cfg[db_pass]) -h$(cfg[db_host]) $(cfg[db_name]) < $(cfg[restore_db_file])"
|
||||||
|
contain => wmde_cmd_useshell,
|
||||||
|
depends_on => {"vimbadmin_appini_edited"};
|
||||||
|
|
||||||
|
|
||||||
vimbadmin_reconfigure::
|
vimbadmin_reconfigure::
|
||||||
"/bin/sh"
|
"/bin/sh"
|
||||||
|
@ -121,6 +129,16 @@ methods:
|
||||||
"any" usebundle => mysql_table_exists(@(cfg),"admin");
|
"any" usebundle => mysql_table_exists(@(cfg),"admin");
|
||||||
|
|
||||||
reports:
|
reports:
|
||||||
|
# "VIMBADMIN $(cfg[restore_db_file])";
|
||||||
|
|
||||||
|
# "vimbadmin_restore_db_file"::
|
||||||
|
# "RESTORE_DB_FILE";
|
||||||
|
|
||||||
|
# "vimbadmin_restore_db"::
|
||||||
|
# "RESTORE_DB";
|
||||||
|
|
||||||
|
# "(!mysql_$(cfg[db_name])_admin_exists)&vimbadmin_restore_db"::
|
||||||
|
# "Should restore db";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue