Created
July 27, 2015 04:44
-
-
Save ebta/a269b26f702b80b08d80 to your computer and use it in GitHub Desktop.
Fossil checkout (server side) through PHP
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 | |
/* fossil-checkout.php | |
* Untuk melakukan checkout fossil di server tanpa harus login SSH | |
* | |
* Agar bisa berjalan, Fossil butuh HOME variabel : putenv() | |
* Add server environment. The environment variable will only exist | |
* for the duration of the current request. At the end of the request | |
* the environment is restored to its original state | |
* */ | |
$repo_name = 'simrenda.fossil'; | |
if( putenv("HOME=". dirname(__FILE__)) ) { | |
$opened = shell_exec("fossil open $repo_name --keep 2>&1"); | |
echo "<strong>Informasi Open Repository</strong>"; | |
echo "<pre>$opened</pre><hr />"; | |
$update = shell_exec('fossil checkout trunk --force 2>&1'); | |
echo "<strong>Informasi files/folder yg di update:</strong>"; | |
echo "<pre>$update</pre><hr/ >"; | |
$output = shell_exec('fossil status 2>&1'); | |
echo "<strong>Status Repository:</strong>"; | |
echo "<pre>$output</pre>"; | |
} else { | |
echo "Gagal mengeset HOME di php, Fossil butuh ini"; | |
} | |
echo '<hr />'; | |
$version = system('fossil version'); | |
echo '<hr />'; | |
// Clear environment variable | |
putenv('HOME'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment