EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #00714


< 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


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 );

 

     return(

           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.

 

Cheers

Mark

 

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

 

Hi,

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">

<sitemap>
<loc>http://nulan.mdp.edu.ar/sitemap-abstracts.xml.gz</loc>
<lastmod>1969-12-31</lastmod>
</sitemap>
</sitemapindex>


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">

<url><loc>http://nulan.mdp.edu.ar/1/</loc><lastmod>2011-11-08</lastmod><changefreq>yearly</changefreq><priority>1</priority></url><url><loc>http://nulan.mdp.edu.ar/2/</loc><lastmod>2011-04-12</lastmod><changefreq>yearly</changefreq><priority>1</priority></url><url><loc>http://nulan.mdp.edu.ar/3/</loc><lastmod>2011-04-12</lastmod><changefreq>yearly</changefreq><priority>1</priority></url>
.....

Any suggestion?

thanks,

Cristian