Chad has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/336730 )
Change subject: Scap clean: Rework --l10n-only into --keep-static
......................................................................
Scap clean: Rework --l10n-only into --keep-static
We really should prune all files that aren't static assets. We don't
need them and we don't want code paths accidentally using them.
Bug: T157631
Change-Id: If720c9c80d7c07047cdeb35a1a9acd43e8290333
---
M scap/plugins/clean.py
1 file changed, 8 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/30/336730/1
diff --git a/scap/plugins/clean.py b/scap/plugins/clean.py
index 556348a..3f761e0 100644
--- a/scap/plugins/clean.py
+++ b/scap/plugins/clean.py
@@ -12,8 +12,8 @@
""" Scap sub-command to clean old branches """
@cli.argument('branch', help='The name of the branch to clean.')
- @cli.argument('--l10n-only', action='store_true',
- help='Only prune old l10n cache files.')
+ @cli.argument('--keep-static', action='store_true',
+ help='Only keep static assets (CSS/JS and the like).')
def main(self, *extra_args):
""" Clean old branches from the cluster for space savings! """
@@ -46,6 +46,9 @@
def _clean_command(self, location):
path = os.path.join(location, 'php-%s' % self.arguments.branch)
- if self.arguments.l10n_only:
- path = os.path.join(path, 'cache', 'l10n', '*.cdb')
- return 'rm -fR %s' % path
+ regex = '.*\.(gif|jpe?g|png|css|js|json|woff|woff2|svg|eot|ttf|ico)'
+ if self.arguments.keep_static:
+ return ['find', path, '-regextype', 'posix-extended', '-not',
+ '-regex', regex, '-delete']
+ else:
+ return ['rm', '-fR', path]
--
To view, visit https://gerrit.wikimedia.org/r/336730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If720c9c80d7c07047cdeb35a1a9acd43e8290333
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits