Problems with cache after upgrading to 5.4

Permalink
Hey folks,

i got problems after upgrading to 5.4, but only with one particularly site. 8 of the sites i've upgraded are fine, one can't find the theme's css anymore.

A look into the page's source code, shows that the css relation isn't like it should be:
<link rel="stylesheet" media="screen" type="text/css" href="/index.php/tools/css/themes/themename/main.css" /> 
<link rel="stylesheet" media="screen" type="text/css" href="/index.php/tools/css/themes/themename/typography.css" />


..disabling the cache seems to "solve" the problem.. but this can't be the solution

..curious is, that also the site with disabled cache shows this "/index.php/tools/css/.." in the path to the css.. but this site is displayed correctly..

dom
 
mose replied on at Permalink Reply
mose
The information you posted looks fine, at first glance. What do you think is wrong with the CSS references? Do you have pretty URLs turned on for the site? If so, have you defined URL_REWRITING_ALL to be true in config/site.php? Have you cleared the cache in c5? You might want to clear out the files/cache directory, as well.
Mnkras replied on at Permalink Reply
Mnkras
i have seen this as well not sure whats causing it, clearing the cache (server and local) didn't do anything after playing around a lot i got it to find the css, but the images were not being found....

can't figure it out... and this was a fresh 5.4 install no upgrade, this is only with a specific theme, the other themes work fine, (custom made checked all paths)
dom replied on at Permalink Reply
dom
..strange, images are found correctly at my site.. you said you played around and got it to find the css, do you remember what you did?
dom replied on at Permalink Reply
dom
The css reference of all our other pages shows the correct path to the css files, as they are placed in the web directory:


/themes/themename/typography.css
/themes/themename/style.css

On this site the path looks like this:

/index.php/tools/css/themes/themename/style.css

There is this /index.php/tools/css/ in front of the real path.

- i have pretty url on, yes
- URL_REWRITING_ALL isn't turned on
- i cleared the cache through the backend
and manually by deleting files in
/files/cache and /files/cache_objects
Remo replied on at Permalink Reply
Remo
just some background information: There's a good reason why c5 doesn't include css files without index.php. C5 has a "theme customize" feature where you can set a few properties like colours and fonts.

These custom values must be included in the css file. This is why you have index.php and no direct links to you css files... Never causes any problems for me though
dom replied on at Permalink Reply
dom
..but do i need to include these properties even if i don't use the customize features?

When i look at all the other custom themes i've made, there is never the index.php in the path to css..
Remo replied on at Permalink Reply
Remo
no you don't have to use $this->getStyleSheet...

but it never caused any problems for me.

Can you attach your css file and post a link to your site so we can check the output?
mose replied on at Permalink Reply
mose
I would agree with Remo. The information you posted with index.php/css is correct. The css files are processed to allow customization before they are shipped out to the browser. Something else must be preventing c5 from finding the css files.

Check the common things like permissions on the directories/files. Do both files exist? Is it possible that there is an error in one or both of the css files? You can confirm that the problem is isolated to a particular theme by changing the theme on a test page to some other theme and seeing if it works.

If pretty URL's are on, I suspect that index.php shouldn't show up in the path. I will see if I can track down where that is happening and submit a patch.
mose replied on at Permalink Reply
mose
Patch not needed. If URL_REWRITING_ALL is defined as true in config/site.php, then the theme path will be created as a pretty URL.
dom replied on at Permalink Reply
dom
- files are existing for sure
- permissions are correct
- there is no error in the css files
- there is no URL_REWRITING_ALL set in the site.php
- problem exist with pretty URLs on and off

The Problem is indeed isolated to this theme, standard themes are working.
mose replied on at Permalink Reply
mose
Take a look at themes/themename/elements/header.php. How is the path to the theme being constructed?
dom replied on at Permalink Reply
dom
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('main.css')?>" />
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('typography.css')?>" />


This is how the path is constructed, not different to all our correct working sites.
Also it worked fine bevor the upgrade.
mose replied on at Permalink Reply
mose
Oops, I was working on my message above when you posted yours. I think there is a problem of some kind with your css file(s).
dom replied on at Permalink Reply
dom
I don't think so, there is no obvious problem in the css files. It worked all fine before the update and when a turn caching of, the site is displayed correct.
mose replied on at Permalink Best Answer Reply
mose
The way to determine if there is a problem or not with the css files is to do the test I suggested. Create a test page with a different theme and see if that works. Then, change the theme on the test page to the standard theme and see if it still works.

If the different theme works and the standard theme does not work, it points to a possible problem with the standard theme css file(s).
dom replied on at Permalink Reply
dom
..standard themes are working fine.. the problem only occurs with this custom theme and enabled cache..

..but what kind of failure in the css does only have effect in C5 5.4.0 and only with enabled caching?

I work with Aptana Studio wich should show every typo in the css.. and i never had a failure in a css which stops the webserver from reading it at all.
dom replied on at Permalink Reply 1 Attachment
dom
Here is the path to the site:

http://dev.abp-beyerle.sbitskunden.de/...

CSS-files, default.php and header.php are attached.
mose replied on at Permalink Reply
mose
It's hard to say what is happening without some low-level debugging. It is possible that the content of the css files is correct but that something else about the theme is not.

Is there anything unusual about the theme? Does the theme have the same name as a core theme, perhaps?
mose replied on at Permalink Reply
mose
OK, I'm looking at the website.
mose replied on at Permalink Reply
mose
Here's the problem. The css file doesn't exist (at least, at that location). Check your web server logs to confirm.

Connected to dev.abp-beyerle.sbitskunden.de.
GET /index.php/tools/css/themes/abp-beyerle/main.css
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.php/tools/css/themes/abp-beyerle/main.css was not found on this server.</p>
<hr>
<address>Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny8 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 Server at sbitskunden.de Port 80</address>
</body></html>
dom replied on at Permalink Reply
dom
..ok thats the symptom, not the problem :)
..i'm using <?php echo $this->getStyleSheet('main.css')?> to determine the path to the stylesheet.. when i use absolute paths to the css, everything works fine..
dom replied on at Permalink Reply
dom
So i found the solution. In every other theme i used <?=$this->getThemePath()?>/main.css instead of <?php echo $this->getStyleSheet('main.css'). It seems that getStyleSheet is no longer supported in 5.4.

Thanks for your help guys, really appreciate it.
mose replied on at Permalink Reply
mose
Yes, getStyleSheet() is supported. If the user is allowed to customize a theme without changing the theme itself, then it must be called. Otherwise, getThemePath() can be used to include the css without preprocessing. There is something else going on.
wizardontherun replied on at Permalink Reply
wizardontherun
what type of server are you hosting this site on?
dom replied on at Permalink Reply
dom
..our own root-server, powered by Debian Lenny 5.0.4, PHP 5.2.6, Apache 2.2.9 with Suhosin-Patch and SysCP as management tool..
mose replied on at Permalink Reply
mose
What is the external path to the core css directory? None of these exist.

/tools/css/
/index.php/tools/css/
/de/tools/css/
/de/index.php/tools/css/
/de/home/tools/css/
/de/home/index.php/tools/css/

If you have pretty URLs turned on, it shouldn't matter if index.php is included or not. This looks like a rewrite problem in your web server or a directory/file permissions problem.
mose replied on at Permalink Reply
mose
I played with this some more, and it seems to be a rewriting problem with your website. There is something strange happening that you did not include in your messages.

dev.abp-beyerle.sbitskunden.de redirects to dev.abp-beyerle.sbitskunden.de/de/home/. The reference to the css is /index.php/tools/css/..., which becomes

http://dev.abp-beyerle.sbitskunden.de/index.php/tools/css......

but index.php doesn't exist at that location. The actual path appears to be

http://dev.abp-beyerle.sbitskunden.de/de/index.php/tools/css......

Most of the links on your website include /de. If "/de" is the root concrete folder, it should be defined as the relative directory in config/site.php.

The next odd thing is that the following path does resolve.

http://dev.abp-beyerle.sbitskunden.de/themes/abp-beyerle/main.css...

This would imply that the /themes directory exists at the same level as the /de directory (i.e., /themes is outside of the concrete root directory). That could explain why css.php cannot find the theme, but specifying the direct path to the theme with getThemePath() works.

You might want to check the concrete directory structure to make sure files and directories are in the right place (configure the relative directory site.php as appropriate). Look at the web server rewriting rules to confirm that they work properly.

Note that if you installed themes and then moved them, the location in the database will not match the physical location of the theme on disk, and c5 won't be able to find it.
dom replied on at Permalink Reply
dom
/de is not a sub-directory in which C5 is installed, it's just the root of the tree for the german version of this site, in the C5 sitemap

C5 is installed in the vhost root underhttp://dev.abp-beyerle.sbitskunden.de... and there also is the index.php

This path to the css is correct:http://dev.abp-beyerle.sbitskunden.de/themes/abp-beyerle/main.css...

The theme wasn't moved after installing..
dom replied on at Permalink Reply
dom
The reason why /de/home is opened by entering the site is a dirty html redirect, which i placed in the index.html..
samkitson replied on at Permalink Reply
Hi guys,

I'm looking at a similar problem to the one dom had. The path to my theme's css now has 'tools' in it (index.php/tools/css/themes/themename/main.css) and I'm using the getStyleSheet code to call it. I need to get rid of the 'tools/css' part.

Did anyone find a reason for this and/or a solution apart from using getThemePath instead of getStyleSheet?

Many thanks in advance.

Sam