You are here

function js_uninstall in JS Callback Handler 7.2

Same name and namespace in other branches
  1. 7 js.install \js_uninstall()

Implements hook_uninstall().

File

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

Code

function js_uninstall() {

  // Delete js.php to remove any leftovers from the js module.
  $file = DRUPAL_ROOT . DIRECTORY_SEPARATOR . 'js.php';
  if (file_exists($file)) {
    if (!unlink($file)) {
      drupal_set_message(t('Can not delete js.php'), 'warning');
    }
    else {
      drupal_set_message(t('Deleted js.php successfully'));
    }
  }

  // If the .htaccess contains references to js.php, notify the user they should
  // clean it up.
  if (variable_get('js_server_software', 'apache') == 'apache' && strpos(file_get_contents(DRUPAL_ROOT . DIRECTORY_SEPARATOR . '.htaccess'), 'js.php') !== FALSE) {
    drupal_set_message(t('The js.php file is still referenced in the .htaccess file. Please make sure to remove the .htaccess handling for js.php for a full uninstall.'));
  }

  // Delete used variables.
  variable_del('js_server_software');
}