Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Merge requests
!139
Skripte für Check & Count hinzugefügt
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Skripte für Check & Count hinzugefügt
123-count-sh-in-gang-bringen
into
development
Overview
0
Commits
1
Pipelines
0
Changes
5
Merged
Dominik Hebeler
requested to merge
123-count-sh-in-gang-bringen
into
development
8 years ago
Overview
0
Commits
1
Pipelines
0
Changes
5
Expand
Closes
#123 (closed)
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
155cc432
1 commit,
8 years ago
5 files
+
125
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
app/Http/Controllers/AdminInterface.php
+
97
−
1
Options
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use
App\Http\Requests
;
use
Redis
;
use
Response
;
class
AdminInterface
extends
Controller
{
@@ -36,9 +37,104 @@ class AdminInterface extends Controller
}
#$data = [ 5 => "majm", 2 => "mngsn", 7 => "akljsd"];
#arsort($data);
return
view
(
'admin'
)
return
view
(
'admin
.admin
'
)
->
with
(
'data'
,
$data
)
->
with
(
'title'
,
"Admin-Interface-MetaGer"
)
->
with
(
'time'
,
$time
);
}
public
function
count
()
{
$logToday
=
date
(
"Y-m-d"
,
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
)))
.
"_mg3.log"
;
if
(
file_exists
(
"/var/log/metager/"
.
$logToday
))
{
$logToday
=
file
(
"/var/log/metager/"
.
$logToday
);
}
else
{
return
redirect
(
''
);
}
$oldLogs
=
[];
$yesterday
=
0
;
$rekordTag
=
0
;
$rekordTagDate
=
""
;
for
(
$i
=
1
;
$i
<=
28
;
$i
++
)
{
$logDate
=
"/var/log/metager/archive/"
.
date
(
"Y-m-d"
,
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"d"
)
-
$i
,
date
(
"Y"
)))
.
"_mg3.log"
;
if
(
file_exists
(
$logDate
)
)
{
$sameTime
=
exec
(
"grep -n '"
.
date
(
'H'
)
.
":"
.
date
(
'i'
)
.
":'
$logDate
| tail -1 | cut -f1 -d':'"
);
$insgesamt
=
exec
(
"wc -l
$logDate
| cut -f1 -d' '"
);
if
(
$insgesamt
>
$rekordTag
)
{
$rekordTag
=
$insgesamt
;
$rekordTagSameTime
=
$sameTime
;
$rekordTagDate
=
date
(
"d.m.Y"
,
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"d"
)
-
$i
,
date
(
"Y"
)));
}
$oldLogs
[
$i
][
'sameTime'
]
=
$sameTime
;
$oldLogs
[
$i
][
'insgesamt'
]
=
$insgesamt
;
}
}
$median
=
[];
# Median für 7 Tage:
$size
=
0
;
$count
=
0
;
for
(
$i
=
1
;
$i
<=
7
;
$i
++
)
{
$count
+=
$oldLogs
[
$i
][
'insgesamt'
];
$size
++
;
}
$median
[
7
]
=
(
$count
/
$size
);
# Median für 14 Tage:
$size
=
0
;
$count
=
0
;
for
(
$i
=
1
;
$i
<=
14
;
$i
++
)
{
$count
+=
$oldLogs
[
$i
][
'insgesamt'
];
$size
++
;
}
$median
[
14
]
=
(
$count
/
$size
);
# Median für 21 Tage:
$size
=
0
;
$count
=
0
;
for
(
$i
=
1
;
$i
<=
21
;
$i
++
)
{
$count
+=
$oldLogs
[
$i
][
'insgesamt'
];
$size
++
;
}
$median
[
21
]
=
(
$count
/
$size
);
# Median für 28 Tage:
$size
=
0
;
$count
=
0
;
for
(
$i
=
1
;
$i
<=
28
;
$i
++
)
{
$count
+=
$oldLogs
[
$i
][
'insgesamt'
];
$size
++
;
}
$median
[
28
]
=
(
$count
/
$size
);
return
view
(
'admin.count'
)
->
with
(
'title'
,
'Suchanfragen - MetaGer'
)
->
with
(
'today'
,
number_format
(
floatval
(
sizeof
(
$logToday
)),
0
,
","
,
"."
))
->
with
(
'oldLogs'
,
$oldLogs
)
->
with
(
'rekordCount'
,
number_format
(
floatval
(
$rekordTag
),
0
,
","
,
"."
))
->
with
(
'rekordTagSameTime'
,
number_format
(
floatval
(
$rekordTagSameTime
),
0
,
","
,
"."
))
->
with
(
'rekordDate'
,
$rekordTagDate
)
->
with
(
'median'
,
$median
);
}
public
function
check
()
{
$q
=
""
;
$logFile
=
"/var/log/metager/"
.
date
(
"Y-m-d"
,
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
)))
.
"_mg3.log"
;
if
(
file_exists
(
$logFile
)
)
{
$q
=
exec
(
"tail -n 1
$logFile
"
);
$q
=
substr
(
$q
,
strpos
(
$q
,
"search="
)
+
7
);
}
return
view
(
'admin.check'
)
->
with
(
'title'
,
'Wer sucht was? - MetaGer'
)
->
with
(
'q'
,
$q
);
}
}
Loading