Jump to content

[solved] Orphaned blocks in RockPageBuilderBlocks tree


iank
 Share

Recommended Posts

Hey @bernhard, me again!

When developing a new block, I was adding it to a page repeatedly, but not saving the page.  Instead I would cancel editing and ignore the 'changes not saved' popup, to add more features to the block and try it again. 

I then realised that this was creating pages under the RockPageBuilderBlocks tree that seemed to be orphaned, containing just my default settings.  Of course I can delete these pages, but do you think there might be a way to identify any such orphaned blocks and remove them automatically?

Thx,

Ian.

 

Screenshot 2023-11-17 120803.png

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thx for the kick in my *** ? This has been on my list for quite some time ? I've just pushed v4.7.4 to github and it's ready for you to download on my website ? 

Blocks will now be deleted whenever a page with a rockpagebuilder field is saved.

Let me know if everything works as expected!

  • Like 2
Link to comment
Share on other sites

  • iank changed the title to [Solved] Orphaned blocks in RockPageBuilderBlocks tree
  • 3 months later...

Sorry to UNSOLVE this... but for me it doesn't work at all.

When adding a new block in the frontend and the modal is closed immediately an orphaned block exists.
No saving in the backend resolves this.

Am I missing something?

PW 3.0.229 RPB 5.2.0

Link to comment
Share on other sites

  • 4 weeks later...

Hi @bernhard,

Just revisiting this.  I hadn't noticed, but @Klenkes is correct - the orphaned block deletion is broken again in newer versions of RockPageBuilder.  It did work up to at least v5.0.3 but it looks like an extra check was later added in getUnusedBlockIds():

      // never delete blocks younger than 10s
      'created>' => time() + 10,

Which I believe is saying "find unused blocks that also have a created time newer than 10 seconds in the future".  Hence it's not going to find any.

Changing to this: 

      // never delete blocks younger than 10s
      'created<' => time() - 10,

Appears to resolve the problem, and I think is doing what the comment says?

Thx,

Ian.

  • Like 1
Link to comment
Share on other sites

  • iank changed the title to Orphaned blocks in RockPageBuilderBlocks tree

Hey @iank thx a lot for your message and sorry @Klenkes for the delay. I have been working on a solution for this but I totally misunderstood what you were saying ? I thought you are talking about temporary blocks, not orphaned blocks! But at least I've made progress with the other problem as well ? 

I'll look into that tomorrow, thx!

Link to comment
Share on other sites

  • iank changed the title to [solved] Orphaned blocks in RockPageBuilderBlocks tree

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...