Skip to content

Commit

Permalink
- Resurrect ZODB packing from the ZMI
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed May 13, 2019
1 parent 97d79cc commit 7eda8f8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ https://github.com/zopefoundation/Zope/blob/4.0a6/CHANGES.rst
Features
++++++++

- Resurrect ZODB packing from the ZMI
(`#623 <https://github.com/zopefoundation/Zope/issues/623>`_)

- Optionally control the use of Zope's built-in XML-RPC support for
POST requests with Content-Type ``text/xml`` via the
registration of a ``ZPublisher.interfaces.IXmlrpcChecker`` utility
Expand Down
22 changes: 21 additions & 1 deletion src/App/ApplicationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,27 @@ def manage_minimize(self, value=1, REQUEST=None):
self._getDB().cacheMinimize()

if REQUEST is not None:
REQUEST.RESPONSE.redirect(REQUEST['URL1'] + '/manage_main')
msg = 'ZODB in-memory caches minimized.'
url = '%s/manage_main?manage_tabs_message=%s' % (REQUEST['URL1'],
msg)
REQUEST.RESPONSE.redirect(url)

@requestmethod('POST')
def manage_pack(self, days=0, REQUEST=None, _when=None):
"""Pack the database"""
if _when is None:
_when = time.time()
t = _when - (days * 86400)

self._getDB().pack(t)

if REQUEST is not None:
msg = 'Database packed to %s days' % str(days)
url = '%s/manage_main?manage_tabs_message=%s' % (REQUEST['URL1'],
msg)
REQUEST['RESPONSE'].redirect(url)

return t


InitializeClass(AltDatabaseManager)
11 changes: 11 additions & 0 deletions src/App/dtml/dbMain.dtml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
</tbody>
</table>

<div class="zmi-controls mb-5">
<form action="&dtml-URL1;/manage_pack" method="post">
<input class="btn btn-primary" id="pack" type="submit"
name="submit" value="Pack" />
<input type="text" name="days:float" value="0" size="3"> days
<small class="form-text text-muted">
Pack: Remove previous object revisions older than the selected
number of days.
</small>
</form>
</div>

<table id="zmi-db_cache" class="table table-striped mt-5">
<thead>
Expand Down

0 comments on commit 7eda8f8

Please sign in to comment.