Skip to content

Commit

Permalink
Merge pull request #693 from FitzwilliamMuseum/hotfix/social-media-se…
Browse files Browse the repository at this point in the history
…arch

Add twitterPurge and instagramPurge to importController
  • Loading branch information
JamieC24 authored Jun 20, 2024
2 parents c373ff8 + 76d57e5 commit 56ab429
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function solrTasks(Schedule $schedule)
$schedule->call('App\Http\Controllers\solrImportController@vacancies')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@resources')->cron('0 */5 * * *');
// $schedule->call('App\Http\Controllers\instagramController@instagram')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\twitterController@twitter')->cron('0 */5 * * *');
// $schedule->call('App\Http\Controllers\twitterController@twitter')->cron('0 */5 * * *');
# Import Jekyll to solr
$schedule->call('App\Http\Controllers\jekyllController@import')->cron('0 */5 * * *');
# Import WordPress to solr
Expand Down
26 changes: 26 additions & 0 deletions app/Http/Controllers/solrImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,32 @@ public function shopifyRefresh(): Result|ResultInterface
return $client->update($delete);
}

/**
* @return ResultInterface|Result
*/
public function twitterPurge(): Result|ResultInterface
{
$configSolr = Config::get('solarium');
$client = new Client(new Curl(), new EventDispatcher(), $configSolr);
$delete = $client->createUpdate();
$delete->addDeleteQuery('contentType:twitter');
$delete->addCommit();
return $client->update($delete);
}

/**
* @return ResultInterface|Result
*/
public function instagramPurge(): Result|ResultInterface
{
$configSolr = Config::get('solarium');
$client = new Client(new Curl(), new EventDispatcher(), $configSolr);
$delete = $client->createUpdate();
$delete->addDeleteQuery('contentType:instagram');
$delete->addCommit();
return $client->update($delete);
}

/**
* @return ResultInterface|Result
*/
Expand Down

0 comments on commit 56ab429

Please sign in to comment.