/** * Sets the current LocationProvider type. * * Input: * Requires the 'id' query parameter to be set to the desired LocationProvider's ID. * * Output: * Nothing. */ public function setCurrentLocationProvider() { Piwik::checkUserIsSuperUser(); if ($_SERVER["REQUEST_METHOD"] == "POST") { $this->checkTokenInUrl(); $providerId = Piwik_Common::getRequestVar('id'); $provider = Piwik_UserCountry_LocationProvider::setCurrentProvider($providerId); if ($provider === false) { throw new Exception("Invalid provider ID: '{$providerId}'."); } // make sure the tracker will use the new location provider Piwik_Common::regenerateCacheGeneral(); } }