/** * Execute the console command. * * @return mixed */ public function fire() { if (!DebugHelpers::shouldSiteBeLive()) { $this->info('Not running because site should not be live at the moment.'); return; } $this->info('Sending ping command to any dvr bridge service servers that are being used.'); // go though all dvrLiveStreamUris, get their dvr bridge service url, and send ping to it $dvrLiveStreamUriModels = DvrLiveStreamUri::with("liveStreamUri", "mediaItemLiveStream")->get(); foreach ($dvrLiveStreamUriModels as $a) { $liveStreamUriModel = $a->liveStreamUri; $mediaItemLiveStream = $a->mediaItemLiveStream; $url = $liveStreamUriModel->uri; $this->info("Sending ping command to dvr bridge service at url \"" . $url . "\"."); $responseInfo = MediaItemLiveStream::makeDvrBridgeServiceRequest($url, "PING", intval($a->id)); if ($responseInfo["statusCode"] !== 200) { // error occurred. Remove dvrLiveStreamUri as something's wrong with it. $a->delete(); $this->info("Error occurred/response returned from ping command to dvr bridge service at url \"" . $url . "\". Removing dvr link."); } else { $this->info("Sent ping command to dvr bridge service at url \"" . $url . "\"."); } } $this->info("Finished."); }