Download & Extend

The directory cache/simplepie does not exist even though it does.

Project:SimplePie Core
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

in default/files i made the file folders/ cache and simplepie so the path is default/files/cache/simplepie. I did add the simplepie.inc file properly into the module as well. However, no matter what I do it keeps telling me that The directory cache/simplepie does not exist. How can this be fixed?

I read a similar thread about this but I was confused about what was going on ....
Thanks,
Becky

Comments

#1

If you put "sites/default/files/cache/simplepie" in the form, it seems to work, so the error is being generated from the form callback (system_check_directory) function that is not including the files directory.

To fix:
comment out this line:
// '#after_build' => array('system_check_directory'),

and it should work. It seems that the system_check_directory does not automatically check the files directory.

A proper fix would be to append the file_directory_path() to the system_check_directory() callback, but I didn't have time to try that out.

#2

Try this update to the module file. It replaces the system_check_directory with a custom function.

AttachmentSize
simplepie.module_6.x-1.0-beta1-MOD.zip 2.12 KB

#3

or if you prefer, here is a patch file:

AttachmentSize
simplepie.1.11.4.5.patch.txt 2.78 KB

#4

Thanks! I'll try this out. Sorry for the delay in response time. I've been away for a bit.

Becky

#5

Status:active» fixed

Hi Becky, and sorry for not coming around to answer you earlier. I really did mean to. :/

All paths are, like the files directories, relative to Drupal's base path. So if you create default/files/cache/simplepie in the sites folder, the path for Drupal will be sites/default/files/cache/simplepie. This is normal Drupal behaviour, and I don't think we should try and implement all sorts of tricks to work around this. It really is a rather sound way to do, as it will actually allow you to place the cache files outside of Drupal (e.g. /tmp/drupal/cache/simplepie (if you're on a Unix system)).

I hope this helps you out. :)

ps. @rf-pldev: Thank you for trying to fix this, even if there isn't really a problem. :) However, you might want to read up on Drupal's code standards for future patches. Cheers! :D

#6

Thanks for the reply Freso. Your explanation makes sense. But, I am attaching a screenshot. I re did my path and it looks like I am still getting an error even though I know the folder is there. (I checked).
Thanks, Becky

AttachmentSize
Picture 55.png 16.71 KB

#7

Hi Freso -- in the version this comment was about (I haven't tried any of the others) there is indeed a problem. The function you are calling here: '#after_build' => array('system_check_directory') does NOT add the Drupal files directory when it checks for the folder location, so it will throw an error.

Since you DO add the Drupal files directory in other functions (with file_directory_path()) it has to be added to the path when the cache directory is checked. (And, no, the Drupal files directory does not have to be in the Drupal base path; but, yes, the Simplepie cache should probably be in the Drupal files directory, and I did not change that.)

I posted that patch quickly just to give people something that works. Functionally it's identical to yours except that it adds the Drupal files path to the Simplepie cache directory. I'm not sure what code standards you had a problem with (tabs perhaps?), but again, it wasn't meant to be a permanent solution (you could PM with with any issues you might have).

#8

Status:fixed» active

@ Becky:
I guess my last reply was misinformed, per rf-pldev's latest comment. Sorry about that. :$ Anyway, it also seems now that I actually know what the issue is and how to tackle it... so as soon as I actually have a development computer available, I should be able to look into it.

@rf-pldev:
Hm. I should probably give the code a look over again, it sounds like? I think the issue is rather that we're not behaving consistent with other file/directory paths... we shouldn't count on using the Drupal install's files directory, as there are perfectly valid reasons for wanting to place the files somewhere else (and it's not more admin interface either way, so hopefully not confusing... and the field description could easily show an example based on the specified files folder, so people who aren't going crazy with their file system setups (unlike me :p) can easily copy paste it.

What do you think?

(Also, discussion of the patch should preferably stay in the open (ie., here) so people are able to read the issue and better understand each step of the patch's life - and perhaps learn something along the way as well. Yay for information sharing; sharing is caring! :D)

#9

@Freso, I think the module is basically fine, all I did was add the Drupal files directory to the form validation (by using a slightly customized version of the Drupal function you were calling, system_check_directory()). Fixing that will get rid of the error. The only other thing you might want to do is provide for a way to remove an old simplepie cache directory if someone does move it.

I think keeping it within the files directory is fine, or just standardize it within the module where the lib file is, as I've seen some others do.

#10

Is this project still being maintained? I have a couple modules that I would like to use SimplePie with and don't want to duplicate effort but also don't want to require a module that has a bug. Also, has there been any thought to using http://drupal.org/project/libraries with this/instead?

#11

rf-pldev thanks for your mod, works well.