示例#1
0
Task::log("to {$destinationDbSchema} on {$destinationDb->getHost()->hostname}\n\n");
//
$tmpDumpFile = new File(SCRIPT_DIR . '/db', "{$sourceDbSchema}-" . Config::get('datetime.slug') . '.sql');
MysqlTask::mysqlDump($sourceDb, $sourceDbSchema, array(), $tmpDumpFile);
// ********************
// *** Prep sync to intermediate remote location
//
Task::log("- Syncing revision {$workingCopy->info->commitRevision} with {$syncDestinationDir1->getPath()} on {$syncDestinationDir1->getHost()->hostname}\n\n");
//
FileSyncTask::sync($rsyncOptions1);
// ********************
// *** Deploy
//
TimerTask::start();
// Import DB
MysqlTask::importDump($destinationDb, $tmpDumpFile->getPath(), $destinationDbSchema);
//
Task::log("- Syncing intermediate directory {$syncDestinationDir1->path} with {$syncDestinationDir2->path}\n\n");
//
$rsyncCommand = FileSyncTask::getRsyncCommand($rsyncOptions2);
SshTask::exec($syncDestinationDir1->getHost(), $rsyncCommand);
// Stop the deploy timer and log it
TimerTask::stop();
Task::log("Deploy time: " . TimerTask::getLastElapsedTime() . "\n\n");
exit;
// ********************
// *** Tag
//
if ($build === 'prod') {
    SvnTask::commit($workingCopy, "Release to Production");
}
示例#2
0
// *******************************
Config::enableLogging();
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Sync database\n\n");
// Prompt for user password, if it's not hardcoded
CliTask::promptAccountPassword($cogecoAccount);
// ********************
// Prompt user input
//
// Prepare a list of possible databases to sync from
$dbList = array($localPublicDb, $localPublicUBCDb, $localPublicPromo, $localPublicGBIncrease, $localDevPhoenixDb, $devPublicDb, $dev2PublicDb, $dev3PublicDb, $dev4PublicDb, $uatPublicDb, $preprodPublicDb);
// Prompt user to input a source database
$sourceDb = CliTask::promptDatabase($dbList, 'Choose a source database:');
Task::log("You chose " . $sourceDb->getDbName() . " on " . $sourceDb->getHost()->getHostname() . "\n\n");
if (($key = array_search($sourceDb, $dbList)) !== false) {
    unset($dbList[$key]);
}
// Prepare a list of possible databases to sync to
$destinationDb = CliTask::promptDatabase($dbList, 'Choose a destination database:');
Task::log("You chose " . $destinationDb->getDbName() . " on " . $destinationDb->getHost()->getHostname() . "\n\n");
CliTask::promptQuit('Continue? [y/n]: ');
// Dump DB to an sql script
$tmpDumpFile = new File(SCRIPT_DB_DIR, $sourceDb->getHost()->getHostname() . '-' . $sourceDb->getDbName() . '-' . Config::get('datetime.slug') . '.sql');
MysqlTask::mysqlDump($sourceDb, $sourceDb->getDbName(), array(), $tmpDumpFile);
// Import DB from the sql script
MysqlTask::importDump($destinationDb, $tmpDumpFile->getPath(), $destinationDb->getDbName());
// Delete the temporary script
//unlink($tmpDumpFile->getPath());
示例#3
0
// Include the build script core
include_once __DIR__ . '/../../bootstrap.php';
// *******************************
// Script configuration
// *******************************
// *******************************
// Start the build script
// *******************************
Config::enableLogging();
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Dump database\n\n");
// Prompt for user password, if it's not hardcoded
CliTask::promptAccountPassword($cogecoAccount);
// ********************
// Prompt user input
//
// Prepare a list of possible databases to dump
$dbList = array($localPublicDb, $localPublicUBCDb, $localPublicPromo, $localPublicGBIncrease, $devPublicDb, $dev2PublicDb, $dev3PublicDb, $dev4PublicDb, $uatPublicDb, $preprodPublicDb, $prodPublicDb);
// Prompt user to input a source database
$sourceDb = CliTask::promptDatabase($dbList, 'Choose a database:');
Task::log("You chose " . $sourceDb->getDbName() . " on " . $sourceDb->getHost()->getHostname() . "\n\n");
if (($key = array_search($sourceDb, $dbList)) !== false) {
    unset($dbList[$key]);
}
// Dump DB to an sql script
$tmpDumpFile = new File(SCRIPT_DB_DIR, $sourceDb->getHost()->getHostname() . '-' . $sourceDb->getDbName() . '-' . Config::get('datetime.slug') . '.sql');
MysqlTask::mysqlDump($sourceDb, $sourceDb->getDbName(), array(), $tmpDumpFile);