You are here

drd_server.install.php.txt in Drupal Remote Dashboard Server 6.2

Same filename and directory in other branches
  1. 7.2 drd_server.install.php.txt
<?php

/**
 * This file is used to remotely install the module drd_server on a server
 * where the files of the module are available. If you do not want that to
 * happen (i.e. for security reason) then either remove this file or rename
 * it so that it can't be executed by a direct call. If you decided to do so,
 * the module itself will not be affected in any case, just that you have to
 * setup and configure it manually.
 */

/**
 * Root directory of Drupal installation.
 *
 * This assumes that you have installed this modules in the directory
 * sites/all/modules/drd_server and if this is not true in your case,
 * please adjust the first line of code accordingly.
 */
define('DRUPAL_ROOT', realpath(getcwd()));
define('MAINTENANCE_MODE', 'update');

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/modules/system/system.module';

require_once DRUPAL_ROOT . '/includes/database.inc';

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

if (isset($_GET['base_url'])) {
  global $base_url;
  $base_url = check_plain($_GET['base_url']);
}

if (isset($_GET['install'])) {
  module_rebuild_cache();
  $modules = array();
  if (!module_exists('drd_server')) {
    $modules[] = 'drd_server';
  }
  if (!empty($modules)) {
    module_enable($modules);
    drupal_install_modules($modules);
    drupal_flush_all_caches();
  }
  $success = module_exists('drd_server');
  if (!$success) {
    print 'Module DRD_SERVER can not be enabled.';
  }
  else if (isset($_GET['server'])) {
    print 'Successfully installed. Please go to the ' . l('config page', 'admin/config/system/drd_settings', array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . ' and input this IP address: ' . ip_address();
  }
  else {
    print 'installed';
  }
  exit;
}
else if (isset($_GET['uninstall'])) {
  if (module_exists('drd_server')) {
    module_disable(array('drd_server'));
    drupal_uninstall_module('drd_server');
  }
  variable_del('drd_aes_keys');
  drupal_flush_all_caches();
  print 'uninstalled';
  exit;
}
print 'error';

File

drd_server.install.php.txt
View source
  1. /**
  2. * This file is used to remotely install the module drd_server on a server
  3. * where the files of the module are available. If you do not want that to
  4. * happen (i.e. for security reason) then either remove this file or rename
  5. * it so that it can't be executed by a direct call. If you decided to do so,
  6. * the module itself will not be affected in any case, just that you have to
  7. * setup and configure it manually.
  8. */
  9. /**
  10. * Root directory of Drupal installation.
  11. *
  12. * This assumes that you have installed this modules in the directory
  13. * sites/all/modules/drd_server and if this is not true in your case,
  14. * please adjust the first line of code accordingly.
  15. */
  16. define('DRUPAL_ROOT', realpath(getcwd()));
  17. define('MAINTENANCE_MODE', 'update');
  18. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  19. require_once DRUPAL_ROOT . '/includes/common.inc';
  20. require_once DRUPAL_ROOT . '/modules/system/system.module';
  21. require_once DRUPAL_ROOT . '/includes/database.inc';
  22. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  23. if (isset($_GET['base_url'])) {
  24. global $base_url;
  25. $base_url = check_plain($_GET['base_url']);
  26. }
  27. if (isset($_GET['install'])) {
  28. module_rebuild_cache();
  29. $modules = array();
  30. if (!module_exists('drd_server')) {
  31. $modules[] = 'drd_server';
  32. }
  33. if (!empty($modules)) {
  34. module_enable($modules);
  35. drupal_install_modules($modules);
  36. drupal_flush_all_caches();
  37. }
  38. $success = module_exists('drd_server');
  39. if (!$success) {
  40. print 'Module DRD_SERVER can not be enabled.';
  41. }
  42. else if (isset($_GET['server'])) {
  43. print 'Successfully installed. Please go to the ' . l('config page', 'admin/config/system/drd_settings', array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . ' and input this IP address: ' . ip_address();
  44. }
  45. else {
  46. print 'installed';
  47. }
  48. exit;
  49. }
  50. else if (isset($_GET['uninstall'])) {
  51. if (module_exists('drd_server')) {
  52. module_disable(array('drd_server'));
  53. drupal_uninstall_module('drd_server');
  54. }
  55. variable_del('drd_aes_keys');
  56. drupal_flush_all_caches();
  57. print 'uninstalled';
  58. exit;
  59. }
  60. print 'error';