Page 1 of 1

PHP API method to extract wurfl.zip?

Posted: Wed Jun 26, 2013 12:11 pm
by keith
Hi,

I'm working out some kinks in my deploy process. I intend to set 'allowReload(true)' since I will be updating the wurfl.zip on a regular basis. We have multiple servers in a pool that will need the persistence data to be available at once. Is there a programmatic way for me to force WURFL to extract the .zip file?

Thanks!

Re: PHP API method to extract wurfl.zip?

Posted: Thu Jun 27, 2013 1:45 pm
by keith
I think I'm just going to run something like this in a php via comand line to instantiate WURFL and force the unzip process:

Code: Select all

exec("touch wurfl.zip"); // this will change the timestamp and WURFL will assume it is new and unzip
$wurflConfig = new WURFL_Configuration_InMemoryConfig();
$wurflConfig->persistence('file', array('dir' => $persistenceDir));
$wurflConfig->wurflFile(wurfl.zip);
$wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => 36000));
$wurflConfig->matchMode('accuracy');
$wurflConfig->allowReload(true);
$wurlfManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
$wurlfManager = $wurlfManagerFactory->create();

Re: PHP API method to extract wurfl.zip?

Posted: Thu Jun 27, 2013 2:17 pm
by kamermans
As long as allowReload is enabled, the WURFL will be reloeded the next time the WURFLManager is created:

Code: Select all

$wurlfManager = $wurlfManagerFactory->create();
This means that you don't really need to touch the wurfl.zip file, since modifying it will change its timestamp, then you can run a script like the one you posted to force the reload.