original_string: public function updateGeoIPLinks()
      {
          $this->dieIfGeolocationAdminIsDisabled();
          Piwik::checkUserHasSuperUserAccess();
          if ($_SERVER["REQUEST_METHOD"] == "POST") {
              Json::sendHeaderJSON();
              try {
                  $this->checkTokenInUrl();
  
                  if ($this->isGeoIp2Enabled()) {
                      GeoIP2AutoUpdater::setUpdaterOptionsFromUrl();
                  } else {
                      GeoIPAutoUpdater::setUpdaterOptionsFromUrl();
                  }
  
                  // if there is a updater URL for a database, but its missing from the misc dir, tell
                  // the browser so it can download it next
                  $info = $this->getNextMissingDbUrlInfo();
                  if ($info !== false) {
                      return json_encode($info);
                  } else {
                      $view = new View("@UserCountry/_updaterNextRunTime");
                      if ($this->isGeoIp2Enabled()) {
                          $view->nextRunTime = GeoIP2AutoUpdater::getNextRunTime();
                      } else {
                          $view->nextRunTime = GeoIPAutoUpdater::getNextRunTime();
                      }
                      $nextRunTimeHtml = $view->render();
                      return json_encode(array('nextRunTime' => $nextRunTimeHtml));
                  }
              } catch (Exception $ex) {
                  return json_encode(array('error' => $ex->getMessage()));
              }
          }
      }
code: public function updateGeoIPLinks()
      {
          $this->dieIfGeolocationAdminIsDisabled();
          Piwik::checkUserHasSuperUserAccess();
          if ($_SERVER["REQUEST_METHOD"] == "POST") {
              Json::sendHeaderJSON();
              try {
                  $this->checkTokenInUrl();
  
                  if ($this->isGeoIp2Enabled()) {
                      GeoIP2AutoUpdater::setUpdaterOptionsFromUrl();
                  } else {
                      GeoIPAutoUpdater::setUpdaterOptionsFromUrl();
                  }
  
                  // if there is a updater URL for a database, but its missing from the misc dir, tell
                  // the browser so it can download it next
                  $info = $this->getNextMissingDbUrlInfo();
                  if ($info !== false) {
                      return json_encode($info);
                  } else {
                      $view = new View("@UserCountry/_updaterNextRunTime");
                      if ($this->isGeoIp2Enabled()) {
                          $view->nextRunTime = GeoIP2AutoUpdater::getNextRunTime();
                      } else {
                          $view->nextRunTime = GeoIPAutoUpdater::getNextRunTime();
                      }
                      $nextRunTimeHtml = $view->render();
                      return json_encode(array('nextRunTime' => $nextRunTimeHtml));
                  }
              } catch (Exception $ex) {
                  return json_encode(array('error' => $ex->getMessage()));
              }
          }
      }
code_tokens: public function updateGeoIPLinks ( ) { $ this -> dieIfGeolocationAdminIsDisabled ( ) ; Piwik :: checkUserHasSuperUserAccess ( ) ; if ( $ _SERVER [ "REQUEST_METHOD" ] == "POST" ) { Json :: sendHeaderJSON ( ) ; try { $ this -> checkTokenInUrl ( ) ; if ( $ this -> isGeoIp2Enabled ( ) ) { GeoIP2AutoUpdater :: setUpdaterOptionsFromUrl ( ) ; } else { GeoIPAutoUpdater :: setUpdaterOptionsFromUrl ( ) ; } // if there is a updater URL for a database, but its missing from the misc dir, tell // the browser so it can download it next $ info = $ this -> getNextMissingDbUrlInfo ( ) ; if ( $ info !== false ) { return json_encode ( $ info ) ; } else { $ view = new View ( "@UserCountry/_updaterNextRunTime" ) ; if ( $ this -> isGeoIp2Enabled ( ) ) { $ view -> nextRunTime = GeoIP2AutoUpdater :: getNextRunTime ( ) ; } else { $ view -> nextRunTime = GeoIPAutoUpdater :: getNextRunTime ( ) ; } $ nextRunTimeHtml = $ view -> render ( ) ; return json_encode ( array ( 'nextRunTime' => $ nextRunTimeHtml ) ) ; } } catch ( Exception $ ex ) { return json_encode ( array ( 'error' => $ ex -> getMessage ( ) ) ) ; } } }
docstring: Sets the URLs used to download new versions of the installed GeoIP databases.
  
  Input (query params):
  'loc_db' - URL for a GeoIP location database.
  'isp_db' - URL for a GeoIP ISP database (optional).
  'org_db' - URL for a GeoIP Org database (optional).
  'period' - 'weekly' or 'monthly'. Determines how often update is run.
  
  Output (json):
  'error' - if an error occurs its message is set as the resulting JSON object's
  'error' property.
docstring_tokens: Sets the URLs used to download new versions of the installed GeoIP databases .