-
Notifications
You must be signed in to change notification settings - Fork 0
/
commonFunctions.inc.php
39 lines (25 loc) · 981 Bytes
/
commonFunctions.inc.php
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
31
32
33
34
35
36
37
38
39
<?php
//update plugin
function updatePluginFromGitHub($gitURL, $branch = "master", $pluginName)
{
global $settings;
logEntry("updating plugin: " . $pluginName);
logEntry("settings: " . $settings['pluginDirectory']);
//create update script
//$gitUpdateCMD = "sudo cd ".$settings['pluginDirectory']."/".$pluginName."/; sudo /usr/bin/git git pull ".$gitURL." ".$branch;
$pluginUpdateCMD = "/opt/fpp/scripts/update_plugin " . $pluginName;
logEntry("update command: " . $pluginUpdateCMD);
exec($pluginUpdateCMD, $updateResult);
//logEntry("update result: ".print_r($updateResult));
//loop through result
return;// ($updateResult);
}
function logEntry($data)
{
global $logFile, $myPid;
$data = $_SERVER['PHP_SELF'] . " : [" . $myPid . "] " . $data;
$logWrite = fopen($logFile, "a") or die("Unable to open file!");
fwrite($logWrite, date('Y-m-d h:i:s A', time()) . ": " . $data . "\n");
fclose($logWrite);
}
?>