Revision 582db59d
Added by Assos Assos almost 9 years ago
drupal7/modules/system/system.install | ||
---|---|---|
800 | 800 |
'type' => 'varchar', |
801 | 801 |
'length' => 100, |
802 | 802 |
'not null' => TRUE, |
803 |
'binary' => TRUE, |
|
803 | 804 |
), |
804 | 805 |
'type' => array( |
805 | 806 |
'description' => 'The date format type, e.g. medium.', |
... | ... | |
2803 | 2804 |
->from($query) |
2804 | 2805 |
->execute(); |
2805 | 2806 |
|
2807 |
// Retrieve a list of duplicate files with the same filepath. Only the |
|
2808 |
// most-recently uploaded of these will be moved to the new {file_managed} |
|
2809 |
// table (and all references will be updated to point to it), since |
|
2810 |
// duplicate file URIs are not allowed in Drupal 7. |
|
2811 |
// Since the Drupal 6 to 7 upgrade path leaves the {files} table behind |
|
2812 |
// after it's done, custom or contributed modules which need to migrate |
|
2813 |
// file references of their own can use a similar query to determine the |
|
2814 |
// file IDs that duplicate filepaths were mapped to. |
|
2815 |
$sandbox['duplicate_filepath_fids_to_use'] = db_query("SELECT filepath, MAX(fid) FROM {files} GROUP BY filepath HAVING COUNT(*) > 1")->fetchAllKeyed(); |
|
2816 |
|
|
2806 | 2817 |
// Initialize batch update information. |
2807 | 2818 |
$sandbox['progress'] = 0; |
2808 | 2819 |
$sandbox['last_vid_processed'] = -1; |
... | ... | |
2832 | 2843 |
continue; |
2833 | 2844 |
} |
2834 | 2845 |
|
2846 |
// If this file has a duplicate filepath, replace it with the |
|
2847 |
// most-recently uploaded file that has the same filepath. |
|
2848 |
if (isset($sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) && $record->fid != $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) { |
|
2849 |
$file = db_select('files', 'f') |
|
2850 |
->fields('f', array('fid', 'uid', 'filename', 'filepath', 'filemime', 'filesize', 'status', 'timestamp')) |
|
2851 |
->condition('f.fid', $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) |
|
2852 |
->execute() |
|
2853 |
->fetchAssoc(); |
|
2854 |
} |
|
2855 |
|
|
2835 | 2856 |
// Add in the file information from the upload table. |
2836 | 2857 |
$file['description'] = $record->description; |
2837 | 2858 |
$file['display'] = $record->list; |
... | ... | |
3157 | 3178 |
db_change_field('file_managed', 'filesize', 'filesize', $spec); |
3158 | 3179 |
} |
3159 | 3180 |
|
3181 |
/** |
|
3182 |
* Convert the 'format' column in {date_format_locale} to case sensitive varchar. |
|
3183 |
*/ |
|
3184 |
function system_update_7080() { |
|
3185 |
$spec = array( |
|
3186 |
'description' => 'The date format string.', |
|
3187 |
'type' => 'varchar', |
|
3188 |
'length' => 100, |
|
3189 |
'not null' => TRUE, |
|
3190 |
'binary' => TRUE, |
|
3191 |
); |
|
3192 |
db_change_field('date_format_locale', 'format', 'format', $spec); |
|
3193 |
} |
|
3194 |
|
|
3160 | 3195 |
/** |
3161 | 3196 |
* @} End of "defgroup updates-7.x-extra". |
3162 | 3197 |
* The next series of updates should start at 8000. |
Also available in: Unified diff
Update Drupal core to version 7.40