r102210 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102209‎ | r102210 | r102211 >
Date:23:49, 6 November 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Allow for installation of php in ~/.mwphp and don't die if maintenance/dev/data already existsy
Modified paths:
  • /trunk/phase3/maintenance/dev/install.sh (modified) (history)
  • /trunk/phase3/maintenance/dev/installmw.sh (modified) (history)
  • /trunk/phase3/maintenance/dev/installphp.sh (modified) (history)
  • /trunk/phase3/maintenance/dev/start.sh (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/dev/install.sh
@@ -1,6 +1,6 @@
22 #!/bin/bash
33
4 -if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 4+if [ "x$BASH_SOURCE" == "x" ]; then echo '$BASH_SOURCE not set'; exit 1; fi
55 DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
66
77 "$DEV/installphp.sh"
Index: trunk/phase3/maintenance/dev/installmw.sh
@@ -1,16 +1,25 @@
22 #!/bin/bash
33
4 -if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 4+if [ "x$BASH_SOURCE" == "x" ]; then echo '$BASH_SOURCE not set'; exit 1; fi
55 DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
66
 7+if [ -d "$DEV/php" -a -x "$DEV/php/bin/php" ]; then
 8+ PHP="$DEV/php/bin/php"
 9+elif [ -d "$HOME/.mwphp" -a -x "$HOME/.mwphp/bin/php" ]; then
 10+ PHP="$HOME/.mwphp/bin/php"
 11+else
 12+ echo "Local copy of PHP is not installed"
 13+ echo 1
 14+fi
 15+
716 set -e
817
918 PORT=4881
1019
1120 cd "$DEV/../../"; # $IP
1221
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"
 22+mkdir -p "$DEV/data"
 23+"$PHP" maintenance/install.php --server="http://localhost:$PORT" --scriptpath="" --dbtype=sqlite --dbpath="$DEV/data" --pass=admin "Trunk Test" "$USER"
1524 echo ""
1625 echo "Development wiki created with admin user $USER and password 'admin'."
1726 echo ""
Index: trunk/phase3/maintenance/dev/start.sh
@@ -1,12 +1,21 @@
22 #!/bin/bash
33
4 -if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 4+if [ "x$BASH_SOURCE" == "x" ]; then echo '$BASH_SOURCE not set'; exit 1; fi
55 DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
66
 7+if [ -d "$DEV/php" -a -x "$DEV/php/bin/php" ]; then
 8+ PHP="$DEV/php/bin/php"
 9+elif [ -d "$HOME/.mwphp" -a -x "$HOME/.mwphp/bin/php" ]; then
 10+ PHP="$HOME/.mwphp/bin/php"
 11+else
 12+ echo "Local copy of PHP is not installed"
 13+ echo 1
 14+fi
 15+
716 PORT=4881
817
918 echo "Starting up MediaWiki at http://localhost:$PORT/"
1019 echo ""
1120
1221 cd "$DEV/../../"; # $IP
13 -"$DEV/php/bin/php" -S "localhost:$PORT"
 22+"$PHP" -S "localhost:$PORT"
Index: trunk/phase3/maintenance/dev/installphp.sh
@@ -1,13 +1,13 @@
22 #!/bin/bash
33
4 -if [[ "x$BASH_SOURCE" == "x" ]]; then echo '$BASH_SOURCE not set'; exit 1; fi
 4+if [ "x$BASH_SOURCE" == "x" ]; then echo '$BASH_SOURCE not set'; exit 1; fi
55 DEV=$(cd -P "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
66
77 set -e # DO NOT USE PIPES unless this is rewritten
88
9 -if [ -d "$DEV/php" ]; then
 9+if [ -d "$DEV/php" -a -x "$DEV/php/bin/php" ] || [ -d "$HOME/.mwphp" -a -x "$HOME/.mwphp/bin/php" ]; then
1010 echo "PHP is already installed"
11 - exit 1
 11+ exit 0
1212 fi
1313
1414 TAR=php5.4-latest.tar.gz
@@ -15,6 +15,20 @@
1616
1717 cd "$DEV"
1818
 19+echo "Preparing to download and install a local copy of PHP 5.4, note that this can take some time to do."
 20+echo "If you wish to avoid re-doing this for uture dev installations of MediaWiki we suggest installing php in ~/.mwphp"
 21+echo -n "Install PHP in ~/.mwphp [y/N]: "
 22+read INSTALLINHOME
 23+
 24+case "$INSTALLINHOME" in
 25+ [Yy] | [Yy][Ee][Ss] )
 26+ PREFIX="$HOME/.mwphp"
 27+ ;;
 28+ *)
 29+ PREFIX="$DEV/php/"
 30+ ;;
 31+esac
 32+
1933 # Some debain-like systems bundle wget but not curl, some other systems
2034 # like os x bundle curl but not wget... use whatever is available
2135 echo -n "Downloading PHP 5.4"
@@ -35,7 +49,7 @@
3650
3751 cd php5.4-*/
3852
39 -echo "Configuring and installing php 5.4 in \$IP/maintenance/dev/php/"
40 -./configure --prefix="$DEV/php/"
 53+echo "Configuring and installing php 5.4 in $PREFIX"
 54+./configure --prefix="$PREFIX"
4155 make
4256 make install

Follow-up revisions

RevisionCommit summaryAuthorDate
r105821Follow up r102210:...dantman19:45, 11 December 2011

Comments

#Comment by Hashar (talk | contribs)   10:30, 6 December 2011

What about using ~/.mediawiki/php ?

Looks good anyway.

#Comment by Dantman (talk | contribs)   12:05, 6 December 2011

Can you think of anything else we'd EVER put in a user's home directory?

#Comment by Hashar (talk | contribs)   16:41, 6 December 2011

You just did. We could have another project that might want to add its file in the user home as well. So you can as well add one directory depth future usages :-) One possible use would be to add a config file our Maintenance script could load preferences from. For example always run update.php with --quick or parserTests using --quiet.

Status & tagging log