File Date not updating automatically

Phoca Download - download manager
jmiller121
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Nov 2009, 22:34

File Date not updating automatically

Post 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
Last edited by jmiller121 on 19 Nov 2009, 16:35, edited 1 time in total.
codejunkie
Phoca Professional
Phoca Professional
Posts: 167
Joined: 11 Apr 2009, 01:30
Contact:

Re: File Date not updating automatically

Post 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.
Download Phoca Download Menu Module for listing Sections or Categories.
jmiller121
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Nov 2009, 22:34

Re: File Date not updating automatically

Post 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
codejunkie
Phoca Professional
Phoca Professional
Posts: 167
Joined: 11 Apr 2009, 01:30
Contact:

Re: File Date not updating automatically

Post by codejunkie »

This PHP function is probably the one you need to look at. I could be wrong on that, though.
Download Phoca Download Menu Module for listing Sections or Categories.
jmiller121
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Nov 2009, 22:34

Re: File Date not updating automatically

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: File Date not updating automatically

Post by Jan »

Thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply