Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cg 461 bk #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
339 changes: 339 additions & 0 deletions sites/all/modules/contrib/devel/LICENSE.txt

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions sites/all/modules/contrib/devel/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
README.txt
==========

A module containing helper functions for Drupal developers and
inquisitive admins. This module can print a log of
all database queries for each page request at the bottom of each page. The
summary includes how many times each query was executed on a page, and how long
each query took.

It also offers
- a block for running custom PHP on a page
- a block for quickly accessing devel pages
- a block for masquerading as other users (useful for testing)
- reports memory usage at bottom of page
- A mail-system class which redirects outbound email to files
- more

This module is safe to use on a production site. Just be sure to only grant
'access development information' permission to developers.

Also a dpr() function is provided, which pretty prints arrays and strings.
Useful during development. Many other nice functions like dpm(), dvm().

AJAX developers in particular ought to install FirePHP Core from
http://www.firephp.org/ and put it in the devel directory. You may
use the devel-download drush command to download the library. If downloading by hand,
your path to fb.php should look like devel/FirePHPCore/lib/FirePHPCore/fb.php.
You can use svn checkout http://firephp.googlecode.com/svn/trunk/trunk/Libraries/FirePHPCore.
Then you can log php variables to the Firebug console. Is quite useful.

Included in this package is also:

- devel_node_access module which prints out the node_access records for a given node. Also offers hook_node_access_explain for all node access modules to implement. Handy.
- devel_generate.module which bulk creates nodes, users, comment, terms for development.

Some nifty drush integration ships with devel and devel_generate. See drush help for details.

DEVEL GENERATE EXTENSIONS
=========================
Devel Images Provider [http://drupal.org/project/devel_image_provider] allows to configure external providers for images.

COMPATIBILITY NOTES
==================
- Modules that use AHAH may have incompatibility with the query log and other
footer info. Consider setting $GLOBALS['devel_shutdown'] = FALSE if you run into
any issues.

DRUSH UNIT TEST
==================
See develDrushTest.php for an example of unit testing of the Drush integration.
This uses Drush's own test framework, based on PHPUnit. To run the tests, use
phpunit --bootstrap=/path/to/drush/tests/drush_testcase.inc. Note that we must name a file
under /tests there.

AUTHOR/MAINTAINER
======================
-moshe weitzman <weitzman at tejasa DOT com>
http://cyrve.com
Hans Salvisberg <drupal at salvisberg DOT com>
42 changes: 42 additions & 0 deletions sites/all/modules/contrib/devel/README_devel_node_access.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
README
======

This module contains tools for developers using access control modules
to restrict access to some nodes. It is intended to help catch some
common mistakes and provide feedback to confirm that restricted nodes
are in fact visible only to the intended users.

Provides a summary page which queries the node_access table and
reports common mistakes such as the presence of Drupal's default entry
which grants all users read access to all nodes. Also reports the
presence of nodes not represented in node_access table. This may
occur when an access control module is installed after nodes have
already been created.

Provides a block which shows all node_access entries for the nodes
shown on a given page. This gives developers a quick check to see
that grants are provided as they should be. This block auto-enables
to the footer region. You may move it as desired.

If Views module is installed, allows browsing of nodes by realm,
including those nodes not in the node_access table (NULL realm).

WISHLIST
========

Things I'd like to see but haven't had time to do:

* Automatically solve common problems. I.e. delete the "all" realm
entry, and automatically save all nodes not in the node_access table.

* Nicer feedback indicating whether nodes are visible to the public or
not. I.e. use color coding or icons.

* Summary does not differentiate between view grants and other types
of grants. I personally use node_access only for view grants so I'm
not sure exactly what else it should show.

AUTHOR
======

Dave Cohen AKA yogadex on drupal.org
8 changes: 8 additions & 0 deletions sites/all/modules/contrib/devel/devel-rtl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.dev-query, .dev-timer, .dev-memory-usage {
align: left;
direction: ltr;
padding-top: inherit;
}
.dev-query, .dev-timer, .dev-memory-usage table {
direction: ltr;
}
176 changes: 176 additions & 0 deletions sites/all/modules/contrib/devel/devel.admin.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?php

function devel_admin_settings() {
$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.');
if (!devel_is_compatible_optimizer()) {
$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;
}
$form['queries']['devel_query_display'] = array('#type' => 'checkbox',
'#title' => t('Display query log'),
'#default_value' => variable_get('devel_query_display', 0),
'#description' => $description,
'#disabled' => !devel_is_compatible_optimizer(),
);
$form['queries']['settings'] = array(
'#type' => 'container',
'#states' => array(
// Hide the query log settings when not displaying query log.
'invisible' => array(
'input[name="devel_query_display"]' => array('checked' => FALSE),
),
),
);
$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),
'#options' => array(t('by source'), t('by duration')),
'#description' => t('The query table can be sorted in the order that the queries were executed or by descending duration.'),
);
$form['queries']['settings']['devel_execution'] = array('#type' => 'textfield',
'#title' => t('Slow query highlighting'),
'#default_value' => variable_get('devel_execution', 5),
'#size' => 4,
'#maxlength' => 4,
'#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',
'#title' => t('Display page timer'),
'#default_value' => variable_get('dev_timer', 0),
'#description' => t('Display page execution time in the query log box.'),
);

$form['devel_memory'] = array('#type' => 'checkbox',
'#title' => t('Display memory usage'),
'#default_value' => variable_get('devel_memory', 0),
'#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.'),
);
$form['devel_redirect_page'] = array('#type' => 'checkbox',
'#title' => t('Display redirection page'),
'#default_value' => variable_get('devel_redirect_page', 0),
'#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.'),
);
$form['devel_page_alter'] = array('#type' => 'checkbox',
'#title' => t('Display $page array'),
'#default_value' => variable_get('devel_page_alter', FALSE),
'#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.'),
);
$form['devel_raw_names'] = array('#type' => 'checkbox',
'#title' => t('Display machine names of permissions and modules'),
'#default_value' => variable_get('devel_raw_names', FALSE),
'#description' => t('Display the language-independent machine names of the permissions in mouse-over hints on the !Permissions page and the module base file names on the @Permissions and !Modules pages.', array('!Permissions' => l(t('Permissions'), 'admin/people/permissions'), '@Permissions' => t('Permissions'), '!Modules' => l(t('Modules'), 'admin/modules'))),
);

$error_handlers = devel_get_handlers();
$form['devel_error_handlers'] = array(
'#type' => 'select',
'#title' => t('Error handlers'),
'#options' => array(
DEVEL_ERROR_HANDLER_NONE => t('None'),
DEVEL_ERROR_HANDLER_STANDARD => t('Standard Drupal'),
DEVEL_ERROR_HANDLER_BACKTRACE_DPM => t('Krumo backtrace in the message area'),
DEVEL_ERROR_HANDLER_BACKTRACE_KRUMO => t('Krumo backtrace above the rendered page'),
),
'#multiple' => TRUE,
'#default_value' => empty($error_handlers) ? DEVEL_ERROR_HANDLER_NONE : $error_handlers,
'#description' => t('Select the error handler(s) to use, in case you <a href="@choose">choose to show errors on screen</a>.', array('@choose' => url('admin/config/development/logging'))) . '<ul>' .
'<li>' . t('<em>None</em> is a good option when stepping through the site in your debugger.') . '</li>' .
'<li>' . t('<em>Standard Drupal</em> does not display all the information that is often needed to resolve an issue.') . '</li>' .
'<li>' . t('<em>Krumo backtrace</em> displays nice debug information when any type of error is noticed, but only to users with the %perm permission.', array('%perm' => t('Access developer information'))) . '</li></ul>' .
t('Depending on the situation, the theme, the size of the call stack and the arguments, etc., some handlers may not display their messages, or display them on the subsequent page. Select <em>Standard Drupal</em> <strong>and</strong> <em>Krumo backtrace above the rendered page</em> to maximize your chances of not missing any messages.') . '<br />' .
t('Demonstrate the current error handler(s):') . ' ' . l('notice+warning', $_GET['q'], array('query' => array('demo' => 'warning'))) . ', ' . l('notice+warning+error', $_GET['q'], array('query' => array('demo' => 'error'))) . ' ' . t('(The presentation of the @error is determined by PHP.)', array('@error' => 'error')),
);
$form['devel_error_handlers']['#size'] = count($form['devel_error_handlers']['#options']);
if (empty($_POST) && !empty($_GET['demo'])) {
devel_demonstrate_error_handlers($_GET['demo']);
}

$options = drupal_map_assoc(array('default', 'blue', 'green', 'orange', 'white', 'disabled'));
$form['devel_krumo_skin'] = array(
'#type' => 'radios',
'#title' => t('Krumo display'),
'#description' => t('Select a skin for your debug messages or select <em>disabled</em> to display object and array output in standard PHP format.'),
'#options' => $options,
'#default_value' => variable_get('devel_krumo_skin', 'default'),
);

$form['devel_rebuild_theme_registry'] = array(
'#type' => 'checkbox',
'#title' => t('Rebuild the theme registry on every page load'),
'#description' => t('While creating new templates and theme_ overrides the theme registry needs to be rebuilt.'),
'#default_value' => variable_get('devel_rebuild_theme_registry', FALSE),
);

$form['devel_use_uncompressed_jquery'] = array(
'#type' => 'checkbox',
'#title' => t('Use uncompressed jQuery'),
'#default_value' => variable_get('devel_use_uncompressed_jquery', FALSE),
'#description' => t("Use a human-readable version of jQuery instead of the minified version that ships with Drupal, to make JavaScript debugging easier."),
);

return system_settings_form($form);
}

function devel_demonstrate_error_handlers($severity) {
switch ($severity) {
case 'warning':
$undefined = $undefined;
1/0;
break;
case 'error':
$undefined = $undefined;
1/0;
devel_undefined_function();
break;
}
}
Loading