This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin): add option to clear all cached URLs by domain/w
- Loading branch information
1 parent
69d8486
commit 2164593
Showing
6 changed files
with
144 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$domain = get_input('domain'); | ||
if (!$domain) { | ||
return elgg_ok_response(); | ||
} | ||
|
||
$svc = \hypeJunction\Scraper\ScraperService::getInstance(); | ||
$urls = $svc->find($domain); | ||
|
||
foreach ($urls as $url) { | ||
$svc->delete($url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
$domain = get_input('domain'); | ||
|
||
echo elgg_view_form('admin/scraper/cache', [ | ||
'method' => 'GET', | ||
'action' => current_page_url(), | ||
'disable_security' => true, | ||
], [ | ||
'domain' => $domain, | ||
]); | ||
|
||
if (!$domain) { | ||
return; | ||
} | ||
|
||
$svc = \hypeJunction\Scraper\ScraperService::getInstance(); | ||
$urls = $svc->find($domain); | ||
if (empty($urls)) { | ||
echo elgg_format_element('p', [ | ||
'class' => 'elgg-no-results', | ||
], elgg_echo('admin:scraper:cache:no_results')); | ||
|
||
return; | ||
} | ||
|
||
foreach ($urls as $url) { | ||
$card = elgg_view('output/card', [ | ||
'href' => $url, | ||
]); | ||
echo elgg_format_element('div', [], $card); | ||
} | ||
|
||
echo elgg_view('output/url', [ | ||
'class' => 'elgg-button elgg-button-delete', | ||
'text' => elgg_echo('admin:scraper:cache:clear'), | ||
'href' => elgg_http_add_url_query_elements('action/admin/scraper/clear', [ | ||
'domain' => $domain, | ||
]), | ||
'is_action' => true, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
echo elgg_view_field([ | ||
'#type' => 'text', | ||
'#label' => elgg_echo('admin:scraper:cache:domain'), | ||
'name' => 'domain', | ||
'value' => get_input('domain'), | ||
]); | ||
|
||
$footer = elgg_view_field([ | ||
'#type' => 'submit', | ||
'value' => elgg_echo('admin:scraper:cache:find'), | ||
]); | ||
|
||
elgg_set_form_footer($footer); |