Hi everybody,

Im kind of new to drupal and I just downloaded the devel-5.x-1.x-dev.tar.gz.

How come this is buggy?

e.g. lots of dispensable commas at the end of arrays

...
function devel_menu($may_cache) {
...
...
    $items[] = array('path' => 'devel/reference',
      'title' => t('function reference'),
      'callback' => 'devel_function_reference',
      'access' => user_access('access devel information'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array('path' => 'devel/reinstall',
      'title' => t('Reinstall modules'),
      'callback' => 'devel_reinstall',
      'access' => user_access('access devel information'),
      'type' => MENU_CALLBACK,
    );
...
...

Since Im new to Drupal (not to programming;), please let me know
in case, this is the wrong forum to place this.

Does anybody know where to download a stable devel-module verion?

thanks in advance

Markus Berges

Comments

vm’s picture

I don't know that what you've found is a bug, however you can file a bug report using thelinks on the projects module page. You can also create a patch for the module if necessary.

-dev is the only release at this point and its stil being actively developed.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

weirdblue’s picture

since all the menu types were set to MENU_CALLBACK it didnt show up in my menu.
In the followin I replaced it by MENU_LOCAL_TASK and added a further item to it.

If someone experience the same problems, he/she may want to replace the

/**
 * Implementation of hook_menu().
 */
function devel_menu($may_cache)

method by the followin :

/**
 * Implementation of hook_menu().
 */
function devel_menu($may_cache) {
  $items = array();

  if ($may_cache) {
		$items[] = array(
						'path'					=> 'devel',					   		   // the settings path
						'title'					=> t('devel modul access'),						  //  the menu title
						'description'			=> t('Accessing the devel modul.'),
						'callback'				=> 'system_admin_menu_block_page',			   // => call the method 'durpal_get_form'
						'callback arguments'	=> array('devel_admin_settings'),		   //     pass it the ID 'annotate_admin_settings'
						'access'				=> user_access('administer site configuration')
						);
    $items[] = array('path' => 'devel/cache/clear',
      'title' => t('Empty cache'),
      'callback' => 'devel_cache_clear',
      'access' => user_access('access devel information'),
      'type' =>  MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/rebuild_node_comment_statistics',
      'title' => t('Rebuild node_comment_statistics table'),
      'callback' => 'devel_rebuild_node_comment_statistics_page',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/queries',
      'title' => t('Database queries'),
      'callback' => 'devel_queries',
      'access' => user_access('access devel information'));
    $items[] = array('path' => 'devel/queries/empty',
      'title' => t('Empty database queries'),
      'callback' => 'devel_queries_empty',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM);
    $items[] = array('path' => 'devel/reference',
      'title' => t('function reference'),
      'callback' => 'devel_function_reference',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/reinstall',
      'title' => t('Reinstall modules'),
      'callback' => 'devel_reinstall',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    if (module_exists('menu')) {
      $items[] = array('path' => 'devel/menu/reset',
        'title' => t('Reset menus'),
        'callback' => 'drupal_get_form',
        'callback arguments' => 'devel_menu_reset_form',
        'access' => user_access('access devel information'),
        'type' => MENU_NORMAL_ITEM
      );
    }
    $items[] = array('path' => 'devel/variable',
      'title' => t('Variable editor'),
      'callback' => 'devel_variable_page',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/variable/edit',
      'title' => t('Variable editor'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('devel_variable_edit'),
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/variable/delete',
      'title' => t('Variable editor'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('devel_variable_delete'),
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/session',
      'title' => t('Session viewer'),
      'callback' => 'devel_session',
      'access' => user_access('access devel information'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array('path' => 'devel/switch',
      'title' => t('Switch user'),
      'callback' => 'devel_switch_user',
      'access' => user_access('switch users'),
      'type' => MENU_NORMAL_ITEM
    );
    $items[] = array(
      'path' => 'admin/settings/devel',
      'title' => t('Devel'),
      'description' => t('In here one should see some devel-tools, if not buggy :('),
      'callback' => 'drupal_get_form',
      'callback arguments' => array('devel_admin_settings'),
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM
    );
  }
  else {
    if (is_numeric(arg(1))) {
      if (arg(0) == 'node') {
        $items[] = array('path' => 'node/'. arg(1) .'/load',
          'title' => t('Dev load'),
          'callback' => 'devel_load_object',
          'callback arguments' => array('node', arg(1)),
          'access' => user_access('access devel information'),
          'type' => MENU_LOCAL_TASK
        );
        $items[] = array('path' => 'node/'. arg(1) .'/render',
          'title' => t('Dev render'),
          'callback' => 'devel_render_object',
          'callback arguments' => array('node', arg(1)),
          'access' => user_access('access devel information'),
          'type' => MENU_LOCAL_TASK
        );
      }
      elseif (arg(0) == 'user') {
        $items[] = array('path' => 'user/'. arg(1) .'/load',
          'title' => t('Devel load'),
          'callback' => 'devel_load_object',
          'callback arguments' => array('user', arg(1)),
          'access' => user_access('access devel information'),
          'type' => MENU_LOCAL_TASK
        );
      }
    }

    /*
     * TODO: this is very naive. We don't preserve views arguments like other tabs.
     * I tried, but it I started borrowing too much Views menu code. I think
     * we need some refactoring in Views!
     * I concluded that the result and 'render' operations yield no useful info
     * so no tabs exist for those.
    */
    if (module_exists('views_ui')) {
      $urls = views_get_all_urls();
      foreach ($urls as $view_name => $url) {
        $items[] = array('path' => "$url/load",
              'title' => t('Dev load'),
              'callback' => 'devel_load_object',
              'callback arguments' => array('view', $view_name),
              'access' => user_access('administer views'),
              'type' => MENU_LOCAL_TASK,
              'weight' => 8
        );
        $items[] = array('path' => "$url/queries",
              'title' => t('Dev queries'),
              'callback' => 'devel_views_object',
              'callback arguments' => array('queries', $view_name),
              'access' => user_access('administer views'),
              'type' => MENU_LOCAL_TASK,
              'weight' => 9
        );
        $items[] = array('path' => "$url/items",
              'title' => t('Dev items'),
              'callback' => 'devel_views_object',
              'callback arguments' => array('items', $view_name),
              'access' => user_access('administer views'),
              'type' => MENU_LOCAL_TASK,
              'weight' => 10
        );
      }
    }

    drupal_add_css(drupal_get_path('module', 'devel') .'/devel.css');
    drupal_add_js(drupal_get_path('module', 'devel') .'/devel.js');
  }

  return $items;
}

... and to replace the dispensable commas in the other methods where
they use to show up after the last items within arrays
array(
$item,
...,
$item, // <= shouldnt be there
);

gpk’s picture

Yeah I think the module is kinda aimed at the sort of people who like to open up the .module file and parse it visually :-P then type the desired URL in

Actually though if you enable the relevant blocks that the module provides then I think you get access to most of the functionality you are after.

gpk
----
www.alexoria.co.uk

kranklin’s picture

I believe the "dispensable" commas are standard coding for Drupal. I wouldn't call them bugs considering they don't cause any problems with drupal.

Refer to http://drupal.org/coding-standards and scroll down to Arrays

Note the comma at the end of the last array element--this is not a typo! It helps prevent parsing errors if another element is placed at the end of the list later.