The menu item "admin/reports/search" as provided by search.module should be provided by the dblog module. Visiting this page when dblog is not installed results in an error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ff1’s picture

Status: Active » Fixed

I just tried this and the 'Top search phrases' page works both with and without the dblog module.

If this is still a problem for you, please provide more details of the error message.

Ian

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sdrycroft’s picture

Version: 6.10 » 6.13
Status: Closed (fixed) » Active

Sorry Ian, RTFC...

  $items['admin/reports/search'] = array(
    'title' => 'Top search phrases',
    'description' => 'View most popular search phrases.',
    'page callback' => 'dblog_top',
    'page arguments' => array('search'),
    'access arguments' => array('access site reports'),
    'file' => 'dblog.admin.inc',
    'file path' => drupal_get_path('module', 'dblog'),
  );
jhodgdon’s picture

Agreed, this looks like a real bug.

jhodgdon’s picture

This menu item should really only exist if *both* the search module and the dblog module are turned on, by the way.

jhodgdon’s picture

Version: 6.13 » 7.x-dev

This is the same in Drupal 7 and should likely be fixed there first, then backported to D6.

jhodgdon’s picture

Status: Active » Needs review
FileSize
1.38 KB

OK, here's a simple patch, which works fine. When running search_menu(), it only adds the Top Search Phrases report to the menu item list if dblog.module is enabled.

The other way to do this would be to put the menu item into dblog_menu() and change it to module_exists('search'). Which will have exactly the same effect, so I don't have strong feelings one way or another.

jhodgdon’s picture

I also confirmed that without this patch, if dblog.module has been uninstalled (not just disabled), if you go to admin/reports/search you get a big orange error box saying:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupaldev.watchdog' doesn't exist: SELECT COUNT(DISTINCT(message)) AS expression FROM {watchdog} watchdog WHERE (type = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => search ) in PagerDefault->execute() (line 86 of /opt/www/eclipsework/drupal7/includes/pager.inc).

So I think the patch is needed for Drupal 7.

Anonymous’s picture

Patch works for me, when dblog is disabled or uninstalled.

jhodgdon’s picture

#7: 421838.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 421838.patch, failed testing.

jhodgdon’s picture

Looks like this patch needs rerolling

mradcliffe’s picture

Status: Needs work » Needs review
FileSize
1.39 KB

re-rolled. there was just a 2 line offset. I'm not sure why it failed to patch that?

jhodgdon’s picture

Anyone want to review this? I wrote the patch, so I can't. chrisdolby in #9 confirmed that it works, but the patch still needs a review. :)

mradcliffe’s picture

I did test it visually myself, and it works.

I only remember doing these hook_menu conditionals in Drupal 5 or 6 in contrib. I thought maybe menu_enable was the only thing to call menu_rebuild on module_enable, but it looks like it's happening anyway.

jhodgdon’s picture

FileSize
1.37 KB

The patch in #13 has a tab/space indentation issue that was not in the original patch.

Here's another reroll.

jhodgdon’s picture

#16: 421838-fixtabs.patch queued for re-testing.

quex’s picture

#13: 421838-2.patch queued for re-testing.

jbrown’s picture

Status: Needs review » Reviewed & tested by the community
Dries’s picture

Maybe we should move the menu handler to the dblog module instead of adding a module_exists()? Not 100% sure why we have it in search.module.

jhodgdon’s picture

It's a report of the most recent (or is it popular?) search terms. It doesn't work correctly unless both the search and dblog are turned on.

I think it makes most sense to leave it in search.module, but only turn it on if dblog is turned on.

jbrown’s picture

Component: search.module » dblog.module
Status: Reviewed & tested by the community » Needs review
FileSize
1.75 KB

dblog_top('search') lists the watchdog entries that are of type 'search'.

Technically, you could uninstall the search module and this would still list the search entries that occurred when the search module was active. But this would be confusing I think.

This menu item shouldn't appear unless both search and dblog are enabled.

It makes sense for it to be in dblog as that module has the function to be called and we can leave off the 'file path' setting.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Patch works, approach is fine with me.

colan’s picture

Subscribing.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

Maybe we should port this to Drupal 6?

joachim’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.41 KB

Here's a patch on D6.

jhodgdon’s picture

When you upload patches, please read the info about extensions on the Attachments field (don't put d6 in the extension).

This patch looks right but someone should test it in D6 and make sure:
- the problem exists without the patch (see #8)
- the problem is fixed with the patch
- the report still works if both search and dblog are enabled

TravisCarden’s picture

Status: Needs review » Reviewed & tested by the community
  1. The problem does indeed exist without the patch.
  2. The problem is fixed with the patch.
  3. The report still works with the patch if both search and dblog are enabled.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: 421838.drupal.search-report.d6.patch, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.