Remote Import Plugin

945 views
Skip to first unread message

Maria T

unread,
Nov 24, 2011, 8:16:56 AM11/24/11
to ResourceSpace
Hi All,

I was hoping someone might be able to offer some advice. First of all,
the remote import facility in the new version of ResourceSpace is
fantastic. I have tested it out with a couple of records and it works
fine. My problem is that I have over 160,000 lines of XML that I wish
to import (just the metadata, no files). Currently it manages about
900 lines before timing out, whereupon I get the following error:
Fatal error: Maximum execution time of 300 seconds exceeded in C:
\xampp\htdocs\resourcespace\include\db.php on line 237. I don't mind
splitting it up, but at this rate I will have to run it over 170
times...

I am running XAMPP (Apache 2.2.21;MySQL 5.5.16;PHP 5.3.8;phpMyAdmin
3.4.5 etc.). I have altered the following files:
- php.ini (changed to settings in RS Wiki)
- config.inc.php (added the line $cfg['ExecTimeLimit'] = 0;)
- httpd.config (increased value of SSLSessionCacheTimeout)

I have also searched for other php.ini files to see if there any
conflicts (there are none); emptied the cache and restarted Apache
(several times).

Apologies for my ignorance and I would be immensely grateful if anyone
can offer any suggestions!
Thanks,
Maria

Maria T

unread,
Nov 25, 2011, 4:09:51 AM11/25/11
to ResourceSpace
A few people have asked me where the remote import plugin resides, so
I thought I would post it to the forum, where it may be of some use.

wwwroot/resourcespace/plugins/remoteimport

From the readme file: "There's no need to activate the plugin in Team
Centre because it's stand-along (it doesn't hook in to any existing
functionality)."

I don't feel qualified to offer any other advice as I haven't managed
to upload more than 35 records at a time!

Maria

Maria T

unread,
Nov 28, 2011, 6:55:25 AM11/28/11
to ResourceSpace
Sorry about all the posts but I managed to resolve the issue by adding
the following line of code to update.php:

ini_set('max_execution_time',);

Jeff Harmon

unread,
Nov 28, 2011, 7:00:49 AM11/28/11
to resour...@googlegroups.com, ResourceSpace
Thanks, Maria! I hope the team has a chance to review this for inclusion to the plugin's code base.

Best,
Jeff

--
Jeff Harmon
Chief Executive Officer
Colorhythm LLC
http://www.colorhythm.com

Main Office: +1 415-399-9921
Fax: +1 253-399-9928
Mobile: +1 510-710-9590

jha...@colorhythm.com

> --
> You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
> To post to this group, send email to resour...@googlegroups.com.
> To unsubscribe from this group, send email to resourcespac...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.
>

Hassan El-Zayyat

unread,
Apr 29, 2013, 5:55:14 PM4/29/13
to resour...@googlegroups.com
Hi,

I had some trouble getting started with it too. I wasn't able to avoid some php programming to use it. First you need to prepare your XML defining the resources and metadata you are going to add, using the example in the plugin as a guide.
Next you need your XML in a string variable. Let's call it $xml_source. Finally you need to prepare an MD5 hash of the XML and your installation's scramble key. In my case the XML is in a file, $filename, and I proceed as follows:

$f = fopen( $filename, 'r');
$xml_source = fread($f,filesize($filename));
$md5r = md5($scramble_key . $xml_source);
?>
<FORM action="[your path to]/plugins/remoteimport/pages/update.php" method="POST">
<input type="hidden" name="xml" value="<?php echo $xml_source ?>">
<input type="hidden" name="sign" value="<?php echo $md5r ?>">
<input type="submit" name="submit" value="Import resources"/>
<p><?php echo $warn ?></p>
</FORM>

Clicking on "Import resources" calls the remote import plugin. You don't have to do it this way, but you need to pass it "xml" and "sign".
Hope this helps,
Regards
Hassan


On Monday, April 29, 2013 10:26:53 PM UTC+2, mann...@gmail.com wrote:
Hi All,

How to execute the remoteimport plugin, I mean, how to use it, please provide examples.

Thanks

Hassan El-Zayyat

unread,
Apr 29, 2013, 6:10:22 PM4/29/13
to resour...@googlegroups.com
Sorry, you can ignore the line

<p><?php echo $warn ?></p>

I add around a thousand resources at a time and I just put out a warning to the user that this will take a looong time.

Hassan

mann...@gmail.com

unread,
Apr 30, 2013, 12:24:16 PM4/30/13
to resour...@googlegroups.com
Thanks Hassan for the detailed explanation. I have tried the api_scramble_key as well as the scramble_key from my config.php file and I still get an Invalid Signature error, any insight into this please.

Sincerely

Allison Stec

unread,
Apr 30, 2013, 1:03:20 PM4/30/13
to ResourceSpace
"Finally you need to prepare an MD5 hash of the XML and your installation's scramble key"

The md5 validation is throwing the invalid signature error.


--
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hassan El-Zayyat

unread,
Apr 30, 2013, 1:04:33 PM4/30/13
to resour...@googlegroups.com
It is $scramble_key from your config.php. Are you sure both $xml_source and $sign are being passed correctly to the plugin?

mann...@gmail.com

unread,
Apr 30, 2013, 11:23:46 PM4/30/13
to resour...@googlegroups.com
Yes, thanks.

Kevin Logan

unread,
Nov 27, 2013, 3:07:20 PM11/27/13
to resour...@googlegroups.com
I have tried implementing the code Hassan showed for PHP.  The problem are the variables, particularly MD5r variable is not being populated from the PHP, into the HTML Posting code not matter how I try. The MD5r variable, or any other variable, just appears blank to whatever PHP page I post it to.  I have not found a PHP/HTML Form code that gets around this either.

Maria T

unread,
Nov 28, 2013, 9:30:10 AM11/28/13
to resour...@googlegroups.com
Hi,

Not sure if this helps anyone but I didn't find it necessary to add Hassan's code. The only modifications I made to update.php was the addition of the line 'ini_set('max_execution_time', 300000);' (as described above) and simply removed

$sign=md5($scramble_key . $xml_source);
if (getval("sign","")!=$sign) {exit("Invalid signature");}

I also uncommented xml_source, inserted the xml in the space provided and ran the script.

Maria

Dan Huby

unread,
Nov 29, 2013, 1:28:44 PM11/29/13
to resour...@googlegroups.com


On Thursday, 28 November 2013 14:30:10 UTC, Maria T wrote:
and simply removed

$sign=md5($scramble_key . $xml_source);
if (getval("sign","")!=$sign) {exit("Invalid signature");}

Hi Maria,

Removing those lines renders the plugin insecure as it removes the requirement for a signed key. I would strongly advise against doing that and instead remotely submitting the correct 'sign' parameter. From the readme:

Two paramaters most be POSTed to the script:

 - xml: the XML itself
 - sign: an MD5 hash of the installation's scramble key (from your config.php) concatenated with the above XML
 
The "sign" part ensures that this can only be used by someone that knows your system's secret scramble key, which is randomised for each installation as part of the automatic setup.

I hope that helps.

Best regards,

Dan


-- 
Dan Huby 
Montala Limited 

ResourceSpace project maintainers. Providers of ResourceSpace hosting, support and development services. 

UK: 01367 710245 
Intl: +44 136 771 0245  

Lulu

unread,
Jan 28, 2014, 7:29:22 PM1/28/14
to resour...@googlegroups.com
Hi All,
I am tryinng to use remote import to update metadata for existing resources. Is there a way to make it update metadata for alternate files?
Many thanks

Allison Stec

unread,
Jan 29, 2014, 10:21:12 AM1/29/14
to ResourceSpace
This functionality isn't built in. The code would have to be modified to make it work.

Allison Stec
Asset Management Specialist
Colorhythm

--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---

Dan Huby

unread,
Jan 29, 2014, 11:31:30 AM1/29/14
to resour...@googlegroups.com
Also, alternative files don't have metadata.


You received this message because you are subscribed to a topic in the Google Groups "ResourceSpace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/resourcespace/bWS3F9C7muI/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to resourcespac...@googlegroups.com.

neel bhatt

unread,
Aug 18, 2016, 2:08:16 AM8/18/16
to ResourceSpace
Hey All,

I see here that alternative files does not have metadata. So is there any way I can update alternative file with one of the unique field, Let us say I want to tie a keyFile with every alternative file and whenever user deletes that alternative file, that keyFile would be sent to service and thus that keyFile would be deleted from our database as well.

Thanks ,
Neel
Reply all
Reply to author
Forward
0 new messages