You are here

function js_install in JS Callback Handler 7

Same name and namespace in other branches
  1. 7.2 js.install \js_install()

Implements hook_install().

File

./js.install, line 53
Ensures JavaScript callback handler has been setup properly.

Code

function js_install() {

  // Move js.php to the root of Drupal.
  $js_dir = realpath(dirname(__FILE__));
  $destination = DRUPAL_ROOT . DIRECTORY_SEPARATOR . 'js.php';
  $source = $js_dir . DIRECTORY_SEPARATOR . 'js.php';
  if (!file_exists($destination) && file_exists($source)) {
    if (!copy($source, $destination)) {
      drupal_set_message(t('Can not copied js.php to installation root folder.'), 'error');
    }
    else {
      drupal_set_message(t('Copied js.php to installation root folder successfully.'));
    }
  }

  // Notify the user that they should add the rewrite rules to their .htaccess
  // file.
  drupal_set_message(t('To complete the installation: please add the <a href="!url">RewriteRules</a> to the .htaccess file.', array(
    '!url' => url('admin/config/system/js'),
  )));
}