Skip to main content
Topic: filemtime error in SiteCombiner (Read 250 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

filemtime error in SiteCombiner

I was testing Simple Portal (development) addon and when uninstalling it I get this error:

Quote
Warning: filemtime(): stat failed for
portal.css
/index.php?action=admin;area=packages;sa=uninstall2;package=SimplePortal_ElkArte-development.zip;pid=422
File: /var/www/clients/client2/web14/web/sources/SiteCombiner.class.php
Line: 348

The error complains this part of SiteCombiner.class.php:
Code: [Select]
	private function _addFile($options)
{
if (isset($options['dir']))
{
$filename = $options['dir'] . $options['basename'];
$this->_combine_files[$options['basename']] = array(
'file' => $filename,
'basename' => $options['basename'],
'url' => $options['url'],
'filemtime' => filemtime($filename),
'minimized' => (bool) strpos($options['basename'], '.min.js') !== false || strpos($options['basename'], '.min.css') !== false,
);

$this->_stales[] = $this->_combine_files[$options['basename']]['filemtime'];

return true;
}
return false;
}

I read elsewhere where it is suggested to run a check whether $filename exists before continuing with filemtime, otherwise, similar error as above may occur. So I was wondering whether we should add a condition to it to prevent such an error from reoccuring? Is the following way the right way to fix it?

Code: [Select]
	private function _addFile($options)
{
if (isset($options['dir']))
{
$filename = $options['dir'] . $options['basename'];
if (file_exists($filename)) {
$this->_combine_files[$options['basename']] = array(
'file' => $filename,
'basename' => $options['basename'],
'url' => $options['url'],
'filemtime' => filemtime($filename),
'minimized' => (bool) strpos($options['basename'], '.min.js') !== false || strpos($options['basename'], '.min.css') !== false,
);

$this->_stales[] = $this->_combine_files[$options['basename']]['filemtime'];

return true;
}
}
return false;
}

Re: filemtime error in SiteCombiner

Reply #1
Heck I could have added that as well to 1.1.3... oh well, 1.1.4 will be.

Could you please track it at github?
Bugs creator.
Features destroyer.
Template killer.

Re: filemtime error in SiteCombiner

Reply #2
Added locally.
Bugs creator.
Features destroyer.
Template killer.

Re: filemtime error in SiteCombiner

Reply #3
I was not sure then, so I posted without tracking it. I will add it in the github then.