Skip to content

Commit

Permalink
Performance Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tiefenb authored Jun 7, 2022
1 parent 6ea181e commit 58ab758
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions batchCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@

if($result && isset($result["hits"]) && isset($result["hits"]["hits"])) {
foreach($result["hits"]["hits"] as $pageItem) {
$pageId = $pageItem["_source"]["page-id"];
$page = $pages->get($pageId, [
"lazy" => true
]);
$pageId = $sanitizer->selectorValue($pageItem["_source"]["page-id"]);
$page = $pages->getRaw("id=$pageId");

if(!$page || ($page && !$page->isPublic())) {
if(!$page || ($page && isset($page["status"]) && $page["status"] != Page::statusOn)) {
// delete from ES
$ElasticsearchFeeder->curlJsonDeleteByElasticSearchId($pageItem["_id"], $pageItem["_type"], $pageItem["_index"]);
echo "Page {$pageItem['_id']} deleted from ElasticSearch\n";
Expand All @@ -53,6 +51,9 @@
}
}

unset($result);
unset($count);

}

}
Expand Down

0 comments on commit 58ab758

Please sign in to comment.