示例#1
0
/** start a transactions,
 * perform copy in transaction
 * then roll it back, so we can use the same
 * db over again.
 */
function main() {

	$sequence = array();
	$sequence[] = array( '5249216', 'sp', 'uw' );
	$sequence[] = array( '5499828', 'sp', 'uw' );
	$sequence[] = array( '6247771', 'sp', 'uw' );
	$sequence[] = array( '7229499', 'sp', 'uw' );

	
	$sequence[] = array( '68242', 'umls', 'uw' );
	$sequence[] = array( '69856', 'umls', 'uw' );
	$sequence[] = array( '69931', 'umls', 'uw' );
	$sequence[] = array( '71663', 'umls', 'uw' );
	$sequence[] = array( '71902', 'umls', 'uw' );
	
	echo "Connect ... \n";
	connect();

	# WARNING: Do this only once! (I still need to write a small script to call this)
	echo "doing bootstraps\n";

	mysql_query( "START TRANSACTION" );
	CopyTools::map_bootstraps( "uw", array( "uw", "sp" ) );
	
	echo "now copying\n";
	
	foreach ( $sequence as $test ) {
		$dmid = $test[0];
		$dc1 = $test[1];
		$dc2 = $test[2];
		echo "==== $dmid:   $dc1 -> $dc2  \n";
		doCopy( $dmid, $dc1, $dc2 );
		echo "\n";
	}
	mysql_query( "ROLLBACK" );
	# mysql_query("COMMIT");
}
         nonce_check();
         exit(doExtract($subject, $path));
     case 'readFile':
         exit(doReadFile($subject, $path));
     case 'rename':
         nonce_check();
         exit(doRename($subject, $path));
     case 'delete':
         nonce_check();
         exit(doDelete($subject, $path));
     case 'saveEdit':
         nonce_check();
         exit(doSaveEdit($subject, $path));
     case 'copy':
         nonce_check();
         exit(doCopy($subject, $path));
     case 'move':
         nonce_check();
         exit(doMove($subject, $path));
     case 'moveList':
         exit(moveList($subject, $path));
     case 'installCodeMirror':
         exit(installCodeMirror());
     case 'fileExists':
         exit(file_exists($path . '/' . $subject));
     case 'getfs':
         exit(getFs($path . '/' . $subject));
     case 'remoteCopy':
         nonce_check();
         exit(doRemoteCopy($path));
 }