security update for uuid xmlsitemap file_field_path
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the File (Field) Paths module.
|
||||
@@ -13,10 +14,10 @@
|
||||
function filefield_paths_schema_alter(&$schema) {
|
||||
$schema['file_managed']['fields']['origname'] = array(
|
||||
'description' => 'Original name of the file.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,14 +29,12 @@ function filefield_paths_install() {
|
||||
// filenames.
|
||||
db_add_field('file_managed', 'origname', array(
|
||||
'description' => 'Original name of the file with no path components. Used by the filefield_paths module.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
));
|
||||
db_update('file_managed')
|
||||
->expression('origname', 'filename')
|
||||
->execute();
|
||||
db_update('file_managed')->expression('origname', 'filename')->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,10 +75,10 @@ function filefield_paths_update_7103() {
|
||||
if (!db_field_exists('file_managed', 'origname')) {
|
||||
db_add_field('file_managed', 'origname', array(
|
||||
'description' => 'Original name of the file with no path components. Used by the filefield_paths module.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
));
|
||||
}
|
||||
db_update('file_managed')
|
||||
@@ -93,10 +92,10 @@ function filefield_paths_update_7103() {
|
||||
*/
|
||||
function filefield_paths_update_7104() {
|
||||
db_add_field('filefield_paths', 'active_updating', array(
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
'not null' => TRUE,
|
||||
'default' => '0'
|
||||
'default' => '0'
|
||||
));
|
||||
|
||||
// migrate variable to filefield_paths table
|
||||
@@ -123,10 +122,10 @@ function filefield_paths_update_7104() {
|
||||
*/
|
||||
function filefield_paths_update_7105() {
|
||||
db_change_field('filefield_paths', 'active_updating', 'active_updating', array(
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
'not null' => TRUE,
|
||||
'default' => 0
|
||||
'default' => 0
|
||||
));
|
||||
}
|
||||
|
||||
@@ -135,16 +134,16 @@ function filefield_paths_update_7105() {
|
||||
*/
|
||||
function filefield_paths_update_7106() {
|
||||
db_change_field('filefield_paths', 'type', 'type', array(
|
||||
'type' => 'varchar',
|
||||
'length' => 128,
|
||||
'type' => 'varchar',
|
||||
'length' => 128,
|
||||
'not null' => TRUE,
|
||||
'default' => ''
|
||||
'default' => ''
|
||||
));
|
||||
db_change_field('filefield_paths', 'field', 'field', array(
|
||||
'type' => 'varchar',
|
||||
'length' => 128,
|
||||
'type' => 'varchar',
|
||||
'length' => 128,
|
||||
'not null' => TRUE,
|
||||
'default' => ''
|
||||
'default' => ''
|
||||
));
|
||||
}
|
||||
|
||||
@@ -152,33 +151,57 @@ function filefield_paths_update_7106() {
|
||||
* Removed filefield_paths table/schema.
|
||||
*/
|
||||
function filefield_paths_update_7107() {
|
||||
$results = db_select('filefield_paths', 'ffp')->fields('ffp')->execute();
|
||||
foreach ($results as $result) {
|
||||
$instance = field_info_instance('node', $result->field, $result->type);
|
||||
if (!is_null($instance) && isset($instance["ffp_{$result->field}}"])) {
|
||||
$filepath = unserialize($result->filepath);
|
||||
$filename = unserialize($result->filename);
|
||||
|
||||
$instance["ffp_{$result->field}"] = array(
|
||||
'file_path' => $filepath['value'],
|
||||
'file_path_cleanup' => array(
|
||||
'file_path_pathauto' => $filepath['pathauto'],
|
||||
'file_path_transliterate' => $filepath['transliterate'],
|
||||
),
|
||||
'file_name' => $filename['value'],
|
||||
'file_name_cleanup' => array(
|
||||
'file_name_pathauto' => $filename['pathauto'],
|
||||
'file_name_transliterate' => $filename['transliterate'],
|
||||
),
|
||||
'active_updating' => $result->active_updating,
|
||||
);
|
||||
field_update_instance($instance);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove filefield_paths table/schema.
|
||||
db_drop_table('filefield_paths');
|
||||
|
||||
// Update field instance settings.
|
||||
drupal_load('module', 'filefield_paths');
|
||||
$field_types = array_keys(_filefield_paths_get_field_types());
|
||||
foreach (field_info_fields() as $field) {
|
||||
if (in_array($field['type'], $field_types)) {
|
||||
foreach ($field['bundles'] as $entity_type => $bundles) {
|
||||
foreach ($bundles as $bundle_name) {
|
||||
$instance = field_info_instance($entity_type, $field['field_name'], $bundle_name);
|
||||
if ($instance["ffp_{$field['field_name']}"] && !isset($instance['settings']['filefield_paths'])) {
|
||||
if (isset($instance["ffp_{$field['field_name']}"]) && !isset($instance['settings']['filefield_paths'])) {
|
||||
$instance['settings']['filefield_paths'] = array(
|
||||
'file_path' => array(
|
||||
'value' => $instance["ffp_{$field['field_name']}"]['file_path'],
|
||||
'file_path' => array(
|
||||
'value' => $instance["ffp_{$field['field_name']}"]['file_path'],
|
||||
'options' => array(
|
||||
'pathauto' => $instance["ffp_{$field['field_name']}"]['file_path_cleanup']['file_path_pathauto'],
|
||||
'pathauto' => $instance["ffp_{$field['field_name']}"]['file_path_cleanup']['file_path_pathauto'],
|
||||
'transliterate' => $instance["ffp_{$field['field_name']}"]['file_path_cleanup']['file_path_transliterate'],
|
||||
),
|
||||
),
|
||||
'file_name' => array(
|
||||
'value' => $instance["ffp_{$field['field_name']}"]['file_name'],
|
||||
'file_name' => array(
|
||||
'value' => $instance["ffp_{$field['field_name']}"]['file_name'],
|
||||
'options' => array(
|
||||
'pathauto' => $instance["ffp_{$field['field_name']}"]['file_name_cleanup']['file_name_pathauto'],
|
||||
'pathauto' => $instance["ffp_{$field['field_name']}"]['file_name_cleanup']['file_name_pathauto'],
|
||||
'transliterate' => $instance["ffp_{$field['field_name']}"]['file_name_cleanup']['file_name_transliterate'],
|
||||
),
|
||||
),
|
||||
'retroactive_update' => $instance["ffp_{$field['field_name']}"]['retroactive_update'],
|
||||
'active_updating' => $instance["ffp_{$field['field_name']}"]['active_updating'],
|
||||
);
|
||||
unset($instance["ffp_{$field['field_name']}"]);
|
||||
|
Reference in New Issue
Block a user