protected function execute(InputInterface $input, OutputInterface $output) { $mappings = $this->mimetypeDetector->getAllMappings(); $totalFilecacheUpdates = 0; $totalNewMimetypes = 0; foreach ($mappings as $ext => $mimetypes) { if ($ext[0] === '_') { // comment continue; } $mimetype = $mimetypes[0]; $existing = $this->mimetypeLoader->exists($mimetype); // this will add the mimetype if it didn't exist $mimetypeId = $this->mimetypeLoader->getId($mimetype); if (!$existing) { $output->writeln('Added mimetype "' . $mimetype . '" to database'); $totalNewMimetypes++; } if (!$existing || $input->getOption('repair-filecache')) { $touchedFilecacheRows = $this->mimetypeLoader->updateFilecache($ext, $mimetypeId); if ($touchedFilecacheRows > 0) { $output->writeln('Updated ' . $touchedFilecacheRows . ' filecache rows for mimetype "' . $mimetype . '"'); } $totalFilecacheUpdates += $touchedFilecacheRows; } } $output->writeln('Added ' . $totalNewMimetypes . ' new mimetypes'); $output->writeln('Updated ' . $totalFilecacheUpdates . ' filecache rows'); }