EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
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
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: Sitemap / time error
- From: Centro de Documentación <cendocu@gmail.com>
- Date: Thu, 14 Jun 2012 09:55:31 -0300
Mark,
Thanks a lot for you help. I'll test it.
Regards,
Cristian
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());
to
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.
cheers
Mark
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
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
*** 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/
- References:
- [EP-tech] Re: Sitemap / time error
- From: Centro de Documentación <cendocu@gmail.com>
- [EP-tech] Re: Sitemap / time error
- From: Mark Gregson <mark.gregson@qut.edu.au>
- [EP-tech] Re: Sitemap / time error
- From: Mark Gregson <mark.gregson@qut.edu.au>
- [EP-tech] Re: Sitemap / time error
- Prev by Date: [EP-tech] summary_page.xml - grouping documents
- Next by Date: [EP-tech] Wrong date in lift_embargos
- Previous by thread: [EP-tech] Re: Sitemap / time error
- Next by thread: [EP-tech] {Disarmed} Problem by depositing in EPrints repository with JAVA SWORD Client v2
- Index(es):