Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Unfortunately, this query
function media_update_7209() {
...
$files = $query->execute()->fetchAllAssoc('fid');
won't work with a million files.
Comment | File | Size | Author |
---|---|---|---|
#3 | update_7209_out_of_memory_error-1848222-comment-6765098.patch | 544 bytes | js |
Comments
Comment #1
js CreditAttribution: js commentedIt does look like $fid is not used, unless the order matters, so this appears to work
Comment #2
ParisLiakos CreditAttribution: ParisLiakos commentedNope, i think order does not matter.
could you rol a patch?
Comment #3
js CreditAttribution: js commentedthis is attached:
diff --git a/media.install b/media.install
index ad86f2b..7bbd941 100644
--- a/media.install
+++ b/media.install
@@ -900,9 +900,9 @@ function media_update_7209() {
$query = db_select('file_managed', 'f')
->fields('f', array('fid', 'type', 'filemime', 'uri'));
- $files = $query->execute()->fetchAllAssoc('fid');
+ $files = $query->execute();
$failed = array();
- foreach ($files as $fid => $file) {
+ foreach ($files as $file) {
if (empty($file->filemime)) {
$file->filemime = file_get_mimetype($file->uri);
}
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedthanks
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedMedia: Migrate File Types and
media_update_7209()
which enables it have since been refactored.I don't believe that this issue applies anymore but feel free to reopen if you're still running into this.