I am getting a problem with the file permissions on menu_icons.css

With every refresh of my page, menu_icons.css is regenerated from scratch and watchdog fills with errors about not being able to set the permissions. I can view the menu_icons just fine and have no problems with any other modules accessing my files directory.

I have changed the permissions to 777 and all variants, but the file is just removed and recreated with this:
-rw-rw-r-- 1 www-data www-data 1491 2011-06-25 14:25 menu_icons.css

What could I have done wrong?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

latulipeblanche’s picture

I've got the same problem. While using "drush up" or "drush cc all" I get:

WD file: The specified file /tmp/fileKO6OpK could not be copied to /var/www/MY-SITE/sites/default/files/menu_icons/menu_icons.css.  [error]

"$> sudo drush cc all" is working (Ubuntu)

Changing permissions doesn't change this.

skilip’s picture

Status: Active » Needs review
FileSize
821 bytes

The following patch should fix this

sonar_un’s picture

Thanks for the path. It cleared up the error in watchdog with file permissions, however the menu icons no longer show.

the menu_icons.css is created in css/menu_icons.css now as is proper, however, I now get this message when I try edit the menu icon from the menu page.

Warning: in_array() expects parameter 2 to be array, string given in menu_icons_form_submit() (line 142 of /sites/all/modules/menu_icons/menu_icons.module).

Thanks for your help with this.

sonar_un’s picture

After finally having enough problems with this, I moved my temporary directory to sites/default/files/tmp and the problem is now gone.

Seems the patch resolved the issue.

Thanks for your help.

ewills’s picture

Hmm I tried this, including moving my temporary directory, but my icons still don't appear.

I'm getting the same issue with drush before I install the patch.

Once I've applied the patch, drush is fixed but my icons don't appear - looking at the HTML source of the generated page, the CSS file is being included from the correct directory (sites/default/files/css), however the css file itself is empty.

Any ideas?

Thanks,

Edwin

ewills’s picture

Ahha - fixed it.

Needed to change the line:

file_unmanaged_save_data($data, $csspath . '/menu_icons.css', FILE_EXISTS_REPLACE);
to
file_unmanaged_save_data($css, $csspath . '/menu_icons.css', FILE_EXISTS_REPLACE);

I'll quickly generate a new patch and post it up.

ewills’s picture

FileSize
821 bytes

Patch attached

dqd’s picture

Status: Needs review » Reviewed & tested by the community

last patch confirmed! thx

acrollet’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

acrollet’s picture

As any FYI to anyone still seeing this issue, I committed http://drupalcode.org/project/menu_icons.git/commit/098d3fa, which solves problems with drupal and drush not saving the file as the same user.