contrib modules security updates
This commit is contained in:
@@ -5,6 +5,64 @@
|
||||
* Schema definitions install/update/uninstall hooks.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function feeds_requirements($phase) {
|
||||
$t = get_t();
|
||||
|
||||
$requirements = array();
|
||||
|
||||
module_load_include('module', 'feeds');
|
||||
// Check if we have any SimplePie importers.
|
||||
$needs_simplepie = FALSE;
|
||||
foreach (feeds_importer_load_all() as $importer) {
|
||||
if ($importer->config['parser']['plugin_key'] === 'FeedsSimplePieParser') {
|
||||
$needs_simplepie = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$needs_simplepie) {
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
$requirements['simplepie'] = array(
|
||||
'title' => $t('SimplePie'),
|
||||
'value' => $t('Installed'),
|
||||
'description' => $t('The SimplePie library is required for Feeds SimplePie Parser.'),
|
||||
'severity' => REQUIREMENT_OK,
|
||||
);
|
||||
|
||||
if (!feeds_simplepie_exists()) {
|
||||
$requirements['simplepie']['value'] = $t('Not installed');
|
||||
|
||||
$folder = drupal_get_path('module', 'feeds') . '/libraries';
|
||||
if (module_exists('libraries')) {
|
||||
$folder = 'sites/all/libraries/simplepie';
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'!url' => 'http://simplepie.org/downloads/',
|
||||
'%folder' => $folder,
|
||||
'%file' => 'simplepie.compiled.php',
|
||||
);
|
||||
$requirements['simplepie']['description'] .= $t('<br />Download the compiled, single-file version of the library from the <a href="!url">SimplePie download page</a>, place it into %folder and rename it to %file.', $args);
|
||||
$requirements['simplepie']['severity'] = REQUIREMENT_ERROR;
|
||||
}
|
||||
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement hook_uninstall()
|
||||
*/
|
||||
function feeds_uninstall() {
|
||||
variable_del('http_request_timeout');
|
||||
variable_del('feeds_reschedule');
|
||||
variable_del('feeds_use_mbstring');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_schema().
|
||||
*/
|
||||
@@ -294,6 +352,10 @@ function feeds_schema() {
|
||||
'type' => array('type'),
|
||||
),
|
||||
);
|
||||
|
||||
$schema['cache_feeds_http'] = drupal_get_schema_unprocessed('system', 'cache');
|
||||
$schema['cache_feeds_http']['description'] = 'Cache table for Feeds downloads.';
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
@@ -561,3 +623,86 @@ function feeds_update_7207() {
|
||||
'serialize' => TRUE,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update to use generic bundle handling.
|
||||
*/
|
||||
function feeds_update_7208(&$sandbox) {
|
||||
|
||||
if (!isset($sandbox['importers'])) {
|
||||
// Get all importers.
|
||||
$sandbox['importers'] = db_query("SELECT id FROM {feeds_importer}")->fetchCol();
|
||||
$sandbox['total'] = count($sandbox['importers']);
|
||||
}
|
||||
|
||||
$importer = array_pop($sandbox['importers']);
|
||||
$config = db_query("SELECT config FROM {feeds_importer} WHERE id = :id", array(':id' => $importer))->fetchField();
|
||||
|
||||
if ($config) {
|
||||
$config = unserialize($config);
|
||||
|
||||
switch ($config['processor']['plugin_key']) {
|
||||
case 'FeedsNodeProcessor':
|
||||
$config_key = 'content_type';
|
||||
break;
|
||||
|
||||
case 'FeedsTermProcessor':
|
||||
$config_key = 'vocabulary';
|
||||
break;
|
||||
|
||||
default:
|
||||
$config_key = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($config_key && isset($config['processor']['config'][$config_key])) {
|
||||
$config['processor']['config']['bundle'] = $config['processor']['config'][$config_key];
|
||||
unset($config['processor']['config'][$config_key]);
|
||||
|
||||
// Update databse.
|
||||
db_update('feeds_importer')
|
||||
->fields(array(
|
||||
'config' => serialize($config),
|
||||
))
|
||||
->condition('id', $importer)
|
||||
->execute();
|
||||
}
|
||||
|
||||
$sandbox['#finished'] = 1 - count($sandbox['importers']) / $sandbox['total'];
|
||||
}
|
||||
else {
|
||||
$sandbox['#finished'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reschedules feeds jobs.
|
||||
*/
|
||||
function feeds_update_7209() {
|
||||
// Reschedule all importers.
|
||||
variable_set('feeds_reschedule', TRUE);
|
||||
|
||||
// Our expire callback has changed names, remove all existing callbacks.
|
||||
db_delete('job_schedule')
|
||||
->condition('name', 'feeds_importer_expire')
|
||||
->execute();
|
||||
|
||||
DrupalQueue::get('feeds_importer_expire')->deleteQueue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does nothing. Update removed.
|
||||
*/
|
||||
function feeds_update_7211(&$sandbox) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create {cache_feeds_http} table.
|
||||
*/
|
||||
function feeds_update_7212() {
|
||||
if (!db_table_exists('cache_feeds_http')) {
|
||||
$schema = drupal_get_schema_unprocessed('system', 'cache');
|
||||
$schema['description'] = 'Cache table for Feeds downloads.';
|
||||
db_create_table('cache_feeds_http', $schema);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user