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
c5890d03
Commit
c5890d03
authored
5 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
implemented stronger caching for possible spam
parent
ddb68893
No related branches found
Branches containing commit
No related tags found
1 merge request
!1445
Development
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Http/Controllers/MetaGerSearch.php
+17
-1
17 additions, 1 deletion
app/Http/Controllers/MetaGerSearch.php
config/spam.txt
+6
-0
6 additions, 0 deletions
config/spam.txt
with
23 additions
and
1 deletion
app/Http/Controllers/MetaGerSearch.php
+
17
−
1
View file @
c5890d03
...
...
@@ -16,6 +16,11 @@ class MetaGerSearch extends Controller
{
public
function
search
(
Request
$request
,
MetaGer
$metager
)
{
$spamEntries
=
[];
if
(
file_exists
(
config_path
(
'spam.txt'
)))
{
$spamEntries
=
file
(
config_path
(
'spam.txt'
));
}
$focus
=
$request
->
input
(
"focus"
,
"web"
);
if
(
$focus
===
"maps"
)
{
...
...
@@ -35,6 +40,10 @@ class MetaGerSearch extends Controller
# Nach Spezialsuchen überprüfen:
$metager
->
checkSpecialSearches
(
$request
);
if
(
Cache
::
has
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
())))
{
return
response
(
Cache
::
get
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
())));
}
# Die Quicktips als Job erstellen
$quicktips
=
$metager
->
createQuicktips
();
...
...
@@ -66,7 +75,14 @@ class MetaGerSearch extends Controller
$pipeline
->
execute
();
# Die Ausgabe erstellen:
return
$metager
->
createView
(
$quicktipResults
);
$resultpage
=
$metager
->
createView
(
$quicktipResults
);
foreach
(
$spamEntries
as
$index
=>
$entry
)
{
$entry
=
trim
(
$entry
);
if
(
preg_match
(
"/"
.
$entry
.
"/si"
,
$metager
->
getEingabe
()))
{
Cache
::
put
(
'spam.'
.
$metager
->
getFokus
()
.
"."
.
md5
(
$metager
->
getQ
()),
$resultpage
->
render
(),
1440
);
}
}
return
$resultpage
;
}
public
function
loadMore
(
Request
$request
)
...
...
This diff is collapsed.
Click to expand it.
config/spam.txt
0 → 100644
+
6
−
0
View file @
c5890d03
^[\d]{3}chan
"155chan"
^hebe chan$
^jailbait chan$
^http[s]{0,1}:\/\/[\d]{3}chan\..{2}
^susimail\s+-site:[^\s]+\s-site:
\ No newline at end of file
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