Révision b08fce64
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/colorbox/drush/colorbox.drush.inc | ||
---|---|---|
90 | 90 |
drush_log(dt('Directory @path was created', array('@path' => $path)), 'notice'); |
91 | 91 |
} |
92 | 92 |
|
93 |
// Set the directory to the download location. |
|
94 |
$olddir = getcwd(); |
|
95 |
chdir($path); |
|
96 |
|
|
97 |
// Download the zip archive |
|
98 |
if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) { |
|
99 |
$filename = basename($filepath); |
|
100 |
$dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip'); |
|
101 |
|
|
102 |
// Remove any existing Colorbox plugin directory |
|
103 |
if (is_dir($dirname) || is_dir('colorbox')) { |
|
104 |
drush_delete_dir($dirname, TRUE); |
|
105 |
drush_delete_dir('colorbox', TRUE); |
|
106 |
drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice'); |
|
93 |
// Download colorbox plugin only if path is writable. |
|
94 |
if (is_writable($path)) { |
|
95 |
// Set the directory to the download location. |
|
96 |
$olddir = getcwd(); |
|
97 |
chdir($path); |
|
98 |
|
|
99 |
// Download the zip archive |
|
100 |
if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) { |
|
101 |
$filename = basename($filepath); |
|
102 |
$dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip'); |
|
103 |
|
|
104 |
// Remove any existing Colorbox plugin directory. |
|
105 |
if (is_dir($dirname) || is_dir('colorbox')) { |
|
106 |
drush_delete_dir($dirname, TRUE); |
|
107 |
drush_delete_dir('colorbox', TRUE); |
|
108 |
drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice'); |
|
109 |
} |
|
110 |
|
|
111 |
// Decompress the zip archive |
|
112 |
drush_tarball_extract($filename); |
|
113 |
|
|
114 |
// Change the directory name to "colorbox" if needed. |
|
115 |
if ($dirname != 'colorbox') { |
|
116 |
drush_move_dir($dirname, 'colorbox', TRUE); |
|
117 |
$dirname = 'colorbox'; |
|
118 |
} |
|
107 | 119 |
} |
108 | 120 |
|
109 |
// Decompress the zip archive |
|
110 |
drush_tarball_extract($filename); |
|
111 |
|
|
112 |
// Change the directory name to "colorbox" if needed. |
|
113 |
if ($dirname != 'colorbox') { |
|
114 |
drush_move_dir($dirname, 'colorbox', TRUE); |
|
115 |
$dirname = 'colorbox'; |
|
121 |
if (is_dir($dirname)) { |
|
122 |
drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success'); |
|
123 |
} |
|
124 |
else { |
|
125 |
drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error'); |
|
116 | 126 |
} |
117 |
} |
|
118 | 127 |
|
119 |
if (is_dir($dirname)) {
|
|
120 |
drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success');
|
|
128 |
// Set working directory back to the previous working directory.
|
|
129 |
chdir($olddir);
|
|
121 | 130 |
} |
122 | 131 |
else { |
123 |
drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error');
|
|
132 |
drush_log(dt('Drush was unable to install the Colorbox plugin because @path is not writable. If you enable the colorbox module before you install the plugin library, you may find that colorbox does not work until you reinstall the colorbox module.', array('@path' => $path)), 'warning');
|
|
124 | 133 |
} |
125 |
|
|
126 |
// Set working directory back to the previous working directory. |
|
127 |
chdir($olddir); |
|
128 | 134 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules