Esempio n. 1
0
 /**
  * @return bool
  */
 function httpGet(Request $request, Response $response)
 {
     if (System\Collection::NAME . '/' . Node::NAME !== $request->getPath()) {
         return;
     }
     $payload = ['current_version' => SABRE_KATANA_VERSION];
     $extra = [];
     if (true === $request->hasHeader('Referer')) {
         $extra['referer'] = $request->getHeader('Referer');
     }
     $updatesDotJson = Updater::getUpdateUrl(Updater::DEFAULT_UPDATE_SERVER, $extra);
     $versions = @file_get_contents($updatesDotJson);
     if (!empty($versions)) {
         $versions = json_decode($versions, true);
         $versionsToFetch = Updater::filterVersions($versions, SABRE_KATANA_VERSION, Updater::FORMAT_PHAR);
         $payload['next_versions'] = array_keys($versionsToFetch);
     }
     $response->setHeader('Content-Type', 'application/json');
     $response->setBody(json_encode($payload));
     return false;
 }