This migrator for LSV relied on a pre-populated list of URLs and relative file paths which were found in their post content. Using the filenames from the relative file paths, the migrator attempts to find the file in the local media repository (wp-content/uploads, as well as some media archives provided by LSV).
In order to shave some execution time, I created a reusable function in Attachments.php that indexes and caches the local media library. I think this might be useful going forward, so I'd like the team to review this and provided feedback.
This migrator for LSV relied on a pre-populated list of URLs and relative file paths which were found in their post content. Using the filenames from the relative file paths, the migrator attempts to find the file in the local media repository (
wp-content/uploads
, as well as some media archives provided by LSV).In order to shave some execution time, I created a reusable function in
Attachments.php
that indexes and caches the local media library. I think this might be useful going forward, so I'd like the team to review this and provided feedback.