Simplepie cache location doesn't update if files directory changes
alex_b - April 2, 2008 - 13:39
| Project: | FeedAPI |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The assumption should be that if the files directory moves, the simplepie cache directory moves with it. Not so, if the old files directory continues to exist.
Steps to reproduce:
1) create site with files directory in sites/default/files,
-> parser simplepie points to sites/default/files/simplepie_cache
2) copy site db, copy files directory to sites/copy1/files
3) change file settings in copy1 site so that the files directory points to sites/copy1/files
-> parser simplepie still points to sites/default/files/simplepie_cache
The reason is because cache location is cached until the directory it points to isn't valid anymore:
/**
* Set the default caching directory if the current setting is not useable
*/
function _parser_simplepie_sanitize_cache() {
$cache_location = variable_get('parser_simplepie_cache', FALSE);
if (!is_writeable($cache_location) || !is_dir($cache_location) || !$cache_location !== FALSE) {
$cache_location = file_create_path(file_directory_path() . '/simplepie_cache');
if (!file_exists($cache_location) && is_writable(file_directory_path())) {
mkdir($cache_location);
}
if (!is_writeable($cache_location)) {
return FALSE;
}
variable_set('parser_simplepie_cache', $cache_location);
}
return $cache_location;
}Can't we do the following instead?
/**
* Set the default caching directory if the current setting is not useable
*/
function _parser_simplepie_sanitize_cache() {
$cache_location = file_directory_path() . '/simplepie_cache';
if (!is_writeable($cache_location) || !is_dir($cache_location) || !$cache_location !== FALSE) {
$cache_location = file_create_path($cache_location);
if (!file_exists($cache_location) && is_writable(file_directory_path())) {
mkdir($cache_location);
}
if (!is_writeable($cache_location)) {
return FALSE;
}
}
return $cache_location;
}
#1
This problem was at parser_common_syndication too. Now it's fixed.
#2
Automatically closed -- issue fixed for two weeks with no activity.