EPrints Technical Mailing List Archive

Message: #00720

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Sitemap / time error


Thanks a lot for you help. I'll test it.



On Wed, Jun 13, 2012 at 10:28 PM, Mark Gregson <mark.gregson@qut.edu.au> wrote:

Having looked a little deeper the problem in EPrints::Time::local_datetime() is the argument handling.  This can be fixed by changing the following line:

my @t = localtime(@_ ? @_ : time());


my @t = localtime(@_ ? @_[0] : time());


Thanks to my colleague Matty who noticed that local_datetime() was acting like it had been passed ‘1’ as an argument.





From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Mark Gregson
Sent: Thursday, 14 June 2012 10:10 AM

To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Sitemap / time error


Hi Cristian


The lastmod date in the sitemap index is set by this line: lastmod => sprintf( "%04d-%02d-%02d", EPrints::Time::get_date_array( time ) )


In 3.3 get_date_array() has been deprecated but for backwards compatibility calls local_datetime(). It looks like there is a bug in local_datetime(), or perhaps using it to provide backwards compatibility for get_date_array() is inappropriate, as it gives incorrect results:


print STDERR Dumper( get_date_array( time() ) ), "\n";

$VAR1 = '2012';

$VAR2 = '06';

$VAR3 = '14';


print STDERR Dumper( local_datetime( time() ) ), "\n";

$VAR1 = 1970;

$VAR2 = 1;

$VAR3 = 1;

$VAR4 = 10;

$VAR5 = 0;

$VAR6 = 1;


Until this is fixed you could paste the following into create_sitemap

sub get_date_array


     my( $time ) = @_;


     $time = time unless defined $time;


     my @date = localtime( $time );



           sprintf( "%02d", $date[5]+1900 ),

           sprintf( "%02d", $date[4]+1 ),

           sprintf( "%02d", $date[3] ) );



and remove the ‘EPrints::Time::’ from the line I included at the top so that this gets called instead of the broken EPrints method.





From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Centro de Documentación
Sent: Wednesday, 13 June 2012 11:24 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Sitemap / time error



I don't know why my sitemap.xml file shows this:

<sitemapindex xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">


The lastmod tag values inside sitemap-abstracts.xml.gz file are ok

<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">


Any suggestion?



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/