Commit 7d5d49b8 authored by Jasin's avatar Jasin

Merge branch 'development'

parents 142c1ea9 feeb74f6
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', '-g', 'typescript' ]
2 info using npm@3.5.2
3 info using node@v8.10.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData typescript
8 silly fetchNamedPackageData typescript
9 silly mapToRegistry name typescript
10 silly mapToRegistry using default registry
11 silly mapToRegistry registry https://registry.npmjs.org/
12 silly mapToRegistry uri https://registry.npmjs.org/typescript
13 verbose request uri https://registry.npmjs.org/typescript
14 verbose request no auth needed
15 info attempt registry request try #1 at 14:24:14
16 verbose request id 49cf5298c3eea295
17 http request GET https://registry.npmjs.org/typescript
18 http 200 https://registry.npmjs.org/typescript
19 verbose headers { date: 'Wed, 17 Apr 2019 12:24:26 GMT',
19 verbose headers 'content-type': 'application/json',
19 verbose headers 'transfer-encoding': 'chunked',
19 verbose headers connection: 'keep-alive',
19 verbose headers 'set-cookie':
19 verbose headers [ '__cfduid=d584e0caccaca69b6bc55440d04207cd21555503866; expires=Thu, 16-Apr-20 12:24:26 GMT; path=/; domain=.registry.npmjs.org; HttpOnly' ],
19 verbose headers 'cf-cache-status': 'HIT',
19 verbose headers 'cache-control': 'max-age=300',
19 verbose headers 'cf-ray': '4c8e603f695d9ab8-FRA',
19 verbose headers etag: 'W/"1b09eba916558801426dea39ae68cfc9"',
19 verbose headers 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
19 verbose headers 'last-modified': 'Wed, 17 Apr 2019 06:16:19 GMT',
19 verbose headers vary: 'accept-encoding, accept',
19 verbose headers 'x-amz-meta-rev': '1608-8852578e678cafde70b3c55072607d41',
19 verbose headers server: 'cloudflare',
19 verbose headers 'content-encoding': 'gzip' }
20 silly get cb [ 200,
20 silly get { date: 'Wed, 17 Apr 2019 12:24:26 GMT',
20 silly get 'content-type': 'application/json',
20 silly get 'transfer-encoding': 'chunked',
20 silly get connection: 'keep-alive',
20 silly get 'set-cookie':
20 silly get [ '__cfduid=d584e0caccaca69b6bc55440d04207cd21555503866; expires=Thu, 16-Apr-20 12:24:26 GMT; path=/; domain=.registry.npmjs.org; HttpOnly' ],
20 silly get 'cf-cache-status': 'HIT',
20 silly get 'cache-control': 'max-age=300',
20 silly get 'cf-ray': '4c8e603f695d9ab8-FRA',
20 silly get etag: 'W/"1b09eba916558801426dea39ae68cfc9"',
20 silly get 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
20 silly get 'last-modified': 'Wed, 17 Apr 2019 06:16:19 GMT',
20 silly get vary: 'accept-encoding, accept',
20 silly get 'x-amz-meta-rev': '1608-8852578e678cafde70b3c55072607d41',
20 silly get server: 'cloudflare',
20 silly get 'content-encoding': 'gzip' } ]
21 verbose get saving typescript to /home/jasin/.npm/registry.npmjs.org/typescript/.cache.json
22 silly install normalizeTree
23 silly loadCurrentTree Finishing
24 silly loadIdealTree Starting
25 silly install loadIdealTree
26 silly cloneCurrentTree Starting
27 silly install cloneCurrentTreeToIdealTree
28 silly cloneCurrentTree Finishing
29 silly loadShrinkwrap Starting
30 silly install loadShrinkwrap
31 silly loadShrinkwrap Finishing
32 silly loadAllDepsIntoIdealTree Starting
33 silly install loadAllDepsIntoIdealTree
34 silly resolveWithNewModule typescript@3.4.3 checking installable status
35 silly cache add args [ 'typescript', null ]
36 verbose cache add spec typescript
37 silly cache add parsed spec Result {
37 silly cache add raw: 'typescript',
37 silly cache add scope: null,
37 silly cache add name: 'typescript',
37 silly cache add rawSpec: '',
37 silly cache add spec: 'latest',
37 silly cache add type: 'tag' }
38 silly addNamed typescript@latest
39 verbose addNamed "latest" is being treated as a dist-tag for typescript
40 info addNameTag [ 'typescript', 'latest' ]
41 silly mapToRegistry name typescript
42 silly mapToRegistry using default registry
43 silly mapToRegistry registry https://registry.npmjs.org/
44 silly mapToRegistry uri https://registry.npmjs.org/typescript
45 verbose addNameTag registry:https://registry.npmjs.org/typescript not in flight; fetching
46 verbose get https://registry.npmjs.org/typescript not expired, no request
47 silly addNameTag next cb for typescript with tag latest
48 silly addNamed typescript@3.4.3
49 verbose addNamed "3.4.3" is a plain semver version for typescript
50 silly mapToRegistry name typescript
51 silly mapToRegistry using default registry
52 silly mapToRegistry registry https://registry.npmjs.org/
53 silly mapToRegistry uri https://registry.npmjs.org/typescript
54 verbose addRemoteTarball https://registry.npmjs.org/typescript/-/typescript-3.4.3.tgz not in flight; adding
55 verbose addRemoteTarball [ 'https://registry.npmjs.org/typescript/-/typescript-3.4.3.tgz',
55 verbose addRemoteTarball '0eb320e4ace9b10eadf5bc6103286b0f8b7c224f' ]
56 info retry fetch attempt 1 at 14:24:15
57 info attempt registry request try #1 at 14:24:15
58 http fetch GET https://registry.npmjs.org/typescript/-/typescript-3.4.3.tgz
59 http fetch 200 https://registry.npmjs.org/typescript/-/typescript-3.4.3.tgz
60 silly fetchAndShaCheck shasum 0eb320e4ace9b10eadf5bc6103286b0f8b7c224f
61 verbose addTmpTarball /tmp/npm-28449-34e116eb/registry.npmjs.org/typescript/-/typescript-3.4.3.tgz not in flight; adding
62 verbose addTmpTarball already have metadata; skipping unpack for typescript@3.4.3
63 silly cache afterAdd typescript@3.4.3
64 verbose afterAdd /home/jasin/.npm/typescript/3.4.3/package/package.json not in flight; writing
65 verbose afterAdd /home/jasin/.npm/typescript/3.4.3/package/package.json written
66 silly loadAllDepsIntoIdealTree Finishing
67 silly idealTree:prePrune lib
67 silly idealTree:prePrune └── typescript@3.4.3
68 silly loadIdealTree Finishing
69 silly currentTree lib
70 silly idealTree lib
70 silly idealTree └── typescript@3.4.3
71 silly generateActionsToTake Starting
72 silly install generateActionsToTake
73 warn checkPermissions Missing write access to /usr/local/lib
74 silly rollbackFailedOptional Starting
75 silly rollbackFailedOptional Finishing
76 silly runTopLevelLifecycles Starting
77 silly runTopLevelLifecycles Finishing
78 silly install printInstalled
79 verbose stack Error: EACCES: permission denied, access '/usr/local/lib'
80 verbose cwd /var/www/html/rnv
81 error Linux 4.15.0-47-generic
82 error argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "typescript"
83 error node v8.10.0
84 error npm v3.5.2
85 error path /usr/local/lib
86 error code EACCES
87 error errno -13
88 error syscall access
89 error Error: EACCES: permission denied, access '/usr/local/lib'
89 error { Error: EACCES: permission denied, access '/usr/local/lib'
89 error errno: -13,
89 error code: 'EACCES',
89 error syscall: 'access',
89 error path: '/usr/local/lib' }
90 error Please try running this command again as root/Administrator.
91 verbose exit [ -13, true ]
<?php
function getAllCanceledLines()
{
try
{
$config = json_decode(file_get_contents('config'));
$config = get_object_vars($config);
}
catch(Exception $e)
{
logIt(ERRORLOG, "Could not read local config file - error " . $e, __DIR__ . __FILE__);
}
$secret = null;
try
{
$secret = json_decode(file_get_contents('../../private/clientSecret'));
$secret = get_object_vars($secret);
}
catch(Exception $e)
{
logIt(ERRORLOG, "Could not read local API_KEY - error " . $e, __DIR__ . __FILE__);
}
if($secret == null)
{
logIt(ERRORLOG, "Couldn't read clientSecret", __FILE__ . __LINE__);
return 0;
}
else
{
logIt(DEBUGLOG, "Start getting Information from RNV about Canceled", __FILE__ . __LINE__);
$curl = curl_init();
curl_setopt_array($curl, array
(
CURLOPT_PORT => "8080",
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_URL => $config['RnvApiBaseURL'] . "/regions/rnv/modules/canceled/line",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
"RNV_API_TOKEN: ".$secret['RNV_API_KEY'],
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
{
logIt(ERRORLOG, "Curl Error while getting Canceled - " . $err, __FILE__ . __LINE__);
return 0;
} else
{
logIt(DEBUGLOG, "Successfully got Canceled from RNV, read them", __FILE__ . __LINE__);
$response = json_decode($response);
if($response == null || $response == "")
{
logIt(WARNINGLOG, "RNV answer was no JSON!", __FILE__ . __LINE__);
return 0;
}
else
{
var_dump($response);
return 0;
}
}
}
}
function isCancelAreadyKnown()
{
}
function saveCancel()
{
}
\ No newline at end of file
......@@ -5,14 +5,17 @@ error_reporting(E_ALL);
require_once ("LogIt.php");
require_once ("api/getAllStops.php");
require_once ("api/getOneStopMonitor.php");
//TODO: write in DB When loop starts for "Lückenlose aufzeichnung seit" section
require_once ("api/getCanceled.php");
while(1)
{
$allStops = null;
$countAllStops = 0;
//Canceled Lines Logic
//getAllCanceledLines();
//Delay Logic
try
{
$allStops = getAllStops();
......@@ -28,7 +31,7 @@ while(1)
var_dump($exception);
}
if($allStops == null ||$countAllStops <= 0)
if($allStops == null || $countAllStops <= 0)
{
logIt(ERRORLOG, "LOOP got 0 or lower stops, try to get them again", __FILE__.__LINE__);
while(1)
......
This diff is collapsed.
<?php
header('Access-Control-Allow-Origin: *');
$lineLabel = $_GET['lineLabel'];
$lineLabel = '"' . $lineLabel . '"';
if(!isset($lineLabel))
{
die("You have to give me a lineLabel via get! :(");
}
else
{
$maxValueJson = json_decode(getMaxValue($lineLabel));
$minValueJson = json_decode(getMinValue($lineLabel));
$averageValueJson = json_decode(getAverageValue($lineLabel));
$encode = array
(
'max' => $maxValueJson,
'min' => $minValueJson,
'average' => $averageValueJson
);
echo json_encode($encode);
}
function getAverageValue($lineLabel)
{
require ("db.php");
$sql = 'select CAST(created AS DATE) as "created", AVG(delay) as "average" from rnv.tours where lineLabel = ' . $lineLabel . ' group by CAST(created AS DATE) order by created desc;';
$res = mysqli_query($conn, $sql);
if ($conn->errno)
{
die ("Fehler beim lesen der Datenbank");
}
$temp = array();
while($row = $res->fetch_assoc())
{
array_push($temp, $row);
}
return (json_encode($temp[0]));
}
function getMinValue($lineLabel)
{
require ("db.php");
$sql = 'select CAST(created AS DATE) as "created", MIN(delay) as "min" from rnv.tours where lineLabel = ' . $lineLabel . ' group by CAST(created AS DATE) order by created desc;';
$res = mysqli_query($conn, $sql);
if ($conn->errno)
{
die ("Fehler beim lesen der Datenbank");
}
$temp = array();
while($row = $res->fetch_assoc())
{
array_push($temp, $row);
}
return (json_encode($temp[0]));
}
function getMaxValue($lineLabel)
{
require ("db.php");
$sql = 'select CAST(created AS DATE) as "created", MAX(delay) as "max" from rnv.tours where lineLabel = ' . $lineLabel . ' group by CAST(created AS DATE) order by created desc;';
$res = mysqli_query($conn, $sql);
if ($conn->errno)
{
die ("Fehler beim lesen der Datenbank");
}
$temp = array();
while($row = $res->fetch_assoc())
{
array_push($temp, $row);
}
return (json_encode($temp[0]));
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment