Commit 2dfb3202 authored by Pierre-Yves Gosset's avatar Pierre-Yves Gosset
Browse files

modules update: views_bulk_operations, charts, devel, disable_messages,...

modules update: views_bulk_operations, charts, devel, disable_messages, form_builder, honaypot, libraries, pgbar, rules, views, webform, webform_validation, wysiwyg, bootstrap
parent cf7717be
......@@ -8,9 +8,8 @@ configure = admin/config/content/charts
files[] = views/charts_plugin_style_chart.inc
files[] = views/charts_plugin_display_chart.inc
; Information added by Drupal.org packaging script on 2018-03-08
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2018-08-15
version = "7.x-2.1"
core = "7.x"
project = "charts"
datestamp = "1520494693"
datestamp = "1534294687"
......@@ -360,10 +360,17 @@ function charts_charts_type_info() {
* Default colors used in all libraries.
*/
function charts_default_colors() {
return array(
'#2f7ed8', '#0d233a', '#8bbc21','#910000', '#1aadce',
'#492970', '#f28f43', '#77a1e5', '#c42525', '#a6c96a',
);
$form = variable_get('charts_default_settings');
if (isset($form['colors'])) {
return $form['colors'];
}
else {
return array(
'#2f7ed8', '#0d233a', '#8bbc21','#910000', '#1aadce',
'#492970', '#f28f43', '#77a1e5', '#c42525', '#a6c96a',
);
}
}
/**
......
......@@ -4,9 +4,8 @@ package = Charts
core = 7.x
dependencies[] = charts
; Information added by Drupal.org packaging script on 2018-03-08
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2018-08-15
version = "7.x-2.1"
core = "7.x"
project = "charts"
datestamp = "1520494693"
datestamp = "1534294687"
......@@ -5,9 +5,8 @@ core = 7.x
dependencies[] = libraries
dependencies[] = charts
; Information added by Drupal.org packaging script on 2018-03-08
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2018-08-15
version = "7.x-2.1"
core = "7.x"
project = "charts"
datestamp = "1520494693"
datestamp = "1534294687"
......@@ -29,6 +29,9 @@ function charts_highcharts_library() {
'js' => array(
array('data' => $highcharts_info['library path'] . '/js/highcharts.js', 'type' => 'file'),
),
'css' => array(
array('data' => $highcharts_info['library path'] . '/css/highcharts.css', 'type' => 'file'),
),
);
}
$library['charts_highcharts'] = array(
......
......@@ -167,7 +167,7 @@ class charts_plugin_style_chart extends views_plugin_style {
'#title_position' => $this->options['title_position'],
'#tooltips' => $this->options['tooltips'],
'#data_labels' => $this->options['data_labels'],
'#colors' => $this->options['colors'],
'#colors' => ($this->options['type'] != 'geomap') ? $this->options['colors'] : FALSE,
'#background' => $this->options['background'] ? $this->options['background'] : 'transparent',
'#legend' => $this->options['legend_position'] ? TRUE : FALSE,
'#legend_position' => $this->options['legend_position'] ? $this->options['legend_position'] : NULL,
......
File mode changed from 100755 to 100644
/**
* @file
* Right-to-left styles for Devel.
*/
.dev-query, .dev-timer, .dev-memory-usage {
align: left;
direction: ltr;
......@@ -5,4 +10,4 @@
}
.dev-query, .dev-timer, .dev-memory-usage table {
direction: ltr;
}
\ No newline at end of file
}
<?php
/**
* @file
* Functions for Devel administrative pages.
*/
/**
* Form constructor for the settings form.
*
* @ingroup forms
*/
function devel_admin_settings() {
_devel_display_block_help_message();
$form['queries'] = array('#type' => 'fieldset', '#title' => t('Query log'));
$description = t('Display a log of the database queries needed to generate the current page, and the execution time for each. Also, queries which are repeated during a single page view are summed in the # column, and printed in red since they are candidates for caching.');
......@@ -22,6 +34,12 @@ function devel_admin_settings() {
),
),
);
$form['queries']['settings']['devel_show_query_args_first'] = array(
'#type' => 'checkbox',
'#title' => t('Show query arguments'),
'#default_value' => variable_get('devel_show_query_args_first', FALSE),
'#description' => t('Show arguments rather than the query placeholders in the logged query.'),
);
$form['queries']['settings']['devel_query_sort'] = array('#type' => 'radios',
'#title' => t('Sort query log'),
'#default_value' => variable_get('devel_query_sort', DEVEL_QUERY_SORT_BY_SOURCE),
......@@ -36,57 +54,13 @@ function devel_admin_settings() {
'#description' => t('Enter an integer in milliseconds. Any query which takes longer than this many milliseconds will be highlighted in the query log. This indicates a possibly inefficient query, or a candidate for caching.'),
);
$form['xhprof'] = array(
'#type' => 'fieldset',
'#title' => 'XHProf',
'#description' => t('XHProf is a php extension which is essential for profiling your Drupal site. It pinpoints slow functions, and also memory hogging functions.'),
);
$description = extension_loaded('xhprof') ? t('Profile requests with the xhprof php extension.') : '<span class="warning">' . t('You must enable the <a href="!url">xhprof php extension</a> to use this feature.', array('!url' => url('http://techportal.ibuildings.com/2009/12/01/profiling-with-xhprof/'))) . '</span>';
$form['xhprof']['devel_xhprof_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable profiling of all page views and <a href="!drush">drush</a> requests.', array('!drush' => url('http://drush.ws'))),
'#default_value' => variable_get('devel_xhprof_enabled', FALSE),
'#description' => $description,
'#disabled' => !extension_loaded('xhprof'),
);
$form['xhprof']['settings'] = array(
'#type' => 'container',
'#states' => array(
'invisible' => array(
'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
),
),
);
$form['xhprof']['settings']['devel_xhprof_directory'] = array(
'#type' => 'textfield',
'#title' => 'xhprof directory',
'#description' => t('Location of the xhprof source code on your system, where the directory "xhprof_lib" can be found, usually somewhere in /usr/local/share or /usr/share, include the leading forward slash.'),
'#default_value' => variable_get('devel_xhprof_directory', ''),
'#states' => array(
'invisible' => array(
'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
),
),
);
$form['xhprof']['settings']['devel_xhprof_url'] = array(
'#type' => 'textfield',
'#title' => 'XHProf URL',
'#description' => t('Path to the publically accessible xhprof_html - required to display profiler reports. You will need to set this up outside Drupal, for example at http://xhprof.localhost/xhprof_html'),
'#default_value' => variable_get('devel_xhprof_url', ''),
'#states' => array(
'invisible' => array(
'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
),
),
);
$form['devel_api_url'] = array('#type' => 'textfield',
'#title' => t('API Site'),
'#default_value' => variable_get('devel_api_url', 'api.drupal.org'),
'#description' => t('The base URL for your developer documentation links. You might change this if you run <a href="!url">api.module</a> locally.', array('!url' => url('http://drupal.org/project/api'))));
$form['dev_timer'] = array('#type' => 'checkbox',
$form['devel_timer'] = array('#type' => 'checkbox',
'#title' => t('Display page timer'),
'#default_value' => variable_get('dev_timer', 0),
'#default_value' => variable_get('devel_timer', 0),
'#description' => t('Display page execution time in the query log box.'),
);
......@@ -161,6 +135,45 @@ function devel_admin_settings() {
return system_settings_form($form);
}
/**
* Displays a helpful message if Menu module is not installed.
*/
function _devel_display_block_help_message() {
if (!module_exists('menu')) {
$devel_block_alert = t('Devel block alert: The Devel block requires the Core Menu module. The Devel block will become available once you <a href="!url">enable Menu</a>.',
array('!url' => url('admin/modules'))
);
$variables = array(
'!admin_menu_url' => url('https://drupal.org/project/admin_menu', array('external' => TRUE)),
'!admin_menu_name' => 'Administration Menu',
'!admin_menu_config_url' => url('admin/config/administration/admin_menu'),
'!icon_menu' => t('Icon menu'),
);
if (!module_exists('admin_menu')) {
$devel_block_alert .= '<br />' . t('Alternatively, you can install <a href="!admin_menu_url">!admin_menu_name</a> which supports displaying the Devel menu items in its !icon_menu.', $variables);
}
else {
$admin_menu_components = variable_get('admin_menu_components', array());
if (empty($admin_menu_components['admin_menu.icon']) || !user_access('access administration menu')) {
$devel_block_alert .= '<br />' . t("Alternatively, if you <a href='!admin_menu_config_url'>enable !admin_menu_name's !icon_menu</a> you will find the Devel menu items there.", $variables);
} else {
// Don't bother with a message in the 'normal' case.
return;
}
}
drupal_set_message($devel_block_alert, 'warning');
}
}
/**
* Demonstrates the active error handler.
*
* Generates some warnings or errors so that the reaction of the current error
* handler can be observed.
*
* @param $severity
* The severity level that the error handler should demonstrate.
*/
function devel_demonstrate_error_handlers($severity) {
switch ($severity) {
case 'warning':
......
/**
* @file
* Styles for elements created by Devel.
*/
.dev-query, .dev-timer, .dev-memory-usage {
padding: 1em;
}
......
......@@ -64,7 +64,9 @@ function devel_drush_command() {
}
/**
* A command callback. This is faster than 3 separate bootstraps.
* A command callback for reinstalling one or more projects.
*
* This is faster than 3 separate bootstraps.
*/
function drush_devel_reinstall() {
$projects = func_get_args();
......@@ -80,7 +82,7 @@ function drush_devel_reinstall() {
}
/**
* A command callback.
* A command callback for downloading a project.
*/
function drush_devel_download($path = NULL) {
// If no path is provided by the user, set our default path.
......@@ -112,7 +114,7 @@ function drush_devel_download($path = NULL) {
}
/**
* Command handler. Show hook implementations.
* A command handler for showing hook implementations.
*/
function drush_devel_fn_hook($hook) {
// Get implementations in the .install files as well.
......@@ -130,7 +132,7 @@ function drush_devel_fn_hook($hook) {
}
/**
* Command handler. Show source code of specified function or method.
* A command handler for showing source code of a function or method.
*/
function drush_devel_fn_view($function_name) {
// Get implementations in the .install files as well.
......@@ -159,7 +161,7 @@ function drush_devel_fn_view($function_name) {
}
/**
* Command callback. List available tokens.
* A command callback for listing available tokens.
*/
function drush_devel_token() {
$rows[] = array(dt('Group'), dt('Token'), dt('Name'));
......@@ -174,8 +176,7 @@ function drush_devel_token() {
/**
* Print the specified function, including any
* doxygen-style comments that come before it.
* Prints a function including any Doxygen-style comments preceding it.
*/
function _drush_devel_print_function($file, $start_line, $end_line) {
$line_num = 0;
......
......@@ -7,9 +7,8 @@ tags[] = developer
files[] = devel.test
files[] = devel.mail.inc
; Information added by Drupal.org packaging script on 2014-05-01
version = "7.x-1.5"
; Information added by Drupal.org packaging script on 2018-04-18
version = "7.x-1.6"
core = "7.x"
project = "devel"
datestamp = "1398963366"
datestamp = "1524009787"
......@@ -32,7 +32,7 @@ function devel_enable() {
*/
function devel_uninstall() {
variable_del('devel_execution');
variable_del('dev_timer');
variable_del('devel_timer');
variable_del('devel_query_display');
variable_del('devel_redirect_page');
variable_del('devel_api_url');
......@@ -47,9 +47,6 @@ function devel_uninstall() {
variable_del('devel_query_sort');
variable_del('devel_rebuild_theme_registry');
variable_del('devel_use_uncompressed_jquery');
variable_del('devel_xhprof_directory');
variable_del('devel_xhprof_enabled');
variable_del('devel_xhprof_url');
variable_del('devel_debug_mail_file_format');
variable_del('devel_debug_mail_directory');
......@@ -62,7 +59,9 @@ function devel_uninstall() {
}
/**
* Remove feature for storing queries. Cleanup deprecated tables and variables.
* Remove feature for storing queries.
*
* Cleanup deprecated tables and variables.
*/
function devel_update_7000() {
db_drop_table('devel_queries');
......@@ -81,7 +80,7 @@ function devel_update_7001() {
}
/**
* Remove deprecated variables - dev_query, devel_code_coverage
* Remove deprecated variables: dev_query, devel_code_coverage.
*/
function devel_update_7002() {
variable_del('dev_query'); // Sad trombone. http://drupalcode.org/viewvc/drupal/drupal/includes/database.mysql.inc?revision=1.2&view=markup
......@@ -117,7 +116,9 @@ function devel_update_7004() {
}
/**
* Delete variable 'devel_form_weights' from database as it was removed from code.
* Delete variable 'devel_form_weights'.
*
* 'devel_form_weights' was removed from code.
*/
function devel_update_7005() {
variable_del('devel_form_weights');
......@@ -133,3 +134,23 @@ function devel_update_7006() {
variable_del('dev_mem');
}
/**
* Delete 'devel_xhprof_*' variables as they were removed from code.
*/
function devel_update_7007() {
variable_del('devel_xhprof_directory');
variable_del('devel_xhprof_enabled');
variable_del('devel_xhprof_url');
}
/**
* Change variable "dev_timer" to "devel_timer".
*/
function devel_update_7008() {
if (variable_get('dev_timer') !== NULL) {
variable_set('devel_timer', variable_get('dev_timer'));
}
variable_del('dev_timer');
}
/**
* @file
* Behaviors for Devel.
*/
(function ($) {
// Explain link in query log
/**
* Explain link in query log.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.devel_explain = {
attach: function(context, settings) {
$('a.dev-explain').click(function () {
......@@ -14,7 +23,11 @@ Drupal.behaviors.devel_explain = {
}
}
// Arguments link in query log
/**
* Arguments link in query log.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.devel_arguments = {
attach: function(context, settings) {
$('a.dev-arguments').click(function () {
......@@ -28,7 +41,11 @@ Drupal.behaviors.devel_arguments = {
}
}
// Placeholders link in query log
/**
* Placeholders link in query log.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.devel_placeholders = {
attach: function(context, settings) {
$('a.dev-placeholders').click(function () {
......
<?php
/**
* @file
* MailSystemInterface for logging mails to the filesystem.
......@@ -16,8 +17,20 @@
*
*/
/**
* Logs mail messages to the filesystem.
*/
class DevelMailLog extends DefaultMailSystem {
/**
* Converts a message array to a string.
*
* @param $message
* The message array containing the body and headers.
*
* @return
* The message as it will be printed in the file.
*/
public function composeMessage($message) {
$mimeheaders = array();
$message['headers']['To'] = $message['to'];
......@@ -35,6 +48,15 @@ class DevelMailLog extends DefaultMailSystem {
return $output;
}
/**
* Gets a filename for a message using tokens.
*
* @param $message
* The message that will supply values for token replacement.
*
* @return
* The full path and filename after token replacement.
*/
public function getFileName($message) {
$output_directory = $this->getOutputDirectory();
$this->makeOutputDirectory($output_directory);
......@@ -48,19 +70,26 @@ class DevelMailLog extends DefaultMailSystem {
return $output_directory . '/' . $this->dirify(str_replace(array_keys($tokens), array_values($tokens), $output_file_format));
}
/**
* Convert a string to a valid directory name.
*
* @return
* The sanitized string, replacing any characters not whitelisted with "_".
*/
private function dirify($string) {
return preg_replace('/[^a-zA-Z0-9_\-\.@]/', '_', $string);
}
/**
* Save an e-mail message to a file, using Drupal variables and default settings.
*
* @see http://php.net/manual/en/function.mail.php
* @see drupal_mail()
* Save a mail message to a file using Drupal variables and default settings.
*
* @param $message
* A message array, as described in hook_mail_alter().
* @return
* TRUE if the mail was successfully accepted, otherwise FALSE.
*
* @see http://php.net/manual/en/function.mail.php
* @see drupal_mail()
*/
public function mail(array $message) {
$output = $this->composeMessage($message);
......@@ -69,14 +98,25 @@ class DevelMailLog extends DefaultMailSystem {
return file_put_contents($output_file, $output);
}
/**
* Creates the directory to contain the message file if necessary.
*
* @throws Exception
* Exception thrown when unable to create the destination directory.
*/
protected function makeOutputDirectory($output_directory) {
if (!file_prepare_directory($output_directory, FILE_CREATE_DIRECTORY)) {
throw new Exception("Unable to continue sending mail, $output_directory is not writable");
}
}
/**
* Retrieves the directory that contains message files.
*
* @return
* The path to mail messages, possibly using a file URI scheme.
*/
public function getOutputDirectory() {
return variable_get('devel_debug_mail_directory', 'temporary://devel-mails');
}
}
?>
This diff is collapsed.
<?php
// Menu callback that shows menu item.
/**
* @file
* Page callbacks for Devel.
*/
/**
* Page callback: Shows a menu item.
*/
function devel_menu_item() {
$item = menu_get_item($_GET['path']);
return kdevel_print_object($item);
}
/**
* Returns a list of all currently defined user functions in the current
* request lifecycle, with links their documentation.
* Page callback: Returns a list of all currently defined user functions.
*
* Returns a list of all currently defined user functions in the current request
* lifecycle, with links their documentation.
*/
function devel_function_reference() {
$functions = get_defined_functions();
......@@ -23,7 +32,7 @@ function devel_function_reference() {
}
/**
* Menu callback; clears all caches, then redirects to the previous page.
* Page callback: Clears all caches, then redirects to the previous page.
*/
function devel_cache_clear() {
drupal_flush_all_caches();
......@@ -33,7 +42,9 @@ function devel_cache_clear() {
drupal_goto();
}
// A menu callback. Called by the AJAX link in query log.
/**
* Page callback: Called by the AJAX link in query log.
*/
function devel_querylog_explain($request_id, $qid) {
if (!is_numeric($request_id)) {
return MENU_ACCESS_DENIED;
......@@ -41,25 +52,39 @@ function devel_querylog_explain($request_id, $qid) {
$path = "temporary://devel_querylog/$request_id.txt";
$path = file_stream_wrapper_uri_normalize($path);
$queries = json_decode(file_get_contents($path));
$query = $queries[$qid];
$result = db_query('EXPLAIN ' . $query->query, (array)$query->args)->fetchAllAssoc('table');
$i = 1;
foreach ($result as $row) {
$row = (array)$row;
if ($i == 1) {
$header = array_keys($row);
$output = t('No explain log found.');
if (file_exists($path)) {
$queries = json_decode(file_get_contents($path));
if ($queries !== FALSE && isset($queries[$qid])) {
$header = $rows = array();
$query = $queries[$qid];
$result = db_query('EXPLAIN ' . $query->query, (array)$query->args)->fetchAllAssoc('table');
$i = 1;
foreach ($result as $row) {
$row = (array)$row;
if ($i == 1) {
$header = array_keys($row);
}
$rows[] = array_values($row);
$i++;
}