La restauracion de workspace demora mucho.
This commit is contained in:
william barra
2016-03-14 15:31:01 -04:00
committed by dheeyi
parent 46f0e16458
commit b427ad8c26

View File

@@ -489,48 +489,30 @@ class DataBaseMaintenance
*/ */
function backupDataBase ($outfile) function backupDataBase ($outfile)
{ {
$tablesBpmn = array( $aHost = explode(':', $this->host);
'BPMN_PROJECT','BPMN_DIAGRAM','BPMN_DOCUMENTATION','BPMN_EXTENSION','BPMN_PARTICIPANT', $dbHost = $aHost[0];
'BPMN_PROCESS','BPMN_ACTIVITY','BPMN_ARTIFACT','BPMN_DATA','BPMN_EVENT','BPMN_GATEWAY', if (isset($aHost[1])) {
'BPMN_LANESET','BPMN_BOUND','BPMN_FLOW','BPMN_LANE' $dbPort = $aHost[1];
); $command = 'mysqldump'
$sqlTablesBpmn = array(); . ' --user=' . $this->user
$aTables = $this->getTablesList(); . ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($this->passwd)))
$ws = explode( '_', $this->dbName ); . ' --host=' . $dbHost
$ws = isset( $ws[1] ) ? $ws[1] : $this->dbName; . ' --port=' . $dbPort
$schema = "\n"; . ' --opt'
$schema .= " -- Processmaker Data Base Maintenance Tool\n"; . ' --skip-comments'
$schema .= " --\n"; . ' ' . $this->dbName
$schema .= " -- Workspace: " . $ws . "\n"; . ' > ' . $outfile;
$schema .= " -- Data Base: " . $this->dbName . "\n"; } else {
$schema .= " -- Tables: " . (count( $aTables )) . "\n"; $command = 'mysqldump'
$schema .= " -- Date: " . (date( 'l jS \of F Y h:i:s A' )) . "\n"; . ' --host=' . $dbHost
$schema .= " --\n\n"; . ' --user=' . $this->user
$schema .= "SET FOREIGN_KEY_CHECKS=0; \n\n"; . ' --opt'
. ' --skip-comments'
$file = fopen( $outfile, "w+" ); . ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($this->passwd)))
. ' ' . $this->dbName
fwrite( $file, $schema ); . ' > ' . $outfile;
foreach ($aTables as $table) {
$tableSchema = "\nDROP TABLE IF EXISTS `$table`;\n\n";
$tableSchema .= $this->getSchemaFromTable( $table );
$data = $this->dumpSqlInserts( $table );
if (in_array($table, $tablesBpmn)) {
$sqlTablesBpmn[$table] = $tableSchema . $data;
} else {
fwrite( $file, $tableSchema );
fwrite( $file, $data );
}
} }
shell_exec($command);
if (count ($sqlTablesBpmn) > 0) {
foreach ($tablesBpmn as $table) {
fwrite( $file, $sqlTablesBpmn[$table] );
}
}
fclose( $file );
} }
/** /**