Skip to content
Snippets Groups Projects
Commit 583e6c1b authored by twistor's avatar twistor Committed by Chris Leppanen
Browse files

Issue #2509464 by twistor, Max1: Feeds module cannot find its parser module...

Issue #2509464 by twistor, Max1: Feeds module cannot find its parser module due to filesystem restriction
parent 9b6059c4
No related branches found
No related tags found
No related merge requests found
......@@ -1094,9 +1094,9 @@ function feeds_plugin($plugin, $id) {
/**
* Includes a library file.
*
* @param $file
* @param string $file
* The filename to load from.
* @param $library
* @param string $library
* The name of the library. If libraries module is installed,
* feeds_include_library() will look for libraries with this name managed by
* libraries module.
......@@ -1104,55 +1104,64 @@ function feeds_plugin($plugin, $id) {
function feeds_include_library($file, $library) {
static $included = array();
if (!isset($included[$file])) {
$included[$file] = FALSE;
$key = $library . '/' . $file;
if (!isset($included[$key])) {
$included[$key] = FALSE;
$library_dir = variable_get('feeds_library_dir', FALSE);
$feeds_library_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/$file";
// Try first whether libraries module is present and load the file from
// there. If this fails, require the library from the local path.
if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/$file")) {
require libraries_get_path($library) . "/$file";
$included[$file] = TRUE;
if (module_exists('libraries') && $path = libraries_get_path($library) && is_file("$path/$file")) {
require "$path/$file";
$included[$key] = TRUE;
}
elseif (is_file(DRUPAL_ROOT . '/sites/all/libraries/' . $key)) {
require DRUPAL_ROOT . '/sites/all/libraries/' . $key;
$included[$key] = TRUE;
}
elseif ($library_dir && file_exists("$library_dir/$library/$file")) {
require "$library_dir/$library/$file";
$included[$file] = TRUE;
elseif ($library_dir && is_file($library_dir . '/' . $key)) {
require $library_dir . '/' . $key;
$included[$key] = TRUE;
}
elseif (file_exists($feeds_library_path)) {
elseif (is_file($feeds_library_path)) {
// @todo: Throws "Deprecated function: Assigning the return value of new
// by reference is deprecated."
require $feeds_library_path;
$included[$file] = TRUE;
$included[$key] = TRUE;
}
}
return $included[$file];
return $included[$key];
}
/**
* Checks whether a library is present.
*
* @param $file
* @param string $file
* The filename to load from.
* @param $library
* @param string $library
* The name of the library. If libraries module is installed,
* feeds_library_exists() will look for libraries with this name managed by
* libraries module.
*/
function feeds_library_exists($file, $library) {
if (module_exists('libraries') && $path = libraries_get_path($library) && is_file("$path/$file")) {
return TRUE;
}
if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/$file")) {
elseif (is_file(DRUPAL_ROOT . "/sites/all/libraries/$library/$file")) {
return TRUE;
}
elseif (file_exists(DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/$file")) {
elseif (is_file(DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/$file")) {
return TRUE;
}
elseif ($library_dir = variable_get('feeds_library_dir', FALSE)) {
if (file_exists("$library_dir/$library/$file")) {
if (is_file("$library_dir/$library/$file")) {
return TRUE;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment