Adding operator setting in config
This commit is contained in:
parent
8e7ec31de0
commit
3cd7d4dee5
@ -12,12 +12,6 @@ What I need to run it ?
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
Nothing more than a web server with PHP 5 installed.
|
Nothing more than a web server with PHP 5 installed.
|
||||||
The git clients **MUST HAVE bash** or shell like him supporting && operator
|
|
||||||
|
|
||||||
Shells tested and working :
|
|
||||||
- Bash
|
|
||||||
- lshell
|
|
||||||
- zsh
|
|
||||||
|
|
||||||
Why ?
|
Why ?
|
||||||
----------
|
----------
|
||||||
|
18
ajax.php
18
ajax.php
@ -6,7 +6,6 @@ require_once 'utils.php';
|
|||||||
require_once 'Net/SSH2.php';
|
require_once 'Net/SSH2.php';
|
||||||
require_once 'Crypt/RSA.php';
|
require_once 'Crypt/RSA.php';
|
||||||
global $servers, $config;
|
global $servers, $config;
|
||||||
$gitstatus = 'git fetch && git status';
|
|
||||||
|
|
||||||
if (!empty($_POST['section'])) {
|
if (!empty($_POST['section'])) {
|
||||||
foreach ($servers as $ssh) {
|
foreach ($servers as $ssh) {
|
||||||
@ -38,27 +37,30 @@ if (!empty($_POST['action'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($session->isConnected()) {
|
if ($session->isConnected()) {
|
||||||
|
$operator = !empty($config['operator']) ? ' ' . $config['operator'] . ' ' : ' && ';
|
||||||
|
$gitstatus = 'git fetch' . $operator . 'git status';
|
||||||
|
|
||||||
if ($_POST['action'] == 'status') {
|
if ($_POST['action'] == 'status') {
|
||||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && ' . $gitstatus));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . $gitstatus));
|
||||||
exit;
|
exit;
|
||||||
} else if (strpos($_POST['action'], 'push') !== false) {
|
} else if (strpos($_POST['action'], 'push') !== false) {
|
||||||
if (strpos($_POST['action'], 'force') !== false) {
|
if (strpos($_POST['action'], 'force') !== false) {
|
||||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && git push && ' . $gitstatus));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . 'git push' . $operator . $gitstatus));
|
||||||
if (!empty($config['after_push'])) {
|
if (!empty($config['after_push'])) {
|
||||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && ' . $config['after_push']));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . $config['after_push']));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$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('cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push && ' . $gitstatus));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . 'git add -A' . $operator . 'git commit -m "' . $message . '"' . $operator . 'git push' . $operator . $gitstatus));
|
||||||
if (!empty($config['after_push'])) {
|
if (!empty($config['after_push'])) {
|
||||||
echo ansi2html($session->exec('bash -c \'cd ' . $config['path'] . ' && ' . $config['after_push'] . "'"));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . $config['after_push']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
} else if ($_POST['action'] == 'pull') {
|
} else if ($_POST['action'] == 'pull') {
|
||||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && git pull && ' . $gitstatus));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . 'git pull' . $operator . $gitstatus));
|
||||||
if (!empty($config['after_pull'])) {
|
if (!empty($config['after_pull'])) {
|
||||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && ' . $config['after_pull']));
|
echo ansi2html($session->exec('cd ' . $config['path'] . $operator . $config['after_pull']));
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,7 +23,8 @@ $servers = array(
|
|||||||
'user' => 'root',
|
'user' => 'root',
|
||||||
'pass' => 'root',
|
'pass' => 'root',
|
||||||
'path' => '/home/user/root',
|
'path' => '/home/user/root',
|
||||||
'after_push' => 'php -f TAMERE.php'
|
'after_push' => 'php -f TAMERE.php',
|
||||||
|
'operator' => '&&'
|
||||||
),
|
),
|
||||||
'test1' => array(
|
'test1' => array(
|
||||||
'title' => 'Test de la mort',
|
'title' => 'Test de la mort',
|
||||||
@ -32,7 +33,8 @@ $servers = array(
|
|||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'pass' => 'blbl',
|
'pass' => 'blbl',
|
||||||
'path' => '/home/user/test',
|
'path' => '/home/user/test',
|
||||||
'after_pull' => 'php -f TONPERE.php'
|
'after_pull' => 'php -f TONPERE.php',
|
||||||
|
'operator' => '; and'
|
||||||
),
|
),
|
||||||
'prod2' => array(
|
'prod2' => array(
|
||||||
'title' => 'Production de la mort',
|
'title' => 'Production de la mort',
|
||||||
|
Loading…
Reference in New Issue
Block a user