Révision b433176d
Ajouté par Assos Assos il y a environ 4 ans
drupal7/sites/all/modules/colorbox/drush/colorbox.drush.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* drush integration for colorbox.
|
|
5 |
* Drush integration for colorbox.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
12 | 12 |
define('COLORBOX_DOWNLOAD_PREFIX', 'colorbox-'); |
13 | 13 |
|
14 | 14 |
/** |
15 |
* Implementation of hook_drush_command().
|
|
15 |
* Implements hook_drush_command().
|
|
16 | 16 |
* |
17 | 17 |
* In this hook, you specify which commands your |
18 | 18 |
* drush module makes available, what it does and |
... | ... | |
23 | 23 |
* |
24 | 24 |
* See `drush topic docs-commands` for a list of recognized keys. |
25 | 25 |
* |
26 |
* @codingStandardsIgnoreLine |
|
26 | 27 |
* @return array |
27 | 28 |
* An associative array describing your command(s). |
28 | 29 |
*/ |
29 | 30 |
function colorbox_drush_command() { |
30 | 31 |
$items = array(); |
31 | 32 |
|
32 |
// the key in the $items array is the name of the command.
|
|
33 |
// The key in the $items array is the name of the command.
|
|
33 | 34 |
$items['colorbox-plugin'] = array( |
34 | 35 |
'callback' => 'drush_colorbox_plugin', |
35 | 36 |
'description' => dt('Download and install the Colorbox plugin.'), |
36 |
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap. |
|
37 |
// No bootstrap. |
|
38 |
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, |
|
37 | 39 |
'arguments' => array( |
38 | 40 |
'path' => dt('Optional. A path where to install the Colorbox plugin. If omitted Drush will use the default location.'), |
39 | 41 |
), |
... | ... | |
44 | 46 |
} |
45 | 47 |
|
46 | 48 |
/** |
47 |
* Implementation of hook_drush_help().
|
|
49 |
* Implements hook_drush_help().
|
|
48 | 50 |
* |
49 | 51 |
* This function is called whenever a drush user calls |
50 | 52 |
* 'drush help <name-of-your-command>' |
51 | 53 |
* |
54 |
* @codingStandardsIgnoreLine |
|
52 | 55 |
* @param string $section |
53 | 56 |
* A string with the help section (prepend with 'drush:') |
54 | 57 |
* |
58 |
* @codingStandardsIgnoreLine |
|
55 | 59 |
* @return string |
56 | 60 |
* A string with the help text for your command. |
57 | 61 |
*/ |
... | ... | |
66 | 70 |
* Implements drush_MODULE_pre_pm_enable(). |
67 | 71 |
*/ |
68 | 72 |
function drush_colorbox_pre_pm_enable() { |
69 |
$modules = drush_get_context('PM_ENABLE_MODULES');
|
|
70 |
if (in_array('colorbox', $modules) && !drush_get_option('skip')) {
|
|
71 |
drush_colorbox_plugin();
|
|
72 |
}
|
|
73 |
$modules = drush_get_context('PM_ENABLE_MODULES'); |
|
74 |
if (in_array('colorbox', $modules) && !drush_get_option('skip')) { |
|
75 |
drush_colorbox_plugin(); |
|
76 |
} |
|
73 | 77 |
} |
74 | 78 |
|
75 | 79 |
/** |
... | ... | |
96 | 100 |
$olddir = getcwd(); |
97 | 101 |
chdir($path); |
98 | 102 |
|
99 |
// Download the zip archive |
|
103 |
// Download the zip archive.
|
|
100 | 104 |
if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) { |
101 | 105 |
$filename = basename($filepath); |
102 | 106 |
$dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip'); |
... | ... | |
108 | 112 |
drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice'); |
109 | 113 |
} |
110 | 114 |
|
111 |
// Decompress the zip archive |
|
115 |
// Decompress the zip archive.
|
|
112 | 116 |
drush_tarball_extract($filename); |
113 | 117 |
|
114 | 118 |
// Change the directory name to "colorbox" if needed. |
Formats disponibles : Unified diff
Weekly update of contrib modules