r102201 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102200‎ | r102201 | r102202 >
Date:22:50, 6 November 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Commit maintenance/dev/ a set of bash scripts that can quickly download php 5.4, install it in an isolated area, install a quick development copy of MediaWiki, and then start up a local webserver.
Modified paths:
  • /trunk/phase3/maintenance/dev (added) (history)
  • /trunk/phase3/maintenance/dev/README (added) (history)
  • /trunk/phase3/maintenance/dev/install.sh (added) (history)
  • /trunk/phase3/maintenance/dev/installmw.sh (added) (history)
  • /trunk/phase3/maintenance/dev/installphp.sh (added) (history)
  • /trunk/phase3/maintenance/dev/start.sh (added) (history)

Diff [purge]

Index: trunk/phase3/maintenance/dev/install.sh
@@ -0,0 +1,8 @@
 2+#!/bin/bash
 3+
 4+if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 5+DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
 6+
 7+$DEV/installphp.sh
 8+$DEV/installmw.sh
 9+$DEV/start.sh
Property changes on: trunk/phase3/maintenance/dev/install.sh
___________________________________________________________________
Added: svn:executable
110 + *
Index: trunk/phase3/maintenance/dev/installmw.sh
@@ -0,0 +1,16 @@
 2+#!/bin/bash
 3+
 4+if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 5+DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
 6+
 7+set -e
 8+
 9+PORT=4881
 10+
 11+cd $DEV/../../; # $IP
 12+
 13+mkdir $DEV/data
 14+$DEV/php/bin/php maintenance/install.php --server="http://localhost:$PORT" --scriptpath="" --dbtype=sqlite --dbpath=$DEV/data --pass=admin "Trunk Test" $USER
 15+echo ""
 16+echo "Development wiki created with admin user $USER and password 'admin'."
 17+echo ""
Property changes on: trunk/phase3/maintenance/dev/installmw.sh
___________________________________________________________________
Added: svn:executable
118 + *
Index: trunk/phase3/maintenance/dev/start.sh
@@ -0,0 +1,12 @@
 2+#!/bin/bash
 3+
 4+if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 5+DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
 6+
 7+PORT=4881
 8+
 9+echo "Starting up MediaWiki at http://localhost:$PORT/"
 10+echo ""
 11+
 12+cd $DEV/../../; # $IP
 13+$DEV/php/bin/php -S localhost:$PORT
Property changes on: trunk/phase3/maintenance/dev/start.sh
___________________________________________________________________
Added: svn:executable
114 + *
Index: trunk/phase3/maintenance/dev/installphp.sh
@@ -0,0 +1,41 @@
 2+#!/bin/bash
 3+
 4+if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 5+DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
 6+
 7+set -e # DO NOT USE PIPES unless this is rewritten
 8+
 9+if [ -d $DEV/php ]; then
 10+ echo "PHP is already installed"
 11+ exit 1
 12+fi
 13+
 14+TAR=php5.4-latest.tar.gz
 15+PHPURL=http://snaps.php.net/$TAR
 16+
 17+cd $DEV
 18+
 19+# Some debain-like systems bundle wget but not curl, some other systems
 20+# like os x bundle curl but not wget... use whatever is available
 21+echo -n "Downloading PHP 5.4"
 22+if command -v wget &>/dev/null; then
 23+ echo "- using wget"
 24+ wget $PHPURL
 25+elif command -v curl &>/dev/null; then
 26+ echo "- using curl"
 27+ curl -O $PHPURL
 28+else
 29+ echo "- aborting"
 30+ echo "Could not find curl or wget." >&2;
 31+ exit 1;
 32+fi
 33+
 34+echo "Extracting php 5.4"
 35+tar -xzf $TAR
 36+
 37+cd php5.4-*/
 38+
 39+echo "Configuring and installing php 5.4 in $IP/maintenance/dev/php/"
 40+./configure --prefix=$DEV/php/
 41+make
 42+make install
Property changes on: trunk/phase3/maintenance/dev/installphp.sh
___________________________________________________________________
Added: svn:executable
143 + *
Index: trunk/phase3/maintenance/dev/README
@@ -0,0 +1,7 @@
 2+maintenance/dev/ scripts can help quickly setup a local MediaWiki for development purposes.
 3+
 4+Wikis setup in this way are NOT meant to be publicly available. They use a development database not acceptible for use in production and place a sqlite database in an unsafe location a real wiki should never place it in.
 5+
 6+Running maintenance/dev/install.sh will download and install a local copy of php 5.4, install a sqlite powered instance of MW for development, and then start up a local webserver to view the wiki.
 7+
 8+After installation you can bring the webserver back up at any time you want with maintenance/dev/start.sh

Follow-up revisions

RevisionCommit summaryAuthorDate
r102208Followup r102201, quote all variables to guard against paths with spaces in t...dantman23:13, 6 November 2011

Comments

#Comment by Petrb (talk | contribs)   22:56, 6 November 2011

I am not allowed to touch trunk of phase3 so I am not sure if I should comment on this, but imho $DEV and other variables should be in "", in case that some folders would contain spaces...

#Comment by Dantman (talk | contribs)   23:13, 6 November 2011

^_^ Ah right... I spent all that time trying to guard against assumptions about what directory you run it in and I forget about directories with spaces.

Fixed in r102208.

#Comment by Hashar (talk | contribs)   11:21, 25 November 2011

Petrb, even if you do not have commit rights on trunk/phase3, your comments are always welcome! That is probably the best way to learn about the code so be bold and do ask questions whenever something looks suspicious :-)

#Comment by Hashar (talk | contribs)   11:25, 25 November 2011

Dantman, I think those .sh scripts could be merged in a Makefile. That is probably easier to handle in the long time.

Or we could use pake instead of make ( https://github.com/indeyets/pake/wiki ) which would make the makefile/scritps usable on windows. It is available from PEAR.

#Comment by Dantman (talk | contribs)   14:24, 25 November 2011

Before we go adding dependencies like pake to something that is supposed to work without any dependency on pre-installed php much less a non-default pear module, I'd like to have someone actually make sure that the installation steps on Windows works seamlessly. Using something cross platform but non-native is completely pointless if the configure / install of php chokes up in ANY way at all.

Looking at php's Windows site makes me think using the same pattern for installing php as we use on unix-like systems won't work sanely on Windows and you need a complete separate set of steps dedicated to Windows for it to work. ie: Someone should consider writing a .bat for Windows.

((Really? "To install php 5.4 and MediaWiki together please ensure you have a fully functional php installation, pear, and the pake pear package on your system."))

#Comment by Reach Out to the Truth (talk | contribs)   18:51, 25 November 2011

Hm. Does Windows even come with anything that can download files from a command line? We could still try to use wget and curl, but they're less likely to be there on Windows.

#Comment by Bryan (talk | contribs)   21:49, 25 November 2011

[[w:Windows Script Host|]]

#Comment by Bryan (talk | contribs)   22:06, 25 November 2011

Sigh, no pre-save transform...

Windows Script Host

Status & tagging log