JGonera has submitted this change and it was merged.

Change subject: Add cachedpage.sh to identify potential caching problems
......................................................................


Add cachedpage.sh to identify potential caching problems

Running:
./scripts/cachedpage.sh 5413e645da2067687627b9a9c6a1aee914328a63
Produces cached.html and cached_special.html

Added useformat=mobile, otherwise desktop pages are saved (jgonera)

Change-Id: Ifb84b8cd2b46f9e92053de12c6ee4749c9814be2
---
M .gitignore
A scripts/cachedpage.sh
2 files changed, 46 insertions(+), 0 deletions(-)

Approvals:
  JGonera: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/.gitignore b/.gitignore
index a564408..f2633b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 .idea/
 node_modules/
 .lessignore
+tmp/
diff --git a/scripts/cachedpage.sh b/scripts/cachedpage.sh
new file mode 100755
index 0000000..638de95
--- /dev/null
+++ b/scripts/cachedpage.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+#usage ./scripts/cachedpage.sh 1bd5bc53ebb04fff7f508712a29fdf1f1d7fe14f
+
+if
+! git diff --exit-code --quiet # check for unstaged changes
+then #stash them so they are not lost
+       stashed_changes=1
+       git stash
+fi
+
+cur_branch=`git rev-parse --abbrev-ref HEAD` #get the current branch name
+if [ $cur_branch == 'HEAD' ]
+then #we should ensure we don't lose this
+       cur_branch=tmp_`date "+%Y%m%d%H%M%S"`
+       git branch -D $cur_branch #delete the temporary branch if it already 
exists
+       git checkout -b $cur_branch #checkout the current HEAD as this new 
branch
+fi
+
+git checkout $1 #go to commit caller requested
+
+#Generate the 'cached' pages
+mkdir -p tmp
+URL=${MEDIAWIKI_URL:-"http://127.0.0.1:80"}
+echo "Using $URL as a development environment host."
+echo "To specify a different host set MEDIAWIKI_URL environment variable"
+echo '(e.g. by running "export MEDIAWIKI_URL=http://localhost:8080/w";)'
+wget "$URL/index.php/Main_Page?useformat=mobile" -O tmp/cached.html
+wget "$URL/index.php/Special:MobileOptions?useformat=mobile" -O 
tmp/cached_special.html
+
+#Return to previous branch
+git checkout $cur_branch
+
+# Print location of urls
+echo
+echo Cached pages generated at following locations
+echo
+echo \* $URL/extensions/MobileFrontend/tmp/cached.html
+echo \* $URL/extensions/MobileFrontend/tmp/cached_special.html
+
+if [ $stashed_changes ]
+then
+       unset cur_branch
+       git stash pop
+fi

-- 
To view, visit https://gerrit.wikimedia.org/r/61773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb84b8cd2b46f9e92053de12c6ee4749c9814be2
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to