Ajout de after_pull + after_push et changement du comportement du push (encore)

This commit is contained in:
Michel Roux 2014-04-07 09:58:06 +02:00
parent cee87b9890
commit 6e425b3321
2 changed files with 11 additions and 3 deletions

View File

@ -43,10 +43,16 @@ if (!empty($_POST['action'])) {
exit; exit;
} else if ($_POST['action'] == 'push') { } else if ($_POST['action'] == 'push') {
$message = empty($_POST['message']) ? 'FTP' : str_replace(array('"', "'"), ' ', stripslashes($_POST['message'])); $message = empty($_POST['message']) ? 'FTP' : str_replace(array('"', "'"), ' ', stripslashes($_POST['message']));
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push && git push && ' . $gitstatus . "'")); echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git push && git add -A && git commit -m "' . $message . '" && git push && ' . $gitstatus . "'"));
if (!empty($config['after_push'])) {
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push']));
}
exit; exit;
} else if ($_POST['action'] == 'pull') { } else if ($_POST['action'] == 'pull') {
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git pull && ' . $gitstatus . "'")); echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && git pull && ' . $gitstatus . "'"));
if (!empty($config['after_pull'])) {
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_pull']));
}
exit; exit;
} else { } else {
echo 'Unknown command ' . $_POST['action']; echo 'Unknown command ' . $_POST['action'];

View File

@ -22,7 +22,8 @@ $servers = array(
'port' => 22, 'port' => 22,
'user' => 'root', 'user' => 'root',
'pass' => 'root', 'pass' => 'root',
'path' => '/home/user/root' 'path' => '/home/user/root',
'after_push' => 'php -f TAMERE.php'
), ),
'test1' => array( 'test1' => array(
'title' => 'Test de la mort', 'title' => 'Test de la mort',
@ -30,7 +31,8 @@ $servers = array(
'port' => 22, 'port' => 22,
'user' => 'user', 'user' => 'user',
'pass' => 'blbl', 'pass' => 'blbl',
'path' => '/home/user/test' 'path' => '/home/user/test',
'after_pull' => 'php -f TONPERE.php'
), ),
'prod2' => array( 'prod2' => array(
'title' => 'Production de la mort', 'title' => 'Production de la mort',