WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#2387 closed defect (bug) (fixed)

Caching makes activate/deactivate plugin hooks unusable

Reported by: westi Owned by: markjaquith
Milestone: Priority: high
Severity: normal Version: 2.0
Component: Administration Keywords: bg|has-patch bg|commit
Focuses: Cc:

Description

I've just spent an hour of so trying to work out why my activate/deactivate hooks were not working.

I turned out they were only updating the in-memory cache and so never making it to the db.

Patch attached for this instance but we need to review all exit's to check whether we should flush to disk or not.

Attachments (1)

2387.diff (312 bytes) - added by westi 8 years ago.
Simple patch to ensure data is saved

Download all attachments as: .zip

Change History (14)

westi8 years ago

Simple patch to ensure data is saved

comment:1 davidhouse8 years ago

Oh, for PHP5 and destructors :)

comment:2 markjaquith8 years ago

  • Keywords bg|commit added
  • Owner changed from westi to markjaquith
  • Status changed from new to assigned

comment:3 westi8 years ago

  • Milestone changed from 2.1 to 2.0.3

Can this be a candidate for 2.0.3 as it makes activate/deactivate hooks dumb without this fix.

It will still need fixing for 2.1 as well.

comment:4 markjaquith8 years ago

object cache is turned off by default for 2.0.3, but it still would be nice to get this fixed.

comment:5 ryan8 years ago

The shutdown hook is run on exit. Wonder why the close isn't being called by the hook.

comment:6 westi8 years ago

Can we be sure that the shutdown func is always called on exit for all supported php types?

Afterall calling exit itself within a shutdown func will stop all the others from running.

comment:7 skeltoac8 years ago

What code was triggered by this hook when you found the problem?

comment:8 skeltoac8 years ago

What code was triggered by this hook when you found the problem?

comment:9 westi8 years ago

I was using the activate and deactivate hooks to add/remove a cap on the administrator like so:

	function activate()
	{
		global $wp_roles;
		$wp_roles->add_cap('administrator','manage_cache');
	}

	function deactivate()
	{
		global $wp_roles;
		$wp_roles->remove_cap('administrator','manage_cache');
	}

comment:10 terado8 years ago

I don't know how the versioning process takes place. However, for 2.0.3 as mentioned here the cache was disabled by default, this is quite a big change actually and affected a lot of things my end. This was not mentioned in changelog:
http://codex.wordpress.org/Changelog/2.0.3

Just a request really that changes, not just fixes, be put through to the changelog as they do affect things. Thanks

comment:11 mdawaffe8 years ago

terado:

svn co http://svn.automattic.com/wordpress/branches/2.0
svn log -r 3825:3637

comment:12 ryan8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:13 anonymous7 years ago

  • Milestone 2.0.3 deleted

Milestone 2.0.3 deleted

Note: See TracTickets for help on using tickets.