function views_sexy_throbber_install in Views Sexy Throbber 7.2
Implements hook_install().
File
- ./
views_sexy_throbber.install, line 50 - Views Sexy Throbber installation file.
Code
function views_sexy_throbber_install() {
// Include the views sexy throbber variables.
include 'variables.inc';
// Check if the custom throbber directory exist and if not create it.
if (!file_prepare_directory($user_directory, $options = FILE_CREATE_DIRECTORY)) {
drupal_set_message(get_t('Fatal Error: There was a problem creating the views sexy throbber directory. Please make sure your public folder is writable by Drupal and reinstall the module. If you need more help please use the module issue page or read the documentation.'), 'error', TRUE);
}
// Copy the default thobber images to the user directory.
foreach ($throbber_images_default as $throbber_image) {
$throbber_copy_source = $throbber_image->uri;
$throbber_copy_target = $user_directory . '/' . $throbber_image->filename;
file_unmanaged_copy($throbber_copy_source, $throbber_copy_target, FILE_EXISTS_REPLACE);
}
// Create the user css file if not exists.
if (!file_exists($user_css_uri)) {
// Create the user css file by cloning the original.
file_unmanaged_copy($default_css_uri, $user_css_uri, FILE_EXISTS_REPLACE);
}
// Make the user css file writable.
drupal_chmod($user_css_uri, $mode = 664);
}