[Imc-tech] Converting active databases to dada

Clint Popetz cpopetz at cpopetz.com
Tue Sep 17 01:00:23 CDT 2002


I have attached a perl script which I wrote to convert the
urbana-champaign IMC's active database over to dada.  Here is the
header:

# convert.pl
#
# Fills in a dadaimc mysql database by reading a postrgres "active" database.
# Also makes soft links from dada's usermedia directory to the media files
# in active's upload directory, so that you don't need two copies of all your
# media lying around.  (Note: won't handle remote storage of media.)
# Takes care of image sizing for jpgs and gifs (if you have jpeginfo and
# gifsicle), links between related stories, and parenting comments.  
# Also creates a table to allow redirects from # active articles to dada 
# articles.  Doesn't handle creating thumbnails.
#
# This script needs DBI and the mysql and pg DBD modules.
#

I have tried to make it pretty generic and fault tolerant.  It only
needs two lines modified to point it to the wherabouts of your active
and dada installations.  If you don't know perl and at least a little
about active and dada, please don't run the script and then complain
when it doesn't work.  I don't have time to do tech support for the
script; I will answer questions about it, and/or update it with
suggestions as time permits.

Also attached is a front.php3 file which, if dropped in your dadaimc
directory will redirect article URLs of the old form (active) to the
new form (dada).  This is nice for people who have bookmarked
articles, or sites linking deeply into your active site.  (You may be
pleasantly surprised how many do; I was.)  It uses a table created by
the above conversion script, which maps active ids to dadaimc
objectids.

Good luck!  Thanks to spud for creating and releasing dada; it is well
designed and commented, and makes maintaining an IMC site dreamy.

				-Clint


-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert.pl
Type: application/x-perl
Size: 9126 bytes
Desc: not available
Url : http://lists.cu.groogroo.com/mailman/archive/imc-tech/attachments/20020917/b9cd7c62/convert.pl
-------------- next part --------------
<?

//Redirect old active queries of the form "article_id=..." to the
//dada form "newswire/display/id" using the activemap table created
//by the convert.pl script

include_once ('header.inc');
$oracle = new Oracle();
$oracle->set_dbname($GLOBALS['g_db_name']);
$oracle->set_selectfields('new');
$oracle->set_tablename('activemap');
$oracle->set_where_clause("old=$article_id");
$oracle->set_check_deleted(false);
if (!$oracle->get_record(false)) {
#	$oracle->display_error();
	header("Location: /"); /* Redirect browser */
}
else {
	header("Location: /newswire/display/".$oracle->response_array[0]['new']);
	}


More information about the Imc-tech mailing list