Skip to main content
Topic: SiteCombiner.class.php Error (Read 3172 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SiteCombiner.class.php Error

Code: [Select]
filemtime(): stat failed for /var/www/clients/client2/web1/web/themes/default/css/FFAHM/FFAHM.styles.css
http://elkarte.sch.my/index.php?action=admin;area=packages;sa=uninstall2;package=FFAHM.v.112.elkarte.ahrasis.com.zip;pid=208
File: /var/www/clients/client2/web1/web/sources/SiteCombiner.class.php

263: $filename = $options['dir'] . $options['basename'];
264: $this->_combine_files[$options['basename']] = array(
265: 'file' => $filename,
266: 'basename' => $options['basename'],
267: 'url' => $options['url'],
==>268: 'filemtime' => filemtime($filename),
269: 'minimized' => (bool) strpos($options['basename'], '.min.js') !== false || strpos($options['basename'], '.min.css') !== false,
270: );
Code: [Select]
file_get_contents(/var/www/clients/client2/web1/web/themes/default/css/FFAHM/FFAHM.styles.css): failed to open stream: No such file or directory
http://elkarte.sch.my/index.php?action=admin;area=packages;sa=uninstall2;package=FFAHM.v.112.elkarte.ahrasis.com.zip;pid=208
File: /var/www/clients/client2/web1/web/sources/SiteCombiner.class.php

341: // Read in all the data so we can process
342: foreach ($this->_combine_files as $key => $file)
343: {
==>344: $tempfile = trim(file_get_contents($file['file']));
345: $tempfile = (substr($tempfile, -3) === '}()') ? $tempfile . ';' : $tempfile;
346: $this->_combine_files[$key]['content'] = $tempfile;

The above only happens while uninstalling FFAHM addon i.e. hooking the following code into integrate_admin_areas:
Code: [Select]
	global $modSettings;

// Add style(s)
if (!empty($modSettings['ffahm_enable']))
loadCSSFile('FFAHM/FFAHM.styles.css');

After several tests, I managed to get it working, installed and uninstalled without errors by putting a full url instead of path from css path as follows:
Code: [Select]
	global $modSettings, $settings;

// Add style(s)
if (!empty($modSettings['ffahm_enable']))
loadCSSFile($settings['default_theme_url'] . '/css/FFAHM/FFAHM.styles.css');

Oddly, my other addons doesn't face the same error though load css in a very similar way.

Any explanation or correction for this?

Re: SiteCombiner.class.php Error

Reply #1

The workaround you found IIRC will not compress the file using minifying (unless it's smart enough to guess the internal origin and the directory).

A question: are you using the default theme or a custom one?
Also, 1.1 or 1.0?
Bugs creator.
Features destroyer.
Template killer.

Re: SiteCombiner.class.php Error

Reply #2

Default 1.0.9. Noted that css is not minified this way, but using subfolder in css will log the above errors on uninstall. Other workaround is not using its own css folder, I think, but haven't tested this.

Re: SiteCombiner.class.php Error

Reply #3

Ohhh... now I got it!
hmm... okay, TL;DR: the workaround is to add a file_exists in the code, probably just before line 344. The fix is to overhaul a lot of stuff. xD
Bugs creator.
Features destroyer.
Template killer.

Re: SiteCombiner.class.php Error

Reply #4

You mean like this?
Code: [Select]
				if(file_exists($file['file']))
$tempfile = trim(file_get_contents($file['file']));

Re: SiteCombiner.class.php Error

Reply #5

I'd try:
Code: [Select]
				if (file_exists($file['file']) === false)
continue;
but based only on the code you posted, I didn't check the rest of the code, and I seem to remember there is also "something else" to do... but if the file doesn't exist there is no point in keeping it, right?
Bugs creator.
Features destroyer.
Template killer.

Re: SiteCombiner.class.php Error

Reply #6

The file is there but the code didn't read it correctly during addon's removal like it did during addon's installation. That is what causing the issue. I am not sure whether checking the file rather than checking its location is right here. But I will test it later.

Re: SiteCombiner.class.php Error

Reply #7

My guess is that the error triggers when you have already clicked "uninstall", at that point the file is added to the list of files to compress, but in just a few lines of code (before the template is rendered) it is also deleted by the package manager, and here it comes the error.
Bugs creator.
Features destroyer.
Template killer.