AW: [opencms-dev] set last modified of a file

Arno Illmann, e-Commerce Team SO AIllmann at Actebis.com
Wed Apr 28 13:48:01 CEST 2004


Hi Olli,

I finally did it with something like in following sample:

CmsJspActionElement cms = new com.opencms.flex.jsp.CmsJspActionElement(pageContext, request, response);
CmsResource res = cms.getCmsObject().readFileHeader(/dir/dir/file);
if ( (!res.isLocked()) && (res.getState()==0) ) {
        res.setDateLastModified(System.currentTimeMillis());
        }

Much faster - you don't have to lock, publish and so on (the task was only to check if "file" was altered, and if, include it *one time*).

Regards
Arno



-----Ursprüngliche Nachricht-----
Von: Olli Aro [mailto:olli_aro at yahoo.co.uk] 
Gesendet: Mittwoch, 28. April 2004 09:46
An: opencms-dev at opencms.org
Betreff: RE: [opencms-dev] set last modified of a file


How about: -
 
com.opencms.file.CmsObject oFile = cmsa.getCmsObject(); // cmsa is the JspActionElement instance.
oFile.touch( "/dir/dir/file.html", System.currentTimeMillis() ,false); 
oFile.unlockResource( "/dir/dir/file.html");
oFile.publishResource( "/dir/dir/file.html");
 
Olli
 

From: opencms-dev-admin at opencms.org [mailto:opencms-dev-admin at opencms.org] On Behalf Of Arno Illmann, e-Commerce Team SO
Sent: 28 April 2004 07:35
To: 'opencms-dev at opencms.org'
Subject: AW: [opencms-dev] set last modified of a file
 
Hi Olli 
Had this too... getting the object from the JspActionElement . Works. You only have to unlock and publish then. 
Regards, Arno 


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.669 / Virus Database: 431 - Release Date: 26/04/2004



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.669 / Virus Database: 431 - Release Date: 26/04/2004
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040428/fc682f43/attachment.htm>


More information about the opencms-dev mailing list