You are here

function media_browser_plus_rebuild_folder_structure in Media Browser Plus 7.3

Rebuilds the folder structure on the disk.

All local files that have a folder id will be processed. If a file isn't located where it should be it's moved to the correct place. This will trigger hook_file_move() so that other modules can act. After all files are processed the legacy directories are deleted if they're empty.

See also

hook_file_move()

1 call to media_browser_plus_rebuild_folder_structure()
media_browser_plus_media_settings_submit in includes/media_browser_plus.admin.inc
Submit handler for the Media browser plus settings form.

File

includes/media_browser_plus.folders.inc, line 260
Folder manipulation functions.

Code

function media_browser_plus_rebuild_folder_structure() {

  // Prepare batch.
  $batch = array(
    'title' => t('Rebuild folder structure'),
    'operations' => array(
      array(
        'media_browser_plus_rebuild_folder_structure_process',
        array(),
      ),
    ),
    'finished' => 'media_browser_plus_rebuild_folder_structure_complete',
    'file' => drupal_get_path('module', 'media_browser_plus') . '/includes/media_browser_plus.folders.inc',
  );
  batch_set($batch);
}