Removing packages and cache problems

Permalink
Howdy all,

I've run into a bit of a problem with removing packages. Here's the scenario:

- I'm almost finished developing another block to release to the marketplace, so I've been testing it in 5.4.x and 5.5.x
- I've got 5.4.2, 5.4.2.1, 5.4.2.2, 5.5.0 and 5.5.1 set up as test environments locally with caching enabled (default settings)
- I installed my package (dropping the package folder into /packages), added a few blocks from it to pages and then went into the dashboard to remove it.
- Going back to the home page, I get a fatal error in all versions
- In 5.4.x I'm still able to get to the dashboard, where clearing the cache fixes the problem
- In 5.5.x, if I'd added a block to a global area, ALL pages are borked (so the dashboard as well) and I can't access anything. I have to go to /files/cache and delete all files

I thought it might be my dodgey package, but I've been able to replicate it with other packages.

The error I get is:
Fatal error: Block::getInstance() [<a href='block.getinstance'>block.getinstance</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "LoginBlockController" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /Users/ryan/Sites/concrete5_5_1/site/concrete/models/block.php on line 329

(I tested with the Login block from the concrete5 guys)

- If I install the package and not place any blocks anywhere and un-install it, no problems occur.

Has anyone else encountered a problem like this?
I'm trying to work out if it is my setup, as this seems to be a pretty big bug otherwise.

I guess the other thing I'm surprised at is that the removal of a package doesn't trigger the clearing of the cache as part of the removal process.

mesuva
 
Mnkras replied on at Permalink Reply
Mnkras
Known bug :)

Mike
mesuva replied on at Permalink Reply
mesuva
Thanks Mike - that really surprises me that it wasn't addressed in 5.5.

I've not done any work on the core, but I would have thought this could have been solved by doing a Cache::flush() at the end of the uninstall function in the dashboard. It must be more complex than that!
andrew replied on at Permalink Reply
andrew
Hmm. This is a bug that we should fix without cache::Flush() being necessary. The uninstall routine should remove the block types, which should clear the block-related cache entries.
fastcrash replied on at Permalink Reply
fastcrash
so when you turn on cache(default), and add some block, you cannot remove it?

best regards,
mesuva replied on at Permalink Reply
mesuva
Yes, with caching on, if you remove a package after adding some blocks to some pages, things will error until you clear the cache.
jb1 replied on at Permalink Reply
jb1
I had the same problem, and found a workaround, so this might help someone else.

It seems to be related to the cache feature. By simply running the upgrade script, it will clear the cache. Here's instructions on how to run the upgrade script:
http://www.concrete5.org/documentation/installation/upgrading_concr...

Go tohttp://www.yoursite.com/index.php/tools/required/upgrade... (Note: if this does not work, tryhttp://www.yoursite.com/index.php/tools/required/upgrade.php)...

Hope this helps someone.

JB
andrew replied on at Permalink Reply
andrew
I have fixed this in the github master by making the BlockType::delete() method actually remove all instances of a block when it removes content.