From: Dan Scott Date: Mon, 23 May 2011 15:02:37 +0000 (-0400) Subject: Add a cache-munging script-generating script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e0d4bea3a115fee752d4cd8f237529c6b7e3661f;p=contrib%2FConifer.git Add a cache-munging script-generating script Quickly pulled together a script to munge the CSS and JavaScript for a given skin so that upgrades don't result in painful mismatches. Warning: this Perl script generates a shell script which you must then execute. It's not elegant in any way, it's based on the shell commands that I issued by hand in a hurry. However, it does give you the opportunity to examine what the script is going to do before it munges your skin(s). Signed-off-by: Dan Scott --- diff --git a/tools/migration-scripts/cache-munger.pl b/tools/migration-scripts/cache-munger.pl new file mode 100644 index 0000000000..aa2a49a030 --- /dev/null +++ b/tools/migration-scripts/cache-munger.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl +use strict; +use warnings; + +# Doesn't need to be a datestamp; could be anything that uniquely +# qualifies the path +my $datestamp = "2011-05-22"; + +# List the skins here that you want to munge +my @skins = qw( + default +); + +print "# Create date-stamped opac\/common path:\n"; +print "cd \/openils\/var\/web\/opac\n"; +print "ln -sf common common.$datestamp\n"; +print "\n"; + +print "# Create date-stamped dojo path:\n"; +print "cd \/openils\/var\/web\/js\n"; +print "ln -sf dojo dojo.$datestamp\n"; +print "\n"; + +foreach my $skin (@skins) { + print "# Munging skin $skin:\n"; + print "cd \/openils\/var\/web\/opac\/theme\/$skin\n"; + print "ln -sf css css.$datestamp\n"; + print "cd \/openils\/var\/web\/opac\/skin\/$skin\/xml\n"; + print "ln -sf common common.$datestamp\n"; + print "cd \/openils\/var\/web\/opac\/skin\/$skin\n"; + print "ln -sf js js.$datestamp; ln -sf css css.$datestamp;\n"; + print "for i in `ack-grep -l \"\/$skin\/js\/\"`; do sed -i -e \"s\/\\/$skin\\/js\\/\/\\/$skin\\/js.$datestamp\\/\/\" \$i; done\n"; + print "for i in `ack-grep -l \"\/$skin\/css\/\"`; do sed -i -e \"s\/\\/$skin\\/css\\/\/\\/$skin\\/css.$datestamp\\/\/\" \$i; done\n"; + print "for i in `ack-grep -l '\/common\/'`; do sed -i -e \"s\/\\/common\\/\/\\/common.$datestamp\\/\/\" \$i; done\n"; + print "for i in `ack-grep -l '\/js\/dojo\/'`; do sed -i -e \"s\/\\/js\\/dojo\\/\/\\/js\\/dojo.$datestamp\\/\/\" \$i; done\n"; + print "\n"; +}