Hi,

Unfortunately, this query

<?php
function media_update_7209() {
...
$files = $query->execute()->fetchAllAssoc('fid');
?>

won't work with a million files.

Files: 
CommentFileSizeAuthor
#3 update_7209_out_of_memory_error-1848222-comment-6765098.patch544 bytesjs
PASSED: [[SimpleTest]]: [MySQL] 5 pass(es).
[ View ]

Comments

It does look like $fid is not used, unless the order matters, so this appears to work

<?php
 
//$files = $query->execute()->fetchAllAssoc('fid');
 
$files = $query->execute();
 
$failed = array();
 
//foreach ($files as $fid => $file) {
 
foreach ($files as $file) {
?>

Version:7.x-2.0-unstable7» 7.x-2.x-dev

Nope, i think order does not matter.
could you rol a patch?

StatusFileSize
new544 bytes
PASSED: [[SimpleTest]]: [MySQL] 5 pass(es).
[ View ]

this 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);
}

Status:Active» Needs review

thanks

Issue summary:View changes
Status:Needs review» Fixed

Media: 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.

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.