Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

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

hefox’s picture

Status: Needs work » Needs review
FileSize
604 bytes

Guess I could end the line with ;

marcingy’s picture

Category: feature » task
Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community

Looks good.

webchick’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +Performance, +Needs backport to D6, +Needs backport to D7

Makes sense to me.

Committed and pushed to 8.x. Moving to 7.x for backport and adding some tags.

hefox’s picture

Version: 8.x-dev » 7.x-dev
FileSize
584 bytes

:)

hefox’s picture

Status: Patch (to be ported) » Needs review
tstoeckler’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Needs work

Sorry to re-open this, but it seems since nothing is done with the return value of the function call, a simple module_invoke_all('watchdog', $log_entry) would be enough. module_invoke_all() does the additional function_exists() as well, but at least it would be in-line with code elsewhere. We should then discuss whether to remove that function_exists() from module_invoke_all() in a follow-up issue. That would be a performance improvement across core. Also, someone should probably dig where and why this code was introduced, i.e. if this was intentional for some reason.

Edit: Fix arguments in example code.

hefox’s picture

That was my first thought. My reasoning to do this instead:

1) Module_invoke_all uses call_user_func_array, which is significantly slower than $function()
2) Don't need any of the extra logic about return value/array_merge that module_invoke_all adds so might as well not do any extra.

#329012: Remove call_user_func_array() from ModuleHandler::invoke() + invokeAll() is issue to optimize module_invoke_all and does include the removal of function_exists (when that lands, reason 2 above is still the case).

(note: Can look to see how other's are using module_implements solo style by looking at http://api.drupal.org/api/drupal/core!includes!module.inc/function/calls... -- it is true most that are using it alone want to use the return value and add module implementing specific information)

hefox’s picture

Status: Needs work » Needs review
FileSize
686 bytes

I did some benchmarking like stuff a few weeks ago and concluded the savings isn't really worth it, so patch to change it to module_invoke_all (untested) attached

I did not touch

  if (!$in_error_state && function_exists('module_implements')) {

it looks like module_implements has moved to the same file as watchdog, so is there any reason for this function_exists?

ParisLiakos’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes

No logger applies to D8, hook_watchdog is gone

mgifford’s picture

reroll.

Sivaji_Ganesh_Jojodae’s picture

FileSize
648 bytes
$ git apply -v drupal-watchdog-1861604-11.patch
Checking patch includes/bootstrap.inc...
Hunk #1 succeeded at 1732 (offset 1 line).
Applied patch includes/bootstrap.inc cleanly.

Patch #11 still applies but with offset so I have re-rolled the same.

  • webchick committed e200408 on 8.3.x
    Issue #1861604 by hefox: Skip module_invoke()/module_hook() in calling...
  • webchick committed fcfd874 on 8.3.x
    Issue #1861604 follow-up: Now with a semi-colon. :P
    

  • webchick committed e200408 on 8.3.x
    Issue #1861604 by hefox: Skip module_invoke()/module_hook() in calling...
  • webchick committed fcfd874 on 8.3.x
    Issue #1861604 follow-up: Now with a semi-colon. :P
    

  • webchick committed e200408 on 8.4.x
    Issue #1861604 by hefox: Skip module_invoke()/module_hook() in calling...
  • webchick committed fcfd874 on 8.4.x
    Issue #1861604 follow-up: Now with a semi-colon. :P
    

  • webchick committed e200408 on 8.4.x
    Issue #1861604 by hefox: Skip module_invoke()/module_hook() in calling...
  • webchick committed fcfd874 on 8.4.x
    Issue #1861604 follow-up: Now with a semi-colon. :P
    
dagmar’s picture

Component: watchdog.module » dblog.module

Moved to dblog.module for future triage.

joseph.olstad’s picture

Done in D8. So green light for D7

Patch #12 still applies but with offset so I have re-rolled the same.

***EDIT*** David Rothsteins patch below is the preferred.

David_Rothstein’s picture

Shouldn't we change the function_exists() call earlier in watchdog() to check the function that we're now actually calling? See attached.

Otherwise, this looks fine to me and is a nice code cleanup, although I assume any performance benefit here is very very minor.

Pol’s picture

Status: Needs review » Reviewed & tested by the community

Tested locally, working super fine.

joseph.olstad’s picture

yes David Rothstein to the rescue again
put it in, creds to David!

Slam dunk this.

joseph.olstad’s picture

Issue tags: -Drupal 7.60 target +Drupal 7.61 target

Bumping to 7.61. This didn't make it into 7.60

joseph.olstad’s picture

joseph.olstad’s picture

  • Pol committed 902980e on 7.x
    Issue #1861604 by hefox, joseph.olstad, Sivaji, mgifford, webchick: Skip...
Pol’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Drupal 7.64 target, -Pending Drupal 7 commit +Drupal 7.67 target

Patch has been committed, thanks !

Status: Fixed » Closed (fixed)

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