forked from CroceRossaCatania/gaia
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautopull.php
More file actions
30 lines (21 loc) · 730 Bytes
/
autopull.php
File metadata and controls
30 lines (21 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/*
* (c)2013 Croce Rossa Italiana
*/
require 'core.inc.php';
ignoraTransazione();
/* Controlla che l'autopull sia attivo */
if (!$conf['autopull']['abilitato']) {
die('Autopull disabilitato da configurazione.');
}
$GIT_BIN = $conf['autopull']['bin'];
$REMOTE = $conf['autopull']['origin'];
$BRANCH = $conf['autopull']['ramo'];
header('Content-Type: text/plain');
$gito = [];
exec("$GIT_BIN fetch $REMOTE 2>&1; $GIT_BIN checkout -q $REMOTE/$BRANCH 2>&1; $GIT_BIN log -1 2>&1;", $gito);
$output = date('d-m-Y H:i:s') . "\n\n" . print_r($gito, true);
/* Salva nel file di log */
file_put_contents('upload/log/autopull.txt', $output);
/* Output direttamente a video per logging di cronjob */
var_dump($output);