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
Commits
724524ef
Commit
724524ef
authored
4 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Plain Diff
Merge branch '1088-remove-taz-logging' into 'development'
Resolve "Remove Taz Logging" Closes
#1088
See merge request
!1800
parents
a6fac249
bf837b1d
No related branches found
Branches containing commit
No related tags found
3 merge requests
!1895
Development
,
!1801
Development
,
!1800
Resolve "Remove Taz Logging"
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Console/Commands/AppendLogs.php
+0
-43
0 additions, 43 deletions
app/Console/Commands/AppendLogs.php
app/Http/Controllers/StartpageController.php
+0
-15
0 additions, 15 deletions
app/Http/Controllers/StartpageController.php
with
0 additions
and
58 deletions
app/Console/Commands/AppendLogs.php
+
0
−
43
View file @
724524ef
...
...
@@ -16,7 +16,6 @@ class AppendLogs extends Command
*/
protected
$signature
=
'logs:gather'
;
const
LOGKEY
=
"metager.logs"
;
const
LOGKEYTAZ
=
"metager.tazlogs"
;
/**
* The console command description.
...
...
@@ -43,7 +42,6 @@ class AppendLogs extends Command
public
function
handle
()
{
$this
->
handleMGLogs
();
$this
->
handleTazLogs
();
}
private
function
handleMGLogs
()
...
...
@@ -76,45 +74,4 @@ class AppendLogs extends Command
Log
::
info
(
"Added "
.
sizeof
(
$elements
)
.
" lines to todays log!"
);
}
}
private
function
handleTazLogs
()
{
$redis
=
null
;
if
(
env
(
"REDIS_CACHE_DRIVER"
,
"redis"
)
===
"redis"
)
{
$redis
=
Redis
::
connection
(
'cache'
);
}
elseif
(
env
(
"REDIS_CACHE_DRIVER"
,
"redis"
)
===
"redis-sentinel"
)
{
$redis
=
RedisSentinel
::
connection
(
'cache'
);
}
if
(
$redis
===
null
)
{
Log
::
error
(
"No valid Redis Connection specified"
);
return
;
}
$elements
=
[];
$reply
=
$redis
->
pipeline
(
function
(
$pipe
)
use
(
$elements
)
{
$pipe
->
lrange
(
\App\Console\Commands\AppendLogs
::
LOGKEYTAZ
,
0
,
-
1
);
$pipe
->
del
(
\App\Console\Commands\AppendLogs
::
LOGKEYTAZ
);
});
$elements
=
$reply
[
0
];
if
(
!
is_array
(
$elements
)
||
sizeof
(
$elements
)
<=
0
)
{
return
;
}
if
(
file_put_contents
(
\App\Console\Commands\AppendLogs
::
getTazLogFile
(),
implode
(
PHP_EOL
,
$elements
)
.
PHP_EOL
,
FILE_APPEND
)
===
false
)
{
Log
::
error
(
"Konnte Log Zeile(n) nicht schreiben"
);
$redis
->
lpush
(
\App\Console\Commands\AppendLogs
::
LOGKEYTAZ
,
array_reverse
(
$elements
));
}
else
{
Log
::
info
(
"Added "
.
sizeof
(
$elements
)
.
" lines to todays TAZ log!"
);
}
}
public
static
function
getTazLogFile
()
{
$logpath
=
storage_path
(
"logs/metager/taz/"
.
date
(
"Y"
)
.
"/"
.
date
(
"m"
)
.
"/"
);
if
(
!
file_exists
(
$logpath
))
{
mkdir
(
$logpath
,
0777
,
true
);
}
$logpath
.
=
date
(
"d"
)
.
".log"
;
return
$logpath
;
}
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/StartpageController.php
+
0
−
15
View file @
724524ef
...
...
@@ -44,21 +44,6 @@ class StartpageController extends Controller
$lang
=
'all'
;
}
/**
* Logging Requests from Taz advertisement
*/
if
(
$request
->
filled
(
"key"
)
&&
$request
->
input
(
"key"
,
""
)
===
"taz"
)
{
$logEntry
=
date
(
"H:i:s"
);
$referer
=
request
()
->
headers
->
get
(
'referer'
);
$logEntry
.
=
" ref=
$referer
"
;
if
(
env
(
"REDIS_CACHE_DRIVER"
,
"redis"
)
===
"redis"
)
{
Redis
::
connection
(
'cache'
)
->
rpush
(
\App\Console\Commands\AppendLogs
::
LOGKEYTAZ
,
$logEntry
);
}
elseif
(
env
(
"REDIS_CACHE_DRIVER"
,
"redis"
)
===
"redis-sentinel"
)
{
RedisSentinel
::
connection
(
'cache'
)
->
rpush
(
\App\Console\Commands\AppendLogs
::
LOGKEYTAZ
,
$logEntry
);
}
}
return
view
(
'index'
)
->
with
(
'title'
,
trans
(
'titles.index'
))
->
with
(
'homeIcon'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment