function _drush_views_slideshow_cycle_install_library in Views Slideshow 7.3
Same name and namespace in other branches
- 8.4 modules/views_slideshow_cycle/views_slideshow_cycle.drush.inc \_drush_views_slideshow_cycle_install_library()
Helper function to download a library in the given directory.
5 calls to _drush_views_slideshow_cycle_install_library()
- drush_views_slideshow_cycle_cycle in contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc - Command to download the jQuery Cycle library.
- drush_views_slideshow_cycle_easing in contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc - Command to download the jQuery.easing library.
- drush_views_slideshow_cycle_hoverintent in contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc - Command to download the jQuery.hoverIntent library.
- drush_views_slideshow_cycle_json2 in contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc - Command to download the JSON2 library.
- drush_views_slideshow_cycle_pause in contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc - Command to download the jQuery.pause library.
File
- contrib/
views_slideshow_cycle/ views_slideshow_cycle.drush.inc, line 179 - Drush integration for Views Slideshow.
Code
function _drush_views_slideshow_cycle_install_library($name, $path, $filename, $url, $args) {
// Check if path provided as an arg and use that instead of default if so.
if (!empty($args[0])) {
$path = $args[0];
}
// Create the path if it does not exist.
if (!is_dir($path)) {
drush_op('mkdir', $path, 0755, TRUE);
drush_log(dt('Directory @path was created', array(
'@path' => $path,
)), 'success');
}
// Be sure we can write in the directory.
$perms = substr(sprintf('%o', fileperms($path)), -4);
if ($perms !== '0755') {
drush_shell_exec('chmod 755 ' . $path);
}
$dir = getcwd();
// Download the JavaScript file.
if (is_file($path . '/' . $filename)) {
drush_log(dt('@name appears to be already installed.', array(
'@name' => $name,
)), 'ok');
}
elseif (drush_op('chdir', $path) && drush_shell_exec('wget --no-check-certificate ' . $url)) {
drush_log(dt('The latest version of @name has been downloaded to @path', array(
'@name' => $name,
'@path' => $path,
)), 'success');
}
else {
drush_log(dt('Drush was unable to download the @name library to @path', array(
'@name' => $name,
'@path' => $path,
)), 'error');
}
chdir($dir);
// Restore the previous permissions.
drush_shell_exec('chmod ' . $perms . ' ' . $path);
}