Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/381152 )
Change subject: Delete redundant logging module ...................................................................... Delete redundant logging module DEPLOYMENT NOTE: drush dis wmf_logging Looks like a copy of the built-in drupal syslog module. Did we copy this over when we were running on a super early version? Bug: T121799 Change-Id: I3421a9c57de719a051ef7f99f2acf921c18b8e29 --- D sites/all/modules/wmf_logging/wmf_logging.info D sites/all/modules/wmf_logging/wmf_logging.module M sites/default/enabled_modules 3 files changed, 0 insertions(+), 171 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/52/381152/1 diff --git a/sites/all/modules/wmf_logging/wmf_logging.info b/sites/all/modules/wmf_logging/wmf_logging.info deleted file mode 100644 index d48a5ae..0000000 --- a/sites/all/modules/wmf_logging/wmf_logging.info +++ /dev/null @@ -1,5 +0,0 @@ -name = WMF Logging -description = WMF specific log framework. Hooks into Watchdog. -core = 7.x -package = Wikimedia -configure = admin/config/logging/wmf_logging diff --git a/sites/all/modules/wmf_logging/wmf_logging.module b/sites/all/modules/wmf_logging/wmf_logging.module deleted file mode 100644 index 0280a56..0000000 --- a/sites/all/modules/wmf_logging/wmf_logging.module +++ /dev/null @@ -1,165 +0,0 @@ -<?php - -if (defined('LOG_LOCAL0')) { - define( 'DEFAULT_WMF_LOGGING_FACILITY', LOG_LOCAL0 ); -} -else { - define( 'DEFAULT_WMF_LOGGING_FACILITY', LOG_USER ); -} - -define( 'DEFAULT_WMF_LOGGING_PID', FALSE ); -define( 'DEFAULT_WMF_LOGGING_PERSISTENT', TRUE ); -define( 'DEFAULT_WMF_LOGGING_IDENTITY', 'drupal' ); - -/** - * Drupal hook function setting up the configuration page. - * - * @return array Menu entries - */ -function wmf_logging_menu() { - $items = array(); - - $items[ 'admin/config/logging' ] = array( - 'title' => 'Logging', - 'page callback' => 'system_admin_menu_block_page', - 'file' => 'system.admin.inc', - 'file path' => drupal_get_path('module', 'system'), - 'access arguments' => array( 'administer site configuration' ), - ); - - $items[ 'admin/config/logging/wmf_logging' ] = array( - 'title' => 'WMF Logging', - 'description' => 'Settings for the WMF logging module.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array( 'wmf_logging_settings' ), - 'access arguments' => array( 'administer site configuration' ), - ); - - return $items; -} - -/** - * Settings form linked to from @see wmf_logging_menu - * - * @return array Settings form - */ -function wmf_logging_settings() { - $form = array(); - - $form[ 'wmf_logging_syslog_identity' ] = array( - '#type' => 'textfield', - '#title' => t('Syslog identity'), - '#default_value' => variable_get('wmf_logging_syslog_identity', DEFAULT_WMF_LOGGING_IDENTITY), - '#description' => t('String that will be prepended to the Syslog output'), - ); - - $form[ 'wmf_logging_syslog_facility' ] = array( - '#type' => 'select', - '#title' => t('Send events to this syslog facility'), - '#default_value' => variable_get('wmf_logging_syslog_facility', DEFAULT_WMF_LOGGING_FACILITY), - '#options' => wmf_logging_syslog_facility_list(), - '#description' => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER.'), - ); - - $form[ 'wmf_logging_syslog_pid' ] = array( - '#type' => 'checkbox', - '#title' => t('Add process ID to log message string'), - '#default_value' => variable_get('wmf_logging_syslog_pid', DEFAULT_WMF_LOGGING_PID), - '#description' => t('The process identifier can be used to differentiate different requests.'), - ); - - $form[ 'wmf_logging_syslog_persistent' ] = array( - '#type' => 'checkbox', - '#title' => t('Use persistent Syslog connection'), - '#default_value' => variable_get('wmf_logging_syslog_persistent', DEFAULT_WMF_LOGGING_PERSISTENT), - '#description' => t('Some webserver configurations may require the Syslog connection to be closed after a log message is written to avoid logging webserver errors as Drupal errors. <a href="http://www.php.net/manual/en/function.syslog.php#97843">Details.</a>'), - ); - - return system_settings_form($form); -} - -/** - * Provides the list of available Syslog facilities - * - * @return array of facilities - */ -function wmf_logging_syslog_facility_list() { - $facility_list = array( - LOG_USER => t('LOG_USER - User level messages. Use this for Windows.'), - ); - if (defined('LOG_LOCAL0')) { - $facility_list += array( - LOG_LOCAL0 => t('LOG_LOCAL0 - Local 0'), - LOG_LOCAL1 => t('LOG_LOCAL1 - Local 1'), - LOG_LOCAL2 => t('LOG_LOCAL2 - Local 2'), - LOG_LOCAL3 => t('LOG_LOCAL3 - Local 3'), - LOG_LOCAL4 => t('LOG_LOCAL4 - Local 4'), - LOG_LOCAL5 => t('LOG_LOCAL5 - Local 5'), - LOG_LOCAL6 => t('LOG_LOCAL6 - Local 6'), - LOG_LOCAL7 => t('LOG_LOCAL7 - Local 7'), - ); - } - return $facility_list; -} - -/** - * Hook into the drupal watchdog dispatcher. Implements the custom log handler. - * - * @param $entry - */ -function wmf_logging_watchdog($entry) { - global $base_url; - - static $log_init = FALSE; - - if (!$log_init) { - $log_init = TRUE; - - $options = LOG_NDELAY; - if (variable_get('wmf_logging_syslog_pid', DEFAULT_WMF_LOGGING_PID)) { - $options |= LOG_PID; - } - - openlog( - variable_get('syslog_identity', DEFAULT_WMF_LOGGING_IDENTITY), - $options, - variable_get('syslog_facility', DEFAULT_WMF_LOGGING_FACILITY) - ); - } - - syslog($entry[ 'severity' ], wmf_logging_format_message($entry)); - - if (!variable_get('wmf_logging_syslog_persistent', DEFAULT_WMF_LOGGING_PERSISTENT)) { - closelog(); - $log_init = FALSE; - } -} - -/** - * Format a system log entry. - */ -function wmf_logging_format_message($entry) { - - $uid = -1; - if ( isset( $entry[ 'user' ] ) ) { - $uid = $entry[ 'user' ]->uid; - } - $message = $entry[ 'type' ]; - $message .= '|' . $entry[ 'timestamp' ]; - $message .= '|' . $entry[ 'ip' ]; - $message .= '|' . $entry[ 'request_uri' ]; - $message .= '|' . $entry[ 'referer' ]; - $message .= '|' . $uid; - $message .= '|' . $entry[ 'link' ]; - - if (empty($entry[ 'variables' ])) { - $message .= '|' . $entry[ 'message' ]; - } elseif (is_array($entry[ 'variables' ])) { - $message .= '|' . strtr($entry[ 'message' ], $entry[ 'variables' ]); - } else { - // This really shouldn't ever happen. But it does... - $message .= "|BAD WATCHDOG CALL; " . $entry[ 'message' ] . " : " . $entry[ 'variables' ]; - } - - return $message; -} diff --git a/sites/default/enabled_modules b/sites/default/enabled_modules index ed5b14f..2dabe8f 100644 --- a/sites/default/enabled_modules +++ b/sites/default/enabled_modules @@ -30,7 +30,6 @@ wmf_common wmf_communication wmf_fredge_qc -wmf_logging wmf_refund_qc wmf_reports wmf_unsubscribe_qc -- To view, visit https://gerrit.wikimedia.org/r/381152 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3421a9c57de719a051ef7f99f2acf921c18b8e29 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits