Exemplo n.º 1
0
 function __construct($userAgentNormalizer)
 {
     $this->userAgentNormalizer = $userAgentNormalizer;
     $this->logger = WURFL_Logger_LoggerFactory::create();
     $this->undtectedDeviceLogger = WURFL_Logger_LoggerFactory::createUndetectedDeviceLogger();
     $this->persistenceProvider = WURFL_Xml_PersistenceProvider_PersistenceProviderManager::getPersistenceProvider();
 }
	private function init() {
		
		$this->_logger = WURFL_Logger_LoggerFactory::create();
		
		$this->_logger->info ( "START: WURFL LOADING PROCESS: " );
		if (! $this->isWURFLLoaded ()) {
			set_time_limit ( WURFL_Xml_XMLResourceManager::WURFL_TIMEOUT );

			$memRequired = WURFL_WURFLUtils::return_bytes ( WURFL_Xml_XMLResourceManager::WURFL_MEMORY_LIMIT );
			$memAvailable = ini_get ( 'memory_limit' );
			if ( !$memAvailable || $memAvailable < $memRequired ) {
				ini_set ( 'memory_limit', WURFL_Xml_XMLResourceManager::WURFL_MEMORY_LIMIT );
			}
			
			$wurflFile = $this->_config->wurflFile;
			$wurflFile = WURFL_Xml_Utils::getXMLFile ( $wurflFile );
			
			$devicesMap = $this->_wurflParser->parse ( $wurflFile );
			
			WURFL_Xml_WURFLConsistencyVerifier::verify ( $devicesMap);
						
			$devicesMap = $this->applyPatches ( $devicesMap );
			
			$this->_logger->info ( "START: PERSISTING DEVICES" );
			$this->updateAndSaveDataStuctures ( $devicesMap );
			$this->setWURFLLoaded ();
			$this->_logger->info ( "END: PERSISTING DEVICES" );
		}
		$this->_logger->info ( "END: WURFL LOADING PROCESS" );
	}