Download:MediaWiki updater script/Source

From LizardWiki, FastLizard4's wiki and website
Jump to: navigation, search

Current source code for the MediaWiki updater script. Return to the description page

  1. #!/bin/bash
  2.  
  3. #Updates MediaWiki.  Must be run from shell, duh.
  4.  
  5. if [ $1 ]
  6. then
  7. 	if [ $1 = '--help' ]
  8. 	then
  9. 		echo 'Usage: ./update.sh [branchname OR option]'
  10. 		echo 'Where [branchname] is an optional branch name to switch to.'
  11. 		echo '[option] can be one of the following:'
  12. 		echo '--listbranches - Show all available branches for all extensions'
  13. 		echo '--version - Show version'
  14. 		exit 0
  15. 	elif [ $1 = '--version' ]
  16. 	then
  17. 		echo 'MediaWiki autoupdate script version 2.0 by Andrew "FastLizard4" Adams'
  18. 		echo 'Copyright (C) 2013 Andrew "FastLizard4" Adams <http://fastlizard4.org/wiki/MediaWiki_updater_script>'
  19. 		echo 'License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.'
  20. 		echo 'This is free software: you are free to change and redistribute it.'
  21. 		echo 'There is NO WARRANTY, to the extent permitted by law.'
  22. 		exit 0
  23. 	elif [ $1 = '--listbranches' ]
  24. 	then
  25. 	        cd extensions
  26. 	        for dir in *; do
  27. 	                echo "Branches of extension $dir: "
  28. 	                cd $dir && git branch -rl && cd ..
  29. 	        done
  30. 	        cd ..
  31. 		exit 0
  32. 	else
  33. 		echo "Warning: Switching all to branch $1"
  34. 	fi
  35. fi
  36.  
  37. echo -n 'Pulling core: '
  38. git pull
  39.  
  40. cd extensions
  41.  
  42. for dir in *; do
  43. 	echo -n "Pulling in extension $dir: "
  44. 	cd $dir && (git pull || exit 1) && cd ..
  45. done
  46.  
  47. if [ $1 ]
  48. then
  49. 	echo -n 'Switching branch in core: '
  50. 	git checkout $1
  51. 	cd extensions
  52. 	for dir in *; do
  53. 		echo -n "Switching branch in extension $dir: "
  54. 		cd $dir && (git checkout $1 || true) && cd ..
  55. 	done
  56. 	cd ..
  57. fi
  58.  
  59. cd ../maintenance
  60. php update.php