Start, stop: zopectl [start|stop|restart]
Backup: Copy Data.fs :)
Restore: stop; copy back data.fs; start
Add an external method:
copy your python script under Extension directory
add "def MyMethod(): " in the beginning of the file and indent everything
go to ZMI and "add external method"
test :)
--------------------------
#Search and replace (String)
import string
p_slot_name = "main"
p_from_str = "STR1"
p_to_str = "STR2"
l_items = context.portal_catalog(SearchableText=p_from_str, portal_type='Webpage')
#print l_items
#return printed
print "Replacing %s with %s - for slot %s" % (p_from_str, p_to_str, p_slot_name)
for l_item in l_items:
l_obj = l_item.getObject()
l_type = l_obj.mfs_getSlotType( p_slot_name )
if (l_type == 'TEXTBODY') or (l_type == 'HTMLBODY'):
l_text = l_obj.mfs_getSlotValue( p_slot_name )
if l_text != None:
print l_obj.getId()
l_text = string.replace( l_text, p_from_str, p_to_str )
l_obj.mf_setSlot( slotName=p_slot_name,
slotText=l_text,
slotType=l_type,
slotFile='')
l_obj.reindexObject()
return printed
-----------------------------
#Search and Replace (REGEXP) --> as an external method
def MyReplace(self):
context = self
import re
import string
p_slot_name = "main"
p_from_str = "/custom_oki/OrderDocument/"
p_to_str = "www2test.okisemi.com"
l_items = context.portal_catalog(SearchableText=p_from_str,
portal_type='Webpage')
#print l_items
#return printed
print "Replacing %s with %s - for slot %s" % (p_from_str, p_to_str,
p_slot_name)
for l_item in l_items:
l_obj = l_item.getObject()
l_type = l_obj.mfs_getSlotType( p_slot_name )
if (l_type == 'TEXTBODY') or (l_type == 'HTMLBODY'):
l_text = l_obj.mfs_getSlotValue( p_slot_name )
if l_text != None:
print l_obj.getId()
# l_text = string.replace( l_text, p_from_str, p_to_str )
l_text = re.sub("\.pdf?.*?\"", ".pdf\"", l_text)
l_obj.mf_setSlot( slotName=p_slot_name,
slotText=l_text,
slotType=l_type,
slotFile='')
l_obj.reindexObject()
#return printed
------------------------