simpler debugging system
This commit is contained in:
parent
22abce38e2
commit
23dde981d4
BIN
archive/community.applications-2021.12.06-x86_64-1.txz
Normal file
BIN
archive/community.applications-2021.12.06-x86_64-1.txz
Normal file
Binary file not shown.
@ -2,8 +2,8 @@ aab3481fc0356a16dbac7022781880f3 ./Apps.page
|
||||
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
|
||||
7ee0b23dbd92ed55f611360a983f9565 ./ca_settings.page
|
||||
1b49ec9797713ce869ea0c1066a109f2 ./default.cfg
|
||||
0507ad12dc7613167318a682a8a20cfa ./include/exec.php
|
||||
57b8df772ef356881156350d8d855c0f ./include/helpers.php
|
||||
b84098319347b813b87f50722e33b10c ./include/exec.php
|
||||
b6920c2d8b2ea81a4dabbd935b93895e ./include/helpers.php
|
||||
95709ae0ed53e2889a93849a69b37892 ./include/paths.php
|
||||
410c0166bae560754e231486050621f6 ./javascript/libraries.js
|
||||
8c24d585c7dd3ff9ef961bb2c2705711 ./PluginAPI.page
|
||||
|
@ -56,19 +56,18 @@ if ( !is_dir($caPaths['templates-community']) ) {
|
||||
@unlink($caPaths['community-templates-info']);
|
||||
}
|
||||
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
if ( ! is_file($caPaths['logging']) ) {
|
||||
$caVersion = plugin("version","/var/log/plugins/community.applications.plg");
|
||||
|
||||
file_put_contents($caPaths['logging'],"Community Applications Version: $caVersion\n");
|
||||
file_put_contents($caPaths['logging'],"Unraid version: {$caSettings['unRaidVersion']}\n\n",FILE_APPEND);
|
||||
file_put_contents($caPaths['logging'],"MD5's: \n".shell_exec("cd /usr/local/emhttp/plugins/community.applications && md5sum -c ca.md5")."\n",FILE_APPEND);
|
||||
debug("Community Applications Version: $caVersion");
|
||||
debug("Unraid version: {$caSettings['unRaidVersion']}");
|
||||
debug("MD5's: \n".shell_exec("cd /usr/local/emhttp/plugins/community.applications && md5sum -c ca.md5"));
|
||||
$lingo = $_SESSION['locale'] ?: "en_US";
|
||||
file_put_contents($caPaths['logging'],"Language: $lingo\n\n",FILE_APPEND);
|
||||
file_put_contents($caPaths['logging'],"Settings:\n".print_r($caSettings,true)."\n",FILE_APPEND);
|
||||
debug("Language: $lingo");
|
||||
debug("Settings:\n".print_r($caSettings,true));
|
||||
}
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." POST CALLED ({$_POST['action']})\n".print_r($_POST,true),FILE_APPEND);
|
||||
}
|
||||
debug("POST CALLED ({$_POST['action']})\n".print_r($_POST,true));
|
||||
|
||||
|
||||
$sortOrder = readJsonFile($caPaths['sortOrder']);
|
||||
if ( ! $sortOrder ) {
|
||||
@ -2071,8 +2070,6 @@ function search_dockerhub() {
|
||||
function javascriptError() {
|
||||
global $caPaths, $caSettings;
|
||||
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
file_put_contents($caPaths['logging'],"******* ERROR **********\n".print_r($_POST,true)."\n",FILE_APPEND);
|
||||
}
|
||||
debug("******* ERROR **********\n".print_r($_POST,true));
|
||||
}
|
||||
?>
|
@ -43,28 +43,26 @@ function randomFile() {
|
||||
function readJsonFile($filename) {
|
||||
global $caSettings, $caPaths;
|
||||
|
||||
if ( $caSettings['debugging'] == "yes" )
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Read JSON file $filename\n",FILE_APPEND);
|
||||
debug("Read JSON file $filename");
|
||||
|
||||
$json = json_decode(@file_get_contents($filename),true);
|
||||
if ($caSettings['debugging'] == "yes" && ! $json) {
|
||||
if (! $json) {
|
||||
if ( ! is_file($filename) )
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." $filename not found\n",FILE_APPEND);
|
||||
debug("$filename not found");
|
||||
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." JSON Read Error ($filename)\n",FILE_APPEND);
|
||||
debug("JSON Read Error ($filename)");
|
||||
}
|
||||
return is_array($json) ? $json : array();
|
||||
}
|
||||
function writeJsonFile($filename,$jsonArray) {
|
||||
global $caSettings, $caPaths;
|
||||
|
||||
if ($caSettings['debugging'] == "yes")
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Write JSON File $filename\n",FILE_APPEND);
|
||||
debug("Write JSON File $filename");
|
||||
|
||||
$result = file_put_contents($filename,json_encode($jsonArray, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
|
||||
|
||||
if ( $caSettings['debugging'] == "true" && ! $result )
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Write error $filename\n",FILE_APPEND);
|
||||
if ( ! $result )
|
||||
debug("Write error $filename");
|
||||
|
||||
}
|
||||
function download_url($url, $path = "", $bg = false, $timeout = 45) {
|
||||
@ -91,9 +89,7 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) {
|
||||
if ( $path )
|
||||
file_put_contents($path,$out);
|
||||
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
file_put_contents($caPaths['logging'],"DOWNLOAD URL: $url\nRESULT:\n".var_dump_ret($out)."\n",FILE_APPEND);
|
||||
}
|
||||
debug("DOWNLOAD URL: $url\nRESULT:\n".var_dump_ret($out));
|
||||
return $out ?: false;
|
||||
}
|
||||
function download_json($url,$path) {
|
||||
@ -590,9 +586,7 @@ function postReturn($retArray) {
|
||||
ob_flush();
|
||||
flush();
|
||||
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." POST RETURN ({$_POST['action']})\n".var_dump_ret($retArray)."\n",FILE_APPEND);
|
||||
}
|
||||
debug("POST RETURN ({$_POST['action']})\n".var_dump_ret($retArray));
|
||||
}
|
||||
####################################
|
||||
# Translation backwards compatible #
|
||||
@ -663,18 +657,23 @@ function getAllInfo($force=false) {
|
||||
$container['template'] = $info[$container['Name']]['template'];
|
||||
}
|
||||
}
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Forced info update\n",FILE_APPEND);
|
||||
}
|
||||
debug("Forced info update");
|
||||
writeJsonFile($caPaths['info'],$containers);
|
||||
} else {
|
||||
$containers = readJsonFile($caPaths['info']);
|
||||
if ($caSettings['debugging'] == "yes") {
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Cached info update\n",FILE_APPEND);
|
||||
}
|
||||
debug("Cached info update");
|
||||
}
|
||||
return $containers;
|
||||
}
|
||||
#######################
|
||||
# Logs the debug info #
|
||||
#######################
|
||||
function debug($str) {
|
||||
global $caSettings, $caPaths;
|
||||
|
||||
if ( $caSettings['debugging'] == "yes" )
|
||||
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." $str\n",FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* @copyright Copyright 2006-2012, Miles Johnson - http://milesj.me
|
||||
|
Loading…
x
Reference in New Issue
Block a user