Created
March 26, 2014 09:02
-
-
Save skwashd/9779220 to your computer and use it in GitHub Desktop.
Enable media module and process all the files in 1 step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
If you have a large number of existing files then you will want | |
to implement batch in hook_update_N(). I didn't need that so it | |
isn't implemented here. If you need it read this article | |
http://bleen.net/blog/running-batch-processes-update-hook-bed | |
*/ | |
/** | |
* Implements hook_update_N() | |
*/ | |
function my_module_update_7123() { | |
$modules = array( | |
'media', | |
// any other modules | |
); | |
module_enable($modules); | |
// Replicates media_admin_rebuild_types_batch_op() without the batch | |
while($remaining = media_type_invalid_files_count()) { | |
media_type_batch_update(FALSE, 100); | |
} | |
// Remove nag as per media_admin_rebuild_types_batch_complete(). | |
media_variable_del('show_file_type_rebuild_nag'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment