Piwik\Plugins\UserCountry\LocationProvider\GeoIp::isDatabaseInstalled PHP 메소드

isDatabaseInstalled() 공개 정적인 메소드

Returns true if there is a GeoIP database in the 'misc' directory.
public static isDatabaseInstalled ( ) : boolean
리턴 boolean
    public static function isDatabaseInstalled()
    {
        return self::getPathToGeoIpDatabase(self::$dbNames['loc']) || self::getPathToGeoIpDatabase(self::$dbNames['isp']) || self::getPathToGeoIpDatabase(self::$dbNames['org']);
    }

Usage Example

예제 #1
0
파일: Controller.php 프로젝트: piwik/piwik
 public function adminIndex()
 {
     $this->dieIfGeolocationAdminIsDisabled();
     Piwik::checkUserHasSuperUserAccess();
     $view = new View('@UserCountry/adminIndex');
     $allProviderInfo = LocationProvider::getAllProviderInfo($newline = '<br/>', $includeExtra = true);
     $view->locationProviders = $allProviderInfo;
     $view->currentProviderId = LocationProvider::getCurrentProviderId();
     $view->thisIP = IP::getIpFromHeader();
     $geoIPDatabasesInstalled = GeoIp::isDatabaseInstalled();
     $view->geoIPDatabasesInstalled = $geoIPDatabasesInstalled;
     $view->updatePeriodOptions = $this->getPeriodUpdateOptions();
     // check if there is a working provider (that isn't the default one)
     $isThereWorkingProvider = false;
     foreach ($allProviderInfo as $id => $provider) {
         if ($id != DefaultProvider::ID && $provider['status'] == LocationProvider::INSTALLED) {
             $isThereWorkingProvider = true;
             break;
         }
     }
     $view->isThereWorkingProvider = $isThereWorkingProvider;
     // if using either the Apache or PECL module, they are working and there are no databases
     // in misc, then the databases are located outside of Piwik, so we cannot update them
     $view->showGeoIPUpdateSection = true;
     $currentProviderId = LocationProvider::getCurrentProviderId();
     if (!$geoIPDatabasesInstalled && ($currentProviderId == ServerBased::ID || $currentProviderId == Pecl::ID) && $allProviderInfo[$currentProviderId]['status'] == LocationProvider::INSTALLED) {
         $view->showGeoIPUpdateSection = false;
     }
     $this->setUpdaterManageVars($view);
     $this->setBasicVariablesView($view);
     $this->setBasicVariablesAdminView($view);
     return $view->render();
 }