Last active
December 13, 2015 22:29
-
-
Save hnnesv/4984433 to your computer and use it in GitHub Desktop.
Tool for HIMMS Showcase 2013 - Execute a service command via a web endpoint.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!isset($_GET["type"])) { | |
echo "1"; | |
} else { | |
$type = $_GET["type"]; | |
$cmd = "false"; | |
if ($type == "clockset") { | |
#date format MMDDhhmm[[CC]YY][.ss] | |
$date = $_GET["date"]; | |
#see the setclock.sh script | |
$cmd = "echo $date > /tmp/clockset"; | |
#or if you're running apache as root... | |
#(which is usually a bad idea) | |
#$cmd = "date $date"; | |
} else if ($type == "cleanopenmrs") { | |
$cmd = "mysql openmrs -u root -pPASSWORD -e \"update encounter set voided='1';\""; | |
} else if ($type == "cleanopenxds") { | |
$cmd = "export PGPASSWORD=\"openxds\" && psql openxds -U openxds < /home/jembi/openxds/misc/create_database_schema_postgres.sql"; | |
} | |
$output = null; | |
$returnValue = 1; | |
exec($cmd, $output, $returnValue); | |
echo "$returnValue"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment