media files path confusion

3 views
Skip to first unread message

Fred Reed

unread,
Feb 25, 2012, 3:17:11 PM2/25/12
to Skyline CMS
Hi

I'm trying to upgrade a skyline site from several years ago (v 3.0.7)
to the latest (3.2.0). I think I have found and corrected most of the
expected problems, but I'm still having troubles with images from the
media library.

I can see where the media_file model was changed at some point to use
'/data/' instead of 'media_files_data', and there was a reference to a
bug/change regarding a 'skyline/' prefix. However it happened, I
can't get images to show up now on my site pages because the paths
appear to be off.

In the skyline_media_cache table, I have file paths of two types:
e.g.,

/media_dirs/4/media_files_data/160x200/lbp_cover.jpg
/skyline/media_dirs/4/media_files_data/160x200/lbp_cover.jpg

In the site pages where the image is missing, the image link address
is something like:

/media/dirs/5/data/150x200/sharon_2.jpg

I also have two seemingly similar caches in the file system (which
might be my fault in copying sites):

/tmp
- /media_files
- /media_dirs
- /1
- (etc)
- /skyline
- /media_dirs
- /1
- /(etc)

What would you suggest as the best way out of this mess? Can I leave
the code as is and update path values in the media_cache table? Or
should I leave the DB alone and hack appropriate parts of the skyline
code? Or something in between?

Thanks

Fred

Flurin Egger

unread,
Feb 27, 2012, 2:55:01 AM2/27/12
to skyli...@googlegroups.com
Hi Fred,

The paths have indeed changed from /media_dirs/ID/media_files_data/SIZE/FILENAME to /media/dirs/ID/data/SIZE/FILENAME you should be able to clear your cache table; the same goes for your media_cache files (NOT the uploads).

The /skyline/ prefixed paths should never be used on your site (they are meant to be used by the CMS only and should be password protected).

We have done upgrades in the past and did not encounter these problems. Can you be more specific on what goes wrong?

Regards,
Flurin

Fred Reed

unread,
Feb 27, 2012, 10:41:26 AM2/27/12
to skyli...@googlegroups.com
Hi Flurin

Thanks for the prompt reply.

I probably did mostly bring the problem on myself by trying to move servers and upgrade at the same time.  And, almost opposite of what I should have done, copied over the cache files but forgot the upload.

So, after clearing the cache table and directories and restoring the upload directory, everything worked--once!  That is, after clearing the caches, the actual images appeared on the public page, in the page editor/preview and in the media library.  But when I reload a page, the image is gone.  The cache directory (e.g., /tmp/cache/media_files/cache/media/dirs/5/data/150x200/sharon_2.jpg) and media_cache table (e.g.,  /skyline/media/dirs/5/data/100x100/sharon_2.jpg and /media/dirs/5/data/100x100/sharon_2.jpg ) are updated, but it can't find the file with link address /media/dirs/5/data/sharon_2.jpg.

I pulled the skyline code with git on Friday (I think) as a submodule local gem.

Any ideas, or need more info?

Fred

Fred Reed

unread,
Feb 27, 2012, 4:21:14 PM2/27/12
to skyli...@googlegroups.com
OK--I think I solve this one, in case anyone else comes looking...

After clearing caches, I could download images once, but not a second time.  The reason is that the media_files_data_controller uses send_data to serve the file when it is not cached, but uses send_file if it is cached.  My problem started because I had not yet installed the xsendfile apache module on my new server, and the Rails production environment config file is, by default in Rails 3, set up to use it.  This stack overflow item covers it pretty well:  http://stackoverflow.com/questions/6981658/rails-3-apache-passenger-send-file-sends-zero-byte-files

I was further confused by the apparent failure of fixes to solve the problem until I realized that the zero-byte file was then stored in my local browser cache after the first attempt.

So, installing and configuring apache to use the xsendfile module and clearing the local cache seems to have worked.

Fred

On Mon, Feb 27, 2012 at 2:55 AM, Flurin Egger <flu...@digitpaint.nl> wrote:

Luis Doubrava

unread,
Feb 27, 2012, 6:07:02 PM2/27/12
to skyli...@googlegroups.com
Hi Fred,
Thanks for posting the solution. In the case that anyone can't install the xsendfile module it's also an option to comment out the X-Sendfile line in the environment configuration.

Cheers, Luis

Reply all
Reply to author
Forward
0 new messages