Fear Root dot Com
Making your life easier, one keystroke at a time.
Today we will cover the basics of updating subversion via a twilio application using a php script and twiml

  • Linux Server
  • Twilio Account
  • Subversion
  • pecl
  • phpize
  • svn pecl libraries
*Note: you must check your files out saving the credentials, or using the file:/// method.

apt-get install php-pear php5-dev libsvn-dev
pecl install svn

Update php.ini for web environment and cli environments and add extension in as:

Now for the code, because after all, thats why you're here.

Update line 04 with your authorized phone number
Update line 09 with the location of your files
01: <?php
02: header("content-type: text/xml");
03: echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
04: if($_REQUEST['From'] != "+1NNNNNNNNNN")
05: {
06:   echo "<Response><Reject/></Response>";
07:   die();
08: }
09: $updated_revision = svn_update("/location/of/site");
10: ?>
11: <Response>
12:   <Say>
13:     <?php echo "Current Revision of Production: ".$updated_revision."."; ?>
14:   </Say>
15: </Response>

Point a phone number at http://yourdomain.com/subversion_update.php

Happy hacking sysadmins ;)

FearRoot.com - Developed by: Shawn Campbell