geoip_load_shared_mem

The Google Font Fix geoip load shared mem function.

Description

geoip_load_shared_mem( $file ); 

Parameters (1)

0. $file
The file.

Usage

  1. if ( !function_exists( 'geoip_load_shared_mem' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-font-fix/geo/geoip.inc.php'; 
  3.  
  4. // The file. 
  5. $file = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = geoip_load_shared_mem($file); 
  9.  

Defined (1)

The function is defined in the following location(s).

/geo/geoip.inc.php  
  1. function geoip_load_shared_mem($file) 
  2. $fp = fopen($file, "rb"); 
  3. if (!$fp) { 
  4. print "error opening $file: $php_errormsg\n"; 
  5. exit; 
  6. $s_array = fstat($fp); 
  7. $size = $s_array['size']; 
  8. if (($shmid = @shmop_open(GEOIP_SHM_KEY, "w", 0, 0))) { 
  9. shmop_delete($shmid); 
  10. shmop_close($shmid); 
  11. $shmid = shmop_open(GEOIP_SHM_KEY, "c", 0644, $size); 
  12. shmop_write($shmid, fread($fp, $size), 0); 
  13. shmop_close($shmid);