From 6e425b3321798916cbd28f97444d4bb68da46b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xe=CC=81fir=20Destiny?= Date: Mon, 7 Apr 2014 09:58:06 +0200 Subject: [PATCH] Ajout de after_pull + after_push et changement du comportement du push (encore) --- ajax.php | 8 +++++++- config-sample.php | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) 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',