add('
'); $oP->p('Back to menu'); break; case 'do_create': $sTitle = utils::ReadParam('title', 'Unknown archive'); $sDescription = utils::ReadParam('description', 'No description provided for this archive.'); $bfullDump = utils::ReadParam('full', false); $bfullSchemaDump = utils::ReadParam('full_schema', false); $bBizDump = utils::ReadParam('biz', false); $bBizSchemaDump = utils::ReadParam('biz_schema', false); $sArchiveFile = '../tmp/archive1.zip'; $oArchive = new iTopArchive($sArchiveFile, iTopArchive::create); $oArchive->SetTitle($sTitle); $oArchive->SetDescription($sDescription); if ($bfullDump) { $oArchive->AddDatabaseDump("Full Database Dump", "Choose this option to completely reload your database. All current data will be deleted and replaced by the backup", "full-db.sql", 'itop', array(), false); } if ($bfullSchemaDump) { $oArchive->AddDatabaseDump("Full Schema Dump", "Choose this option to completely wipe out your database and start from an empty database", "full-schema.sql", 'itop', array(), true); } if ($bBizDump || $bBizSchemaDump) { // compute the list of the tables involved in the business model $aBizTables = array(); foreach(MetaModel::GetClasses('bizmodel') as $sClass) { $sTable = MetaModel::DBGetTable($sClass); $aBizTables[$sTable] = $sTable; } unset($aBizTables['']); if ($bfullDump) { $oArchive->AddDatabaseDump("Full Business Model Dump", "Choose this option to completely reload the business model part of your database. All current business data will be deleted and replaced by the backup. Application data (like menus...) are preserved.", "biz-db.sql", 'itop', $aBizTables, false); } if ($bfullSchemaDump) { $oArchive->AddDatabaseDump("Full Business Model Schema Dump", "Choose this option to wipe out the business data and start from an empty database. All current business data will be deleted. Application data (like menus...) are preserved.", "biz-schema.sql", 'itop', $aBizTables, true); } } $oArchive->WriteCatalog(); $oP->p("The archive '$sTitle' has been created in $sArchiveFile."); $oP->p('Back to menu'); break; case 'select_archive': $sArchivesDir = '../tmp'; $oP->add(''); $oP->p("(Archives are searched into the directory: $sArchivesDir.)"); $oP->p('Cancel'); break; case 'select_package': $sArchiveFile = utils::ReadParam('archive_file', ''); $oArchive = new iTopArchive($sArchiveFile, iTopArchive::read); $oArchive->ReadCatalog(); $oP->add(''); $oP->p('Cancel'); break; case 'import_package': $sArchiveFile = utils::ReadParam('archive_file', ''); $sPackageName = utils::ReadParam('package_name', ''); $oArchive = new iTopArchive($sArchiveFile, iTopArchive::read); $oArchive->ReadCatalog(); $oP->add('Applying the package '.$sPackageName.'
'); if($oArchive->ImportSQL($sPackageName)) { $oP->p('Done.'); } else { $oP->p('Sorry, an error occured while applying the package...'); } $oP->p('Apply another package from the same archive'); $oP->p('Select another archive'); $oP->p('Back to the menu'); break; case 'menu': default: $oP->add('Database backup & restore
'); $oP->add('Select one of the actions below:
'); $oP->add(''); $oP->add(''); } $oP->output(); ?>