Hi,

Unfortunately, this query

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

won't work with a million files.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

js’s picture

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

  //$files = $query->execute()->fetchAllAssoc('fid');
  $files = $query->execute();
  $failed = array();
  //foreach ($files as $fid => $file) {
  foreach ($files as $file) {
ParisLiakos’s picture

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

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

js’s picture

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

ParisLiakos’s picture

Status: Active » Needs review

thanks

Devin Carlson’s picture

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.