self._loaded = True
return True
+ def purge(self):
+ """Purge the cache of an instance"""
+ if not self.isInstalled():
+ raise Exception('Instance not installed, cannot purge.')
+ elif self.branch_compare('22', '<'):
+ raise Exception('Instance does not support cache purging.')
+
+ try:
+ self.cli('admin/cli/purge_caches.php', stderr=None, stdout=None)
+ except Exception as e:
+ raise Exception('Error while purging cache!')
+
def reload(self):
"""Reloads the information"""
self._loaded = False
for M in Mlist:
debug('Purging cache on %s' % (M.get('identifier')))
- if not M.isInstalled():
- debug('Instance not installed. Skipping...')
- debug('')
- continue
- elif M.branch_compare('22', '<'):
- debug('Instance does not support cache purging. Skipping...')
- debug('')
- continue
-
try:
- M.cli('admin/cli/purge_caches.php', stderr=None, stdout=None)
+ M.purge()
except Exception as e:
- debug('Error while purging cache!')
+ debug(e)
else:
debug('Cache purged!')