[Clipart] Patch to add DMS support to upload script

Bryce Harrington bryce at bryceharrington.com
Sun Aug 28 18:46:09 PDT 2005


Hi Jonadab,

I think everything's set for adding a call to DMS to the upload script,
like we talked about the other day.  Below is a patch which should add
this capability.

(For those who weren't there for the discussion, we thought it would be
good to hook up dms to the existing upload script, such that after the
upload script has stored the document normally, we also pop off a copy
to dms, just so we can start getting our feet wet with it.  This will
let us test it out in production for a month, without actually depending
on it for our regular processing.)

The dms upload capability is fairly well tested.  The one bug that I
know of with it occurs when we hit > 4000 documents.  I've cleared out
the document repository so we're starting from zero docs (i.e., this
will only contain the docs uploaded starting from when you apply the
patch).  That should give sufficient time for me to sort out that 4000
doc bug before we hit that.

I've set up DMS itself to run on fdo using a 'pseudo-daemon' approach
that kees came up with, that uses a cronjob to make sure it's running.
The version of DMS that I'm running on the server is not the latest and
greatest, but should be good enough for now.  

I don't have permissions to write to the upload_svg.cgi script, and
anyway I'd appreciate your review and application of this patch in case
it causes any problems.  Hopefully it should "just work", but if not,
let me know and we'll sort it out.

Thanks,
Bryce

-----------------------------------------------------------------------
--- upload_svg.cgi      2005-08-28 12:58:11.000000000 -0700
+++ upload_svg_w_dms.cgi        2005-08-28 18:32:33.663748380 -0700
@@ -26,6 +26,8 @@
 $CONFIG{'upload_directory'}      ||= "/var/www/cgi-bin/temp";
 $CONFIG{'destination_directory'} ||= "/var/www/html/svg";
 $CONFIG{'destination_dir_uri'}   ||= "/svg"; # '/file.svg' will be appended
+$CONFIG{'dms_bin'}               ||= "/usr/bin";
+$CONFIG{'dms_log'}               ||= "/var/log/dms_upload.log";
 
 my %input = %{getforminput( filename => 1, multiples => 'arrayrefs', content_type => 1 ) or +{}};
 if ($input{filetoken}) {
@@ -281,6 +283,10 @@
     }
     chmod( 0774, $outfile ) or $debug && warn "Unable to chmod 0744 $outfile: $!";
 
+    # Also add it to DMS
+    my $dms_cmd = "$CONFIG{dms_bin}/submit_clipart '$outfile' > $CONFIG{dms_log} 2&>1";
+    `$dms_cmd`;
+
     # Tell the user we did this, and offer a blank upload form for adding another image:
     # my $warning = @warn?"<div class=\"error\">WARNING: <ul>@warn</ul></div>":"";
     my $authcook; {



More information about the clipart mailing list