Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.core
Commits
5f40bb72
Commit
5f40bb72
authored
Dec 10, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speedup deletion.
From many hours to less then 10 minutes.
parent
817104a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
100 deletions
+47
-100
master/bt5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
...5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
+35
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/03_ERP5Site_deleteVifibAccounting.xml
...ins/slapos_upgrader/03_ERP5Site_deleteVifibAccounting.xml
+9
-97
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/04_ERP5Site_reindexWithClear.xml
...al_skins/slapos_upgrader/04_ERP5Site_reindexWithClear.xml
+2
-2
master/bt5/slapos_upgrader/bt/revision
master/bt5/slapos_upgrader/bt/revision
+1
-1
No files found.
master/bt5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
View file @
5f40bb72
...
...
@@ -77,3 +77,38 @@ def Base_updateSlapOSLocalRoles(self):
real
(
o
[
0
])
else
:
real
(
self
)
def
delIt
(
container
,
oid
):
ob
=
container
.
_getOb
(
oid
)
container
.
_objects
=
tuple
([
i
for
i
in
container
.
_objects
if
i
[
'id'
]
!=
oid
])
container
.
_delOb
(
oid
)
try
:
ob
.
_v__object_deleted__
=
1
except
Exception
:
pass
from
Products.ERP5.ERP5Site
import
addERP5Tool
def
ERP5Site_deleteVifibAccounting
(
self
):
portal
=
self
.
getPortalObject
()
delIt
(
portal
,
'portal_simulation'
)
addERP5Tool
(
portal
,
'portal_simulation'
,
'Simulation Tool'
)
module_id_list
=
(
'accounting_module'
,
'internal_packing_list_module'
,
'open_sale_order_module'
,
'purchase_packing_list_module'
,
'sale_order_module'
,
'sale_packing_list_module'
,
'sale_trade_condition_module'
)
for
module_id
in
module_id_list
:
module
=
getattr
(
portal
,
module_id
)
portal_type
=
module
.
getPortalType
()
title
=
module
.
getTitle
()
id_generator
=
module
.
getIdGenerator
()
delIt
(
portal
,
module_id
)
portal
.
newContent
(
portal_type
=
portal_type
,
title
=
title
,
id
=
module_id
,
id_generator
=
id_generator
)
bt5_id_list
=
[
'slapos_accounting'
,
'slapos_payzen'
]
for
bt5_id
in
bt5_id_list
:
bt5
=
[
q
for
q
in
portal
.
portal_templates
.
contentValues
()
if
q
.
getTitle
()
==
bt5_id
and
q
.
getInstallationState
()
==
'installed'
][
0
].
Base_createCloneDocument
(
batch_mode
=
1
)
bt5
.
activate
().
install
(
force
=
1
,
update_catalog
=
0
)
return
'Done.'
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/03_ERP5Site_deleteVifibAccounting.xml
View file @
5f40bb72
...
...
@@ -2,114 +2,26 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod
"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<
int>
3
</int
>
</value>
<key>
<string>
_function
</string>
</key>
<value>
<
string>
ERP5Site_deleteVifibAccounting
</string
>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
b = DateTime().timeTime()\n
BLACKLIST_RELATIVE_URL_LIST = (\n
\'accounting_module/template_sale_invoice_transaction\',\n
\'open_sale_order_module/slapos_accounting_open_sale_order_line_template\',\n
\'open_sale_order_module/slapos_accounting_open_sale_order_template\',\n
\'sale_packing_list_module/slapos_accounting_instance_delivery_line_template\',\n
\'sale_packing_list_module/slapos_accounting_instance_delivery_template\',\n
\'sale_trade_condition_module/payzen_sale_trade_condition\',\n
\'sale_trade_condition_module/slapos_aggregated_trade_condition\',\n
\'sale_trade_condition_module/slapos_consumption_trade_condition\',\n
\'sale_trade_condition_module/slapos_subscription_trade_condition\',\n
)\n
portal = context.getPortalObject()\n
module_list = (\n
portal.accounting_module,\n
portal.internal_packing_list_module,\n
portal.open_sale_order_module,\n
portal.portal_simulation,\n
portal.purchase_packing_list_module,\n
portal.sale_order_module,\n
portal.sale_packing_list_module,\n
portal.sale_trade_condition_module,\n
)\n
tag = script.id\n
if bg:\n
if portal.portal_activities.countMessageWithTag(tag) >
0:\n
raise TypeError(\'Already running\')\n
for module in module_list:\n
getattr(module.activate(tag=tag), \'03_ERP5Site_deleteVifibAccounting\')(bg=0)\n
return \'Done.\'\n
\n
deleted = False\n
if context in module_list:\n
id_list = [q.getId() for q in \\\n
portal.portal_catalog(parent_uid=context.getUid(), limit=100) if q.getRelativeUrl() not in BLACKLIST_RELATIVE_URL_LIST]\n
if id_list:\n
deleted = True\n
context.deleteContent(id_list)\n
e = DateTime().timeTime() - b\n
script.log(\'Deleted %s from %s in %.3ss, so %.3s/s\' % (len(id_list), context.getId(), e, len(id_list)/e))\n
\n
if deleted:\n
getattr(context.activate(tag=tag), \'03_ERP5Site_deleteVifibAccounting\')(bg=0)\n
else:\n
script.log(\'Finished module %s\' % context.getPath())\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
bg=1
</string>
</value>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSUpgrader
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
03_ERP5Site_deleteVifibAccounting
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
...
...
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/04_ERP5Site_reindex.xml
→
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/04_ERP5Site_reindex
WithClear
.xml
View file @
5f40bb72
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.getPortalObject().ERP5Site_reindexAll()\n
<value>
<string>
context.getPortalObject().ERP5Site_reindexAll(
clear_catalog=1
)\n
return \'Done.\'\n
</string>
</value>
</item>
...
...
@@ -60,7 +60,7 @@ return \'Done.\'\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
04_ERP5Site_reindex
</string>
</value>
<value>
<string>
04_ERP5Site_reindex
WithClear
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_upgrader/bt/revision
View file @
5f40bb72
52
\ No newline at end of file
53
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment