Obfuscate my email address.
[project/devel.git] / devel.admin.inc
1 <?php
2
3 function devel_admin_settings() {
4 $form['queries'] = array('#type' => 'fieldset', '#title' => t('Query log'));
5
6 $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.');
7 if (!devel_is_compatible_optimizer()) {
8 $description = t('You must disable or upgrade the php Zend Optimizer extension in order to enable this feature. The minimum required version is 3.2.8. Earlier versions of Zend Optimizer are <a href="!url">horribly buggy and segfault your Apache</a> ... ', array('!url' => url('http://drupal.org/node/126098'))) . $description;
9 }
10 $form['queries']['devel_query_display'] = array('#type' => 'checkbox',
11 '#title' => t('Display query log'),
12 '#default_value' => variable_get('devel_query_display', 0),
13 '#description' => $description,
14 '#disabled' => !devel_is_compatible_optimizer(),
15 );
16 $form['queries']['settings'] = array(
17 '#type' => 'container',
18 '#states' => array(
19 // Hide the query log settings when not displaying query log.
20 'invisible' => array(
21 'input[name="devel_query_display"]' => array('checked' => FALSE),
22 ),
23 ),
24 );
25 $form['queries']['settings']['devel_query_sort'] = array('#type' => 'radios',
26 '#title' => t('Sort query log'),
27 '#default_value' => variable_get('devel_query_sort', DEVEL_QUERY_SORT_BY_SOURCE),
28 '#options' => array(t('by source'), t('by duration')),
29 '#description' => t('The query table can be sorted in the order that the queries were executed or by descending duration.'),
30 );
31 $form['queries']['settings']['devel_execution'] = array('#type' => 'textfield',
32 '#title' => t('Slow query highlighting'),
33 '#default_value' => variable_get('devel_execution', 5),
34 '#size' => 4,
35 '#maxlength' => 4,
36 '#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.'),
37 );
38
39 $form['xhprof'] = array(
40 '#type' => 'fieldset',
41 '#title' => 'XHProf',
42 '#description' => t('XHProf is a php extension which is essential for profiling your Drupal site. It pinpoints slow functions, and also memory hogging functions.'),
43 );
44 $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>';
45 $form['xhprof']['devel_xhprof_enabled'] = array(
46 '#type' => 'checkbox',
47 '#title' => t('Enable profiling of all page views and <a href="!drush">drush</a> requests.', array('!drush' => url('http://drush.ws'))),
48 '#default_value' => variable_get('devel_xhprof_enabled', FALSE),
49 '#description' => $description,
50 '#disabled' => !extension_loaded('xhprof'),
51 );
52 $form['xhprof']['settings'] = array(
53 '#type' => 'container',
54 '#states' => array(
55 'invisible' => array(
56 'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
57 ),
58 ),
59 );
60 $form['xhprof']['settings']['devel_xhprof_directory'] = array(
61 '#type' => 'textfield',
62 '#title' => 'xhprof directory',
63 '#description' => t('Location of the xhprof source code on your system, usually somewhere in /usr/local/share or /usr/share, include the leading forward slash.'),
64 '#default_value' => variable_get('devel_xhprof_directory', ''),
65 '#states' => array(
66 'invisible' => array(
67 'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
68 ),
69 ),
70 );
71 $form['xhprof']['settings']['devel_xhprof_url'] = array(
72 '#type' => 'textfield',
73 '#title' => 'XHProf URL',
74 '#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'),
75 '#default_value' => variable_get('devel_xhprof_url', ''),
76 '#states' => array(
77 'invisible' => array(
78 'input[name="devel_xhprof_enabled"]' => array('checked' => FALSE),
79 ),
80 ),
81 );
82
83 $form['devel_api_url'] = array('#type' => 'textfield',
84 '#title' => t('API Site'),
85 '#default_value' => variable_get('devel_api_url', 'api.drupal.org'),
86 '#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'))));
87 $form['dev_timer'] = array('#type' => 'checkbox',
88 '#title' => t('Display page timer'),
89 '#default_value' => variable_get('dev_timer', 0),
90 '#description' => t('Display page execution time in the query log box.'),
91 );
92
93 $form['dev_mem'] = array('#type' => 'checkbox',
94 '#title' => t('Display memory usage'),
95 '#default_value' => variable_get('dev_mem', 0),
96 '#description' => t('Display how much memory is used to generate the current page. This will show memory usage when devel_init() is called and when devel_exit() is called.'),
97 );
98 $form['devel_redirect_page'] = array('#type' => 'checkbox',
99 '#title' => t('Display redirection page'),
100 '#default_value' => variable_get('devel_redirect_page', 0),
101 '#description' => t('When a module executes drupal_goto(), the query log and other developer information is lost. Enabling this setting presents an intermediate page to developers so that the log can be examined before continuing to the destination page.'),
102 );
103 $form['devel_page_alter'] = array('#type' => 'checkbox',
104 '#title' => t('Display $page array'),
105 '#default_value' => variable_get('devel_page_alter', FALSE),
106 '#description' => t('Display $page array from <a href="http://api.drupal.org/api/function/hook_page_alter/7">hook_page_alter()</a> in the messages area of each page.'),
107 );
108 $form['devel_error_handler'] = array('#type' => 'radios',
109 '#title' => t('Error handler'),
110 '#default_value' => variable_get('devel_error_handler', DEVEL_ERROR_HANDLER_STANDARD),
111 '#options' => array(DEVEL_ERROR_HANDLER_NONE => t('None'), DEVEL_ERROR_HANDLER_STANDARD => t('Standard drupal')),
112 '#description' => t('Choose an error handler for your site. <em>Backtrace</em> prints nice debug information when an error is noticed, and you <a href="@choose">choose to show errors on screen</a>. <strong>Backtrace requires the <a href="@krumo">krumo library</a></strong>. <em>None</em> is a good option when stepping through the site in your debugger.', array('@krumo' => url('http://krumo.sourceforge.net'), '@choose' => url('admin/config/development/logging'))),
113 );
114 if (has_krumo()) {
115 $form['devel_error_handler']['#options'][DEVEL_ERROR_HANDLER_BACKTRACE] = t('Backtrace');
116 }
117
118 $options = drupal_map_assoc(array('default', 'blue', 'green', 'orange', 'white', 'disabled'));
119 $form['devel_krumo_skin'] = array(
120 '#type' => 'radios',
121 '#title' => t('Krumo display'),
122 '#description' => t('Select a skin for your debug messages or select <em>disabled</em> to display object and array output in standard PHP format.'),
123 '#options' => $options,
124 '#default_value' => variable_get('devel_krumo_skin', 'default'),
125 );
126
127 $form['devel_rebuild_theme_registry'] = array(
128 '#type' => 'checkbox',
129 '#title' => t('Rebuild the theme registry on every page load'),
130 '#description' => t('While creating new templates and theme_ overrides the theme registry needs to be rebuilt.'),
131 '#default_value' => variable_get('devel_rebuild_theme_registry', FALSE),
132 );
133
134 $form['devel_use_uncompressed_jquery'] = array(
135 '#type' => 'checkbox',
136 '#title' => t('Use uncompressed jQuery'),
137 '#default_value' => variable_get('devel_use_uncompressed_jquery', FALSE),
138 '#description' => t("Use a human-readable version of jQuery instead of the minified version that ships with Drupal, to make JavaScript debugging easier."),
139 );
140
141 return system_settings_form($form);
142 }