diff --git a/drd_remote.admin.inc b/drd_agent.admin.inc similarity index 75% rename from drd_remote.admin.inc rename to drd_agent.admin.inc index 06a050ea6b4ac4064fb5ccb1a4db661b750604f6..eb706183de1fc4451e12e5e53f85f7fe3a54d556 100644 --- a/drd_remote.admin.inc +++ b/drd_agent.admin.inc @@ -11,11 +11,11 @@ * @return array * Array containing the system settings form. */ -function drd_remote_settings($form, $form_state) { - $form['drd_remote_debug_mode'] = array( +function drd_agent_settings($form, $form_state) { + $form['drd_agent_debug_mode'] = array( '#type' => 'checkbox', '#title' => t('Debug mode'), - '#default_value' => variable_get('drd_remote_debug_mode', FALSE), + '#default_value' => variable_get('drd_agent_debug_mode', FALSE), ); return system_settings_form($form); @@ -31,16 +31,16 @@ function drd_remote_settings($form, $form_state) { * * @param string $values */ -function drd_remote_setup($values) { +function drd_agent_setup($values) { $values = strtr($values, array('-' => '+', '_' => '/')); $values = unserialize(base64_decode($values)); - $authorised = variable_get('drd_remote_authorised', array()); + $authorised = variable_get('drd_agent_authorised', array()); $values['timestamp'] = REQUEST_TIME; $values['ip'] = ip_address(); $authorised[$values['uuid']] = $values; - variable_set('drd_remote_authorised', $authorised); + variable_set('drd_agent_authorised', $authorised); if (!empty($values['redirect'])) { drupal_goto($values['redirect']); } diff --git a/drd_remote.drush.inc b/drd_agent.drush.inc similarity index 65% rename from drd_remote.drush.inc rename to drd_agent.drush.inc index 50703aa5ff99512e188b0513628b6e0fa6e6ef07..e20d3f55e2f1da01a8e079b0ad83dad2ef50c6bf 100644 --- a/drd_remote.drush.inc +++ b/drd_agent.drush.inc @@ -5,10 +5,10 @@ * * @return array */ -function drd_remote_drush_command() { +function drd_agent_drush_command() { $items = array(); - $items['drd-remote-setup'] = array( + $items['drd-agent-setup'] = array( 'arguments' => array( 'token' => 'Base64 encoded and serialized array of all variables required such that DRD can communicate with this domain in the future', ) @@ -22,9 +22,9 @@ function drd_remote_drush_command() { * * @param $token * - * @see drd_remote_setup() + * @see drd_agent_setup() */ -function drush_drd_remote_setup($token) { - include_once 'drd_remote.admin.inc'; - drd_remote_setup($token); +function drush_drd_agent_setup($token) { + include_once 'drd_agent.admin.inc'; + drd_agent_setup($token); } diff --git a/drd_agent.info b/drd_agent.info new file mode 100644 index 0000000000000000000000000000000000000000..b945001d40228522866756d2ef20326bfe19c6eb --- /dev/null +++ b/drd_agent.info @@ -0,0 +1,6 @@ +name = DRD Agent +description = Agent on remote Drupal sites for the main DRD module. +package = Administration +core = 7.x + +configure = admin/config/system/drd diff --git a/drd_remote.install b/drd_agent.install similarity index 89% rename from drd_remote.install rename to drd_agent.install index 2d86528d3485d4550c50f1725d8d2d83067359c4..d58965cde192c29306f6c3012e43646286911e82 100644 --- a/drd_remote.install +++ b/drd_agent.install @@ -4,7 +4,7 @@ * @param string $phase * @return array */ -function drd_remote_requirements($phase) { +function drd_agent_requirements($phase) { $requirements = array(); $t = get_t(); @@ -16,7 +16,7 @@ function drd_remote_requirements($phase) { 'port' => '', 'database' => '', ); - $requirements['drd_remote.database'] = array( + $requirements['drd_agent.database'] = array( 'title' => $t('Database setup'), 'value' => '<table>' . '<tr><td>' . $t('Driver') . '</td><td>' . $info['default']['driver'] . '</td></tr>' . @@ -30,7 +30,7 @@ function drd_remote_requirements($phase) { ); $securepages = module_exists('securepages'); - $requirements['drd_remote.securepages'] = array( + $requirements['drd_agent.securepages'] = array( 'title' => $t('Secure pages module installed'), 'value' => $securepages ? $t('Yes') : $t('No'), 'severity' => $securepages ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -40,7 +40,7 @@ function drd_remote_requirements($phase) { ); $analytics = (module_exists('googleanalytics') || module_exists('piwik')); - $requirements['drd_remote.module.analytics'] = array( + $requirements['drd_agent.module.analytics'] = array( 'title' => $t('Analytics module installed'), 'value' => $analytics ? $t('Yes') : $t('No'), 'severity' => $analytics ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -50,7 +50,7 @@ function drd_remote_requirements($phase) { ); $devel = !module_exists('devel'); - $requirements['drd_remote.module.devel'] = array( + $requirements['drd_agent.module.devel'] = array( 'title' => $t('Devel module disabled'), 'value' => $devel ? $t('Yes') : $t('No'), 'severity' => $devel ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -58,7 +58,7 @@ function drd_remote_requirements($phase) { ); $redirect = module_exists('redirect'); - $requirements['drd_remote.module.redirect'] = array( + $requirements['drd_agent.module.redirect'] = array( 'title' => $t('Module Redirect installed'), 'value' => $redirect ? $t('Yes') : $t('No'), 'severity' => $redirect ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -68,7 +68,7 @@ function drd_remote_requirements($phase) { ); $metatag = module_exists('metatag'); - $requirements['drd_remote.module.metatag'] = array( + $requirements['drd_agent.module.metatag'] = array( 'title' => $t('Module MetaTag installed'), 'value' => $metatag ? $t('Yes') : $t('No'), 'severity' => $metatag ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -78,7 +78,7 @@ function drd_remote_requirements($phase) { ); $mollom = module_exists('mollom'); - $requirements['drd_remote.module.mollom'] = array( + $requirements['drd_agent.module.mollom'] = array( 'title' => $t('Module Mollom installed'), 'value' => $mollom ? $t('Yes') : $t('No'), 'severity' => $mollom ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -88,7 +88,7 @@ function drd_remote_requirements($phase) { ); $pathauto = module_exists('pathauto'); - $requirements['drd_remote.module.pathauto'] = array( + $requirements['drd_agent.module.pathauto'] = array( 'title' => $t('Module PathAuto installed'), 'value' => $pathauto ? $t('Yes') : $t('No'), 'severity' => $pathauto ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -98,7 +98,7 @@ function drd_remote_requirements($phase) { ); $php = !module_exists('php'); - $requirements['drd_remote.module.php'] = array( + $requirements['drd_agent.module.php'] = array( 'title' => $t('Module PHP Filter disabled'), 'value' => $php ? $t('Yes') : $t('No'), 'severity' => $php ? REQUIREMENT_OK: REQUIREMENT_ERROR, @@ -108,7 +108,7 @@ function drd_remote_requirements($phase) { ); $xmlsitemap = module_exists('xmlsitemap'); - $requirements['drd_remote.module.xmlsitemap'] = array( + $requirements['drd_agent.module.xmlsitemap'] = array( 'title' => $t('Module XML-Sitemap installed'), 'value' => $xmlsitemap ? $t('Yes') : $t('No'), 'severity' => $xmlsitemap ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -119,7 +119,7 @@ function drd_remote_requirements($phase) { $user1 = user_load(1); $user1_ok = !in_array(strtolower($user1->name), array('admin', 'root', 'superadmin', 'manager', 'administrator', 'adm')); - $requirements['drd_remote.user1'] = array( + $requirements['drd_agent.user1'] = array( 'title' => $t('Name of user 1'), 'value' => $user1_ok ? $t('Good') : $t('Too obvious'), 'severity' => $user1_ok ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -134,7 +134,7 @@ function drd_remote_requirements($phase) { ->countQuery() ->execute() ->fetchField(); - $requirements['drd_remote.admincount'] = array( + $requirements['drd_agent.admincount'] = array( 'title' => $t('Number of admins'), 'value' => ($count_admin <= 3) ? $t('Good (!count)', array('!count' => $count_admin)) : $t('Too many (!count)', array('!count' => $count_admin)), 'severity' => ($count_admin <= 3) ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -142,7 +142,7 @@ function drd_remote_requirements($phase) { ); $css = variable_get('preprocess_css', 0); - $requirements['drd_remote.compress.css'] = array( + $requirements['drd_agent.compress.css'] = array( 'title' => $t('Aggregate and compress CSS files'), 'value' => $css ? $t('Yes') : $t('No'), 'severity' => $css ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -152,7 +152,7 @@ function drd_remote_requirements($phase) { ); $js = variable_get('preprocess_js', 0); - $requirements['drd_remote.compress.js'] = array( + $requirements['drd_agent.compress.js'] = array( 'title' => $t('Aggregate JavaScript files'), 'value' => $js ? $t('Yes') : $t('No'), 'severity' => $js ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -162,7 +162,7 @@ function drd_remote_requirements($phase) { ); $page = variable_get('page_compression', 0); - $requirements['drd_remote.compress.page'] = array( + $requirements['drd_agent.compress.page'] = array( 'title' => $t('Compress cached pages'), 'value' => $page ? $t('Yes') : $t('No'), 'severity' => $page ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -172,7 +172,7 @@ function drd_remote_requirements($phase) { ); $page403 = variable_get('site_403', ''); - $requirements['drd_remote.defined.403'] = array( + $requirements['drd_agent.defined.403'] = array( 'title' => $t('Default 403 (access denied) page'), 'value' => empty($page403) ? $t('Undefined') : $page403, 'severity' => empty($page403) ? REQUIREMENT_WARNING: REQUIREMENT_OK, @@ -182,7 +182,7 @@ function drd_remote_requirements($phase) { ); $page404 = variable_get('site_404', ''); - $requirements['drd_remote.defined.404'] = array( + $requirements['drd_agent.defined.404'] = array( 'title' => $t('Default 404 (not found) page'), 'value' => empty($page404) ? $t('Undefined') : $page404, 'severity' => empty($page404) ? REQUIREMENT_WARNING: REQUIREMENT_OK, @@ -192,7 +192,7 @@ function drd_remote_requirements($phase) { ); $cache = variable_get('cache', 0); - $requirements['drd_remote.enable.cache'] = array( + $requirements['drd_agent.enable.cache'] = array( 'title' => $t('Cache pages for anonymous users'), 'value' => $cache ? $t('Yes') : t('No'), 'severity' => $cache ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -202,7 +202,7 @@ function drd_remote_requirements($phase) { ); $clean_url = variable_get('clean_url', 0); - $requirements['drd_remote.enable.cleanurl'] = array( + $requirements['drd_agent.enable.cleanurl'] = array( 'title' => $t('Enable clean URLs'), 'value' => $clean_url ? $t('Yes') : t('No'), 'severity' => $clean_url ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -212,32 +212,32 @@ function drd_remote_requirements($phase) { ); $favicon = theme_get_setting('default_favicon', variable_get('theme_default', 'bartik')); - $requirements['drd_remote.favicon'] = array( + $requirements['drd_agent.favicon'] = array( 'title' => $t('Default favicon used'), 'value' => $favicon ? $t('Yes') : t('No'), 'severity' => $favicon ? REQUIREMENT_WARNING: REQUIREMENT_OK, 'description' => $t('For improved user experience you should set a <a href="@url">custom favicon</a>.', array('@url' => url('admin/appearance/settings')) ), ); $warnings = variable_get('error_level', ERROR_REPORTING_DISPLAY_ALL); - $requirements['drd_remote.hidden.warnings'] = array( + $requirements['drd_agent.hidden.warnings'] = array( 'title' => $t('Error messages to display'), 'description' => $t('For security reasons you should <a href="@url">write all errors and warnings</a> to the log.', array('@url' => url('admin/config/development/logging')) ), ); switch ($warnings) { case ERROR_REPORTING_HIDE: - $requirements['drd_remote.hidden.warnings']['value'] = t('None'); - $requirements['drd_remote.hidden.warnings']['severity'] = REQUIREMENT_OK; + $requirements['drd_agent.hidden.warnings']['value'] = t('None'); + $requirements['drd_agent.hidden.warnings']['severity'] = REQUIREMENT_OK; break; case ERROR_REPORTING_DISPLAY_SOME: - $requirements['drd_remote.hidden.warnings']['value'] = t('Errors and warnings'); - $requirements['drd_remote.hidden.warnings']['severity'] = REQUIREMENT_WARNING; + $requirements['drd_agent.hidden.warnings']['value'] = t('Errors and warnings'); + $requirements['drd_agent.hidden.warnings']['severity'] = REQUIREMENT_WARNING; break; default: - $requirements['drd_remote.hidden.warnings']['value'] = t('All messages'); - $requirements['drd_remote.hidden.warnings']['severity'] = REQUIREMENT_ERROR; + $requirements['drd_agent.hidden.warnings']['value'] = t('All messages'); + $requirements['drd_agent.hidden.warnings']['severity'] = REQUIREMENT_ERROR; } $txtfiles = array(); @@ -256,7 +256,7 @@ function drd_remote_requirements($phase) { if (file_exists(DRUPAL_ROOT . '/' . $file)) $txtfiles[] = $file; } - $requirements['drd_remote.removed.txtfiles'] = array( + $requirements['drd_agent.removed.txtfiles'] = array( 'title' => $t('Info files to be removed'), 'value' => empty($txtfiles) ? $t('All info files properly removed') : implode(', ', $txtfiles), 'severity' => empty($txtfiles) ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -268,7 +268,7 @@ function drd_remote_requirements($phase) { $robotsurl = url('robots.txt', array('absolute' => TRUE, 'language' => (object) array('language' => LANGUAGE_NONE))); $request = drupal_http_request($robotsurl, array('max_redirects' => 0, 'timeout' => 2, )); $robots = isset($request->code) && ($request->code == 200); - $requirements['drd_remote.robots.txt'] = array( + $requirements['drd_agent.robots.txt'] = array( 'title' => $t('File robots.txt is available'), 'value' => $robots ? $t('Yes') : $t('No'), 'severity' => $robots ? REQUIREMENT_OK: REQUIREMENT_WARNING, @@ -278,7 +278,7 @@ function drd_remote_requirements($phase) { ); $themeregistry = variable_get('devel_rebuild_theme_registry', FALSE); - $requirements['drd_remote.theme.registry'] = array( + $requirements['drd_agent.theme.registry'] = array( 'title' => $t('Rebuild theme registry on each page load'), 'value' => $themeregistry ? $t('Yes') : $t('No'), 'severity' => $themeregistry ? REQUIREMENT_WARNING: REQUIREMENT_OK, @@ -288,7 +288,7 @@ function drd_remote_requirements($phase) { ); $watchdog = variable_get('dblog_row_limit', 1000); - $requirements['drd_remote.trim.watchdog'] = array( + $requirements['drd_agent.trim.watchdog'] = array( 'title' => $t('Database log messages to keep'), 'value' => empty($watchdog) ? t('All') : $watchdog, 'severity' => ($watchdog <= 1000 && $watchdog > 0) ? REQUIREMENT_OK: REQUIREMENT_WARNING, diff --git a/drd_remote.module b/drd_agent.module similarity index 67% rename from drd_remote.module rename to drd_agent.module index cf111716e255a32bbcbc80d9386a9c481dd923a8..a60f840d6bb645e1b8a0b90e65c401fe397b409e 100644 --- a/drd_remote.module +++ b/drd_agent.module @@ -6,36 +6,36 @@ * @return array * An array of all defined menu items by this module. */ -function drd_remote_menu() { - $items['drd-remote'] = array( - 'title' => 'DRD Remote Callback', - 'page callback' => 'drd_remote', +function drd_agent_menu() { + $items['drd-agent'] = array( + 'title' => 'DRD Agent Callback', + 'page callback' => 'drd_agent', 'access callback' => TRUE, - 'delivery callback' => 'drd_remote_deliver', + 'delivery callback' => 'drd_agent_deliver', 'type' => MENU_CALLBACK, ); - $items['drd-remote-crypt'] = array( - 'title' => 'DRD Remote Callback', - 'page callback' => 'drd_remote_crypt', + $items['drd-agent-crypt'] = array( + 'title' => 'DRD Agent Callback', + 'page callback' => 'drd_agent_crypt', 'access callback' => TRUE, - 'delivery callback' => 'drd_remote_deliver', + 'delivery callback' => 'drd_agent_deliver', 'type' => MENU_CALLBACK, ); - $items['drd-remote-setup/%'] = array( - 'title' => 'DRD Remote Callback', - 'page callback' => 'drd_remote_setup', + $items['drd-agent-setup/%'] = array( + 'title' => 'DRD Agent Callback', + 'page callback' => 'drd_agent_setup', 'page arguments' => array(1), 'access arguments' => array('administer site configuration'), - 'delivery callback' => 'drd_remote_deliver', - 'file' => 'drd_remote.admin.inc', + 'delivery callback' => 'drd_agent_deliver', + 'file' => 'drd_agent.admin.inc', 'type' => MENU_CALLBACK, ); $items['admin/config/system/drd'] = array( 'title' => 'DRD', 'page callback' => 'drupal_get_form', - 'page arguments' => array('drd_remote_settings'), + 'page arguments' => array('drd_agent_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'drd_remote.admin.inc', + 'file' => 'drd_agent.admin.inc', ); return $items; } @@ -67,9 +67,9 @@ function _drd_get_lib($force = FALSE) { * @return array * @throws \Exception */ -function drd_remote() { +function drd_agent() { require _drd_get_lib(); - return \Drupal\drd\Remote\DrdActionBase::run(7, variable_get('drd_remote_debug_mode', FALSE)); + return \Drupal\drd\Agent\DrdActionBase::run(7, variable_get('drd_agent_debug_mode', FALSE)); } /** @@ -78,7 +78,7 @@ function drd_remote() { * @return array * @throws \Exception */ -function drd_remote_crypt() { +function drd_agent_crypt() { require _drd_get_lib(); return base64_encode(serialize(\Drupal\drd\Crypt\DrdCryptBase::getMethods())); } @@ -88,7 +88,7 @@ function drd_remote_crypt() { * * @param $page_callback_result */ -function drd_remote_deliver($page_callback_result) { +function drd_agent_deliver($page_callback_result) { drupal_add_http_header('Content-Type', 'text/plain; charset=utf-8'); print $page_callback_result; ajax_footer(); diff --git a/drd_remote.info b/drd_remote.info deleted file mode 100644 index 282ae5ddd5d17da3fc8ab2723c4baab1b33f20b8..0000000000000000000000000000000000000000 --- a/drd_remote.info +++ /dev/null @@ -1,6 +0,0 @@ -name = DRD Remote -description = Remote service component for the main DRD module. -package = Administration -core = 7.x - -configure = admin/config/system/drd