Works fine if I activate only the storm check box in admin/build/modules. All run into a mess when I activate the “Storm project” feature.

The http://site/storm display WSOD and watchdog sort bunch of pages with error “readdir() expects parameter 1 to be resource, boolean given in /home/ronline/www/sites/all/modules/storm/storm.module on line 80”
I can't tell how many of them I've counted only the first nine pages.

Comments

juliangb’s picture

Status: Active » Postponed (maintainer needs more info)

What value is assigned to the variable storm_icons_path?

ronline’s picture

Status: Postponed (maintainer needs more info) » Active

The storm_icons_path was “sites/default/modules/storm/icons” while the storm module is in “sites/all/modules/storm/” . I've changed the path to “sites/all/modules/storm/icons” and problem has gone. Thx for the help Julian !

juliangb’s picture

Title: WSOD readdir() expects parameter 1 to be resource, boolean given » Check icons directory on saving settings form
Category: bug » task

Great to hear.

I'm changing this issue now to a task that tries to prevent the occurrence - I think we should check that the directory exists when you change this in the settings form.

It might also be worth checking for this when we try to read the directory - and providing a more useful error message.

kfritsche’s picture

StatusFileSize
new2.36 KB

Here comes a patch for this issue.

Adds a validate function for the admin setting and uses file_scan_directory from drupal, instead of doing this self. This function checks, if the directory exists.

kfritsche’s picture

Status: Active » Needs review

set to 'needs review' for testbot.

juliangb’s picture

Status: Needs review » Needs work
+++ b/storm.module
@@ -324,6 +325,25 @@ function storm_admin_settings() {
+  $icon_path_old = variable_get('storm_icons_path', drupal_get_path('module', 'storm') .'/icons');
+  $icon_path = $form_values['values']['storm_icons_path'];
+  // check if directory exists
+  if (!is_dir($icon_path)) {
+    form_set_error('storm_icons_path', t('Icon Path %path doesn\'t exists', array('%path' => $icon_path)));
+  }
+  // if it exists and changed, recache it
+  elseif ($icon_path != $icon_path_old) {
+    storm_icon_recache();

Surely this isn't checking whether the path has changed - only if it is different to the default setting?

kfritsche’s picture

Why not?
variable_get gets the last entered icon path (if not set, the default) and in the form_values is the new typed in path.
if this new path is not a directory, it sets an error.
But the recache must to be moved in a submit function, because a recache there, uses the old path...

kfritsche’s picture

Status: Needs work » Needs review
StatusFileSize
new2.42 KB

New Patch.
Removed recache in validation, but delete the cache, so the next time it will be rebuild with the new path.

juliangb’s picture

My mistake. I read the default value and missed the variable_get.

juliangb’s picture

StatusFileSize
new2.35 KB

Reviewed and tested.

I've attached an amended patch - two small changes
- One trailing white space removed
- Error message slightly amended

juliangb’s picture

Status: Needs review » Fixed

Committed to 2.x.

Status: Fixed » Closed (fixed)

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