Skip to content

Commit

Permalink
Merge pull request #489 from FitzwilliamMuseum/issue471
Browse files Browse the repository at this point in the history
Update Solr import and twitter
  • Loading branch information
portableant authored Aug 22, 2022
2 parents 7afd53a + 7519651 commit 1f392c7
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 200 deletions.
64 changes: 32 additions & 32 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
# Import to search
$schedule->call('App\Http\Controllers\solrimportController@staff')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@affiliates')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@stubs')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@news')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@directors')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@researchprojects')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@galleries')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@lookthinkdo')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@collections')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@departments')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@pressroom')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@pharospages')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@highlights')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@floor')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@governance')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@learningfiles')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@exhibitions')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@audio')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@sessions')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@shopify')->cron('5 */12 * * *');
$schedule->call('App\Http\Controllers\solrimportController@podcasts')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@podcastseries')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrimportController@mindseye')->cron('0 */5 * * *');
$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\solrImportController@staff')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@affiliates')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@stubs')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@news')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@directors')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@researchProjects')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@galleries')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@lookThinkDo')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@collections')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@departments')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@pressroom')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@pharosPages')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@highlights')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@floor')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@governance')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@learningFiles')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@exhibitions')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@audio')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@sessions')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@shopify')->cron('5 */12 * * *');
$schedule->call('App\Http\Controllers\solrImportController@podcasts')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@podcastSeries')->cron('0 */5 * * *');
$schedule->call('App\Http\Controllers\solrImportController@mindseye')->cron('0 */5 * * *');
$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 * * *');
# Import Jekyll to solr
Expand All @@ -59,18 +59,18 @@ protected function schedule(Schedule $schedule)
# Clear caches
$schedule->call('App\Http\Controllers\Controller@clearCache')->cron('6 */12 * * */1');
# Clear sessions/shopify
$schedule->call('App\Http\Controllers\solrimportController@shopifyRefresh')->cron('1 */12 * * */3');
$schedule->call('App\Http\Controllers\solrimportController@sessionsRefresh')->cron('1 */12 * * */3');
$schedule->call('App\Http\Controllers\solrImportController@shopifyRefresh')->cron('1 */12 * * */3');
$schedule->call('App\Http\Controllers\solrImportController@sessionsRefresh')->cron('1 */12 * * */3');
# Sitemap generation
$schedule->command('sitemap:generate')->daily();
# Long form
$schedule->call('App\Http\Controllers\solrimportController@longform')->weekly();
$schedule->call('App\Http\Controllers\solrImportController@longForm')->weekly();
# Spoliation
$schedule->call('App\Http\Controllers\solrimportController@spoliation')->daily();
$schedule->call('App\Http\Controllers\solrImportController@spoliation')->daily();
# True to nature
$schedule->call('App\Http\Controllers\solrimportController@ttnLabels')->weekly();
$schedule->call('App\Http\Controllers\solrimportController@ttnArtists')->weekly();
$schedule->call('App\Http\Controllers\solrimportController@viewpoints')->weekly();
$schedule->call('App\Http\Controllers\solrImportController@ttnLabels')->weekly();
$schedule->call('App\Http\Controllers\solrImportController@ttnArtists')->weekly();
$schedule->call('App\Http\Controllers\solrImportController@viewPoints')->weekly();


}
Expand Down
18 changes: 2 additions & 16 deletions app/Http/Controllers/socialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

use App\Models\CIIM;
use App\Models\Instagram;
use Cache;
use App\TwitterSearch;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use Twitter;

class socialController extends Controller
{
Expand Down Expand Up @@ -46,20 +45,7 @@ public function story(string $slug): View
*/
public function twitter(): View
{
$expiresTwitter = now()->addMinutes(360);
if (Cache::has('cache_twitter_social_list')) {
$tweets = Cache::get('cache_twitter_social_list');
} else {
$tweets = Twitter::getUserTimeline([
'screen_name' => 'fitzmuseum_uk',
'count' => 36,
'format' => 'object',
'tweet_mode' => 'extended',
'include_rts' => false,
'exclude_replies' => true
]);
Cache::put('cache_twitter_social_list', $tweets, $expiresTwitter); // 1 hour
}
$tweets = TwitterSearch::getTimeLine();
return view('social.twitter', compact('tweets'));
}

Expand Down
Loading

0 comments on commit 1f392c7

Please sign in to comment.