Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

"assets_output" write wrong cache file name

edited March 2016 in Bug Reports
hello,
related to Enabling "assets_output" produces wrong path. #355 on github.

my asset config is set to :

$config['assets_folders'] = array(
'images' => 'images/',
'css' => 'css/',
'js' => 'js/',
'pdf' => 'pdf/',
'swf' => 'swf/',
'media' => 'media/',
'captchas' => 'captchas/',
'docs' => 'docs/',
'cache' => 'cache/'
);
$config['assets_cache_folder'] = 'cache';

and my folder assets/cache is writable

but assets_output write a filename like this :
/assets/cache/cachec8619d864111a453871197ad44d0e6f0_1456819202.php

in my source html file everything seems ok :
href="/assets/cache/c8619d864111a453871197ad44d0e6f0_1456819202.php"

i modified fuel/libraries/Asset.php after line number 540 like this:
$path = ('cache' === $path) ? WEB_ROOT . $assets_path . $asset_type : WEB_ROOT . $assets_path . $asset_type . $file;

and now it works fine...

could this change cause other consequences otherwise that I do not see ?

another option i imagined is to modify in fuel/libraries/Asset.php in 1129 :

$cache_dir = $this->assets_server_path($this->assets_cache_folder, 'cache', $module);


what's the best solution ? Or does it exist another thing to do ?

thank you for any suggestion or response.
have a nice day.

Comments

  • edited 4:18PM
    I believe this is updated in the develop branch of fuel:
    https://github.com/daylightstudio/FUEL-CMS/tree/develop
  • edited 4:18PM
    sorry, unless I am mistaken. it seems that this is the same behavior with this branch.

    the written file in assets/cache is named like this
    cache53fe7151c0bafa59f1e25d6e6a1df1fc_1456873200.php

    and the link href : 53fe7151c0bafa59f1e25d6e6a1df1fc_1456873200.php
  • edited 4:18PM
    You are correct. That looks to be a bug. I've pushed a fix for this into the develop branch for you to test out:
    https://github.com/daylightstudio/FUEL-CMS/commit/60da8c6d93f895f833ecbbd0e39e654f9055d71a
  • edited 4:18PM
    thank you for the fix.
    but i tried this before starting this thread : it doesn't write anything in the assets_cache_folder...
    before i posted, i worked around a little and the simplest way i found was :

    in Asset.php:540
    $path = ('cache' === $path) ? WEB_ROOT . $assets_path . $asset_type : WEB_ROOT . $assets_path . $asset_type . $file;

    but i'm not sure of the consequences on other parts.

    by the way i am very pleased to work with fuelcms for few years now. it's the best solution for my works.
    thank you.
  • edited 4:18PM
    Try adding a slash at the end of the assets_cache_folder config parameter in fuel/application/config/asset.php
    $config['assets_cache_folder'] = 'cache/';
    I've pushed a fix for this to account for with or without since by default it is without.
    https://github.com/daylightstudio/FUEL-CMS/commit/5845651aedb2888b2a88ce66d981e3936cf95b3c
  • edited 4:18PM
    with the fix :
    1- $config['assets_cache_folder'] = 'cache/'; produces links with href to the assets directory root and no cache file in assets directory root (no writable)
    2- $config['assets_cache_folder'] = 'cache'; produces the right links to assets/cache/ with no cache file in both assets or assets/cache directories

    Sorry.
    Don't spend time about this for me. I can wait with my workaround above.
Sign In or Register to comment.