Page 1 of 1

File Date not updating automatically

Posted: 13 Nov 2009, 22:39
by jmiller121
Hi,

I have a list of files that I update every several weeks. I've created them in PhocaDownload, but they are large files so I upload them through FTP. However, when I upload a new version of the same file, it is not updating the file date. Should the file date be updating or does it only change when you create the file entry in Phoca?

Thanks
JMiller

Re: File Date not updating automatically

Posted: 14 Nov 2009, 00:04
by codejunkie
By uploading the file via FTP, there is not a change in the database containing the record. I don't think Phoca Download does a check on the actual file stats at page display time. I don't see why you could not change this behavior to check that information.

Re: File Date not updating automatically

Posted: 14 Nov 2009, 17:53
by jmiller121
Ok, thanks for the response.... I kinda assumed that was the case.... not real educated in PHP, if anyone would have example code of how to check the file data attributes at display time it would be appreciated....

Thanks!
JMiller

Re: File Date not updating automatically

Posted: 16 Nov 2009, 16:46
by codejunkie
This PHP function is probably the one you need to look at. I could be wrong on that, though.

Re: File Date not updating automatically

Posted: 19 Nov 2009, 16:34
by jmiller121
Thanks for the reply... after doing a little digging I decided to use the filemtime function instead....

I've sort of found a way to do what I want it to do (using the filemtime function...)

In the /components/com_phocadownload/views/category/tmpl/default.php file, I changed the lines that say this:

Code: Select all

if ($valueDoc->date != '') {
	$details .= '<div>'.JText::_('File Date').': '.JHTML::Date($valueDoc->date, "%B %d, %Y").'</div>';
}
to this:

Code: Select all

if ($valueDoc->filename !='') {
	$absFile = str_replace('/', DS, JPath::clean($this->absfilepath . $valueDoc->filename));
	if (JFile::exists($absFile))
	{
		$details .= '<div>'.JText::_('Last Updated').': '.JHTML::Date(filemtime($absFile), "%B %d, %Y").'</div>';
	} else {
		$details .= '<div>'.JText::_('File Date').': '.JHTML::Date($valueDoc->date, "%B %d, %Y").'</div>';
	}
}

It works for me, hopefully this code will be somewhat helpful to others...

Regards,
JMiller

Re: File Date not updating automatically

Posted: 23 Nov 2009, 00:17
by Jan
Thank you for this info.

Jan