colorbox_library_test.install 746 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * @file
  4. * Install file for the colorbox library test module.
  5. */
  6. use Drupal\Core\Site\Settings;
  7. /**
  8. * Implements hook_install().
  9. */
  10. function colorbox_library_test_install() {
  11. $library_folder = Settings::get('file_public_path') . '/libraries';
  12. $zip_file = $library_folder . '/colorbox.zip';
  13. $colorbox_folder = $library_folder . '/colorbox';
  14. if (file_exists($colorbox_folder)) {
  15. return;
  16. }
  17. file_prepare_directory($library_folder, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY);
  18. copy('https://github.com/jackmoore/colorbox/archive/master.zip', $zip_file);
  19. $zip = new \ZipArchive();
  20. $zip->open($zip_file);
  21. $zip->extractTo($library_folder);
  22. rename($library_folder . '/colorbox-master', $colorbox_folder);
  23. }