コード例 #1
0
/** start a transactions,
 * perform copy in transaction
 * then roll it back, so we can use the same
 * db over again.
 */
function main() {
	echo "Connect ... \n";
	connect();

	mysql_query( "START TRANSACTION" );
	echo "doing bootstraps\n";
	CopyTools::map_bootstraps( "uw", array( "uw", "sp" ) );
	mysql_query( "COMMIT" );
	echo "done.\n";
}
コード例 #2
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");
}
コード例 #3
0
ファイル: Copy.php プロジェクト: realsoc/mediawiki-extensions
	public function read() {
		$dc1 = $this->dc1;
		$src_meaning_mid = $this->src_meaning_mid;
		return CopyTools::getRows( $dc1, $this->tableName, "WHERE meaning_mid=$src_meaning_mid", true );
	}
コード例 #4
0
	protected function _doCopy( $dmid_dirty, $dc1_dirty, $dc2_dirty ) {
		global
			$wgCommunityEditPermission, $wgOut, $wgUser, $wgCommunity_dc;
		
		# escape parameters
		$dmid = mysql_real_escape_string( $dmid_dirty );
		$dc1 = mysql_real_escape_string( $dc1_dirty );
		$dc2 = mysql_real_escape_string( $dc2_dirty );

		# check permission
		if ( !( $wgUser->isAllowed( 'wikidata-copy' ) ) or $dc2 != $wgCommunity_dc ) {
			$wgOut->addHTML( wfMsgSc( "Permission_denied" ) );
			return false; # we didn't perform the copy.
		}

		# copy
		CopyTools::newCopyTransaction( $dc1, $dc2 );
		$dmc = new DefinedMeaningCopier( $dmid, $dc1, $dc2 );
		$dmc->dup();

		# For purposes of current "edit copy", 
		# having the dm be already_there() is ok.
		# (hence commented out)
		# if ($dmc->already_there() ) {
		#	$wgOut->addHTML(wfMsgSc("already_there"));
		#	return false;
		# }

		return true; # seems everything went ok.

	}
コード例 #5
0
	public function CheckIfStub() {
		$dataset = $this->getDataset();
		$id = $this->getId();
		if ( is_null( $dataset ) )
			throw new Exception ( "DefinedMeaningModel->isStub: Dataset is null." );
		if ( is_null( $id ) )
			throw new Exception ( "DefinedMeaningModel->isStub: Id is null." );
		require_once( "Copy.php" );
		return CopyTools::CheckIfStub( $dataset, $id );
	}