File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<metadata >
3- <version >1019 </version >
3+ <version >1020 </version >
44 <dependencies >
55 <dependency >profile-plone.restapi:blocks</dependency >
66 </dependencies >
Original file line number Diff line number Diff line change @@ -190,3 +190,16 @@ def update_robots_txt(context):
190190 logger .info (
191191 "Ignoring plone.robots_txt registry as it was modified in this portal."
192192 )
193+
194+
195+ def reindex_block_types (context ):
196+ catalog = getToolByName (context , "portal_catalog" )
197+ brains = catalog (object_provides = "plone.restapi.behaviors.IBlocks" )
198+ total = len (brains )
199+ for index , brain in enumerate (brains ):
200+ obj = brain .getObject ()
201+ obj .reindexObject (idxs = ["block_types" ], update_metadata = 0 )
202+ logger .info ("Reindexing object %s." , brain .getPath ())
203+ if index % 250 == 0 :
204+ logger .info (f"Reindexed { index } /{ total } objects" )
205+ transaction .commit ()
Original file line number Diff line number Diff line change 9696 handler =" .upgrades.update_robots_txt"
9797 />
9898 </genericsetup : upgradeSteps >
99+ <genericsetup : upgradeSteps
100+ profile =" plone.volto:default"
101+ source =" 1019"
102+ destination =" 1020"
103+ >
104+ <genericsetup : upgradeStep
105+ title =" Update robots_txt setting for Volto"
106+ handler =" .upgrades.reindex_block_types"
107+ />
108+ </genericsetup : upgradeSteps >
99109</configure >
You can’t perform that action at this time.
0 commit comments