diff --git a/ajax.php b/ajax.php index 7a81796..136b333 100644 --- a/ajax.php +++ b/ajax.php @@ -43,10 +43,16 @@ if (!empty($_POST['action'])) { exit; } else if ($_POST['action'] == 'push') { $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; } else if ($_POST['action'] == 'pull') { 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; } else { echo 'Unknown command ' . $_POST['action']; diff --git a/config-sample.php b/config-sample.php index dcc76c3..694d16b 100644 --- a/config-sample.php +++ b/config-sample.php @@ -22,7 +22,8 @@ $servers = array( 'port' => 22, 'user' => 'root', 'pass' => 'root', - 'path' => '/home/user/root' + 'path' => '/home/user/root', + 'after_push' => 'php -f TAMERE.php' ), 'test1' => array( 'title' => 'Test de la mort', @@ -30,7 +31,8 @@ $servers = array( 'port' => 22, 'user' => 'user', 'pass' => 'blbl', - 'path' => '/home/user/test' + 'path' => '/home/user/test', + 'after_pull' => 'php -f TONPERE.php' ), 'prod2' => array( 'title' => 'Production de la mort',