Ticket #7265 (closed enhancement: fixed)

Opened 5 months ago

Last modified 4 months ago

Plugin update notification should generate bubble like comment notification bubble

Reported by: mdawaffe Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: General Version: 2.6
Severity: normal Keywords: has-patch
Cc:

Description

Attached fires the plugin update notification script more frequently and adds a little bubble on the plugins menu item when there are plugins ready to be updated.

Tested in FF3 and Safari only.

Attachments

7265.diff (3.9 kB) - added by mdawaffe on 07/09/08 02:16:42.
7265.2.diff (3.9 kB) - added by mdawaffe on 07/10/08 07:31:00.
on every page load
7265.version1.diff (481 bytes) - added by DD32 on 07/11/08 13:09:14.
7265.3.diff (5.9 kB) - added by DD32 on 07/11/08 13:23:45.
7265.4.diff (1.1 kB) - added by DD32 on 07/11/08 13:31:19.
7265.5.diff (6.2 kB) - added by mdawaffe on 07/11/08 21:44:41.
7265.5.2.diff (6.2 kB) - added by mdawaffe on 07/11/08 21:45:20.

Change History

07/09/08 02:16:42 changed by mdawaffe

  • attachment 7265.diff added.

07/10/08 07:31:00 changed by mdawaffe

  • attachment 7265.2.diff added.

on every page load

07/10/08 07:31:10 changed by mdawaffe

  • keywords set to has-patch.

07/10/08 07:35:20 changed by matt

  • status changed from new to closed.
  • resolution set to fixed.

(In [8305]) Check for plugin updates more frequently, notify with double bubble trouble. Hat tip: mdawaffe. Fixes #7265.

07/11/08 13:07:52 changed by DD32

  • status changed from closed to reopened.
  • resolution deleted.

The action 'init' is fired before any administration includes are included, As such, The plugin update check is not run on any pages within the admin area.

One work around is to hook the check onto both init and admin_init, as admin_init runs after the admin includes have been included.

The other is to include admin includes before init is run.

See the 2 patches for the possible ways

07/11/08 13:09:14 changed by DD32

  • attachment 7265.version1.diff added.

07/11/08 13:13:24 changed by DD32

Er, Actually..

Theres no point hooking the plugin check to init at all, The code is not loaded for the WordPress front end, Switching it to hook admin_init only is the better solution. (7265.admin_init.diff)

07/11/08 13:21:27 changed by DD32

Or theres the 4th option of actually moving the plugin check into the front-end loaded code.. Which my patch does, My reasoning is the same as for the Core update checker, So that plugins may notify the blog owner of an update.

07/11/08 13:23:45 changed by DD32

  • attachment 7265.3.diff added.

07/11/08 13:26:11 changed by DD32

Also included a grammer correction to the PHPDoc..

strpos($_SERVER['PHP_SELF'], 'install.php') !== false

Removed to allow admin pages with 'install.php' in them to be able to trigger update checks as well (eg. 'plugin-install.php' which is similar to #6990 - WP_INSTALLING is defined anyway.

07/11/08 13:30:55 changed by DD32

Eugh, Its late, Didnt notice function dependancies on get_plugins().

Honestly, I dont see the need for either of the update checks to be be run on non-admin hooks..

Final patch.. Someone else can decide on which route to take :)

07/11/08 13:31:19 changed by DD32

  • attachment 7265.4.diff added.

07/11/08 19:57:22 changed by mdawaffe

  • milestone changed from 2.7 to 2.6.

I think both core and plugin checks should run blog-side; I agree with DD32's original rationale: a plugin (or future core) could send emails or something when there are updates.

So I'd go +1 on .3.

And a +1000 to DD32 for catching the bug :)

07/11/08 21:44:41 changed by mdawaffe

  • attachment 7265.5.diff added.

07/11/08 21:45:20 changed by mdawaffe

  • attachment 7265.5.2.diff added.

07/11/08 21:47:25 changed by mdawaffe

Messed up the attachment name, but 7265.5.2.diff:

Same as DD32's .3, but checks to see if is_admin and calls the appropriate hook. If blog-side, includes wp-admin/include/plugin.php (only if it hasn't checked in the last 12 hours) and goes from there.

Changing back to admin_init hook is definitely easier, but I think it cripples the feature a bit.

07/11/08 22:04:04 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8317]) Run plugin checks both admin and blog side. Props DD32 and mdawaffe. fixes #7265

07/12/08 01:33:07 changed by DD32

Thanks for fixing up the code mdawaffe :)