Hi Guys,
I want to have a PHP script that I can run from my webserver (in a secure directory using httpd authentication) so that I can do an svn update command on several directories on my server.
For example, I currently have the following Bash Script:
--------------------------
----------
----------
----------
----------
--
#!/bin/bash
echo "Updating FIT"
cd /home/scryan
svn update
echo ""
echo "Updating DSPP"
cd /home/scryan/dspp
svn update
echo""
echo "Updating Study"
cd /home/scryan/study
svn update
--------------------------
----------
----------
----------
Basically I would like to turn that into a php script that I can just browse to the page, hit a button Update SVN and it will run those commands and print the output to the page.
On the flip side I would also really like it if I could have another button on the page which said SVN Commit and would take a string of text then run the following:
--------------------------
----------
----------
----------
----
#!/bin/bash
host=`hostname`
echo ""
echo "Do you wish to do an SVN Commit? y/n "
read commit
if [ "$commit" == "y" ]
then
echo ""
echo "What Were you working on?"
echo "1 - DSPP"
echo "2 - FIT"
echo "3 - Study"
echo "4 - All (generic commit)"
echo ""
echo "Enter either 1, 2, 3 or 4 and press enter"
read svnnumber
if [ "$svnnumber" == "1" ]
then
cd /home/scryan/dspp
svn add --force *
echo "Enter commit message for DSPP Subversion Log"
read svn_commit_message
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
elif [ "$svnnumber" == "2" ]
then
cd /home/scryan
svn add --force *
echo "Enter commit message for FIT Subversion Log"
read svn_commit_message
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
elif [ "$svnnumber" == "3" ]
then
cd /home/scryan/study
svn add --force *
echo "Enter commit message for Study Subversion Log"
read svn_commit_message
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
elif [ "$svnnumber" == "4" ]
then
cd /home/scryan
svn add --force *
echo "Enter commit message for *GENERAL COMMIT* to Subversion Log"
read svn_commit_message
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
cd /home/scryan/study
svn add --force *
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
cd /home/scryan/dspp
svn add --force *
svn ci -m "$host Logout AutoCommit on: $date - $svn_commit_message"
fi
fi
echo ""
--------------------------
----------
----------
----------
----
Does anyone know how I could do this, I am completely new to PHP (actually have never done any PHP before) and would really love if someone could please point me in the right direction.
Cheers
Stuart
Start Free Trial