Same name and namespace in other branches
  1. 8.x-1.x tests/modules/colorbox_library_test/colorbox_library_test.install \colorbox_library_test_install() 1 comment

Implements hook_install().

File

tests/modules/colorbox_library_test/colorbox_library_test.install, line 14

Code

function colorbox_library_test_install() {
    $library_folder = Settings::get('file_public_path') . '/libraries';
    $zip_file = $library_folder . '/colorbox.zip';
    $colorbox_folder = $library_folder . '/colorbox';
    if (file_exists($colorbox_folder)) {
        return;
    }
    \Drupal::service('file_system')->prepareDirectory($library_folder, FileSystemInterface::MODIFY_PERMISSIONS | FileSystemInterface::CREATE_DIRECTORY);
    copy('https://github.com/jackmoore/colorbox/archive/master.zip', $zip_file);
    $zip = new \ZipArchive();
    $zip->open($zip_file);
    $zip->extractTo($library_folder);
    rename($library_folder . '/colorbox-master', $colorbox_folder);
}