/** * initializes the invoices module. * * @return void */ function invoices_init() { global $CONFIG; $CONFIG['class_path']['model'][] = __DIR__ . '/invoices/'; system_load_module("modules/zend.php"); zend_load("Zend/Pdf.php"); zend_load("pdf/Cell.php"); zend_load("pdf/pdfdocument.class.php"); if (!isset($GLOBALS['VAT_COUNTRIES'])) { WdfException::Raise("VAT_COUNTRIES not defined (invoices_init)"); } }
/** * @internal Delayed init method */ function globalcache_initialize() { global $CONFIG, $LOCALHOST; $ret = true; switch ($CONFIG['globalcache']['CACHE']) { case globalcache_CACHE_OFF: case globalcache_CACHE_APC: break; case globalcache_CACHE_EACCELERATOR: if (!isset($CONFIG['globalcache']['server'])) { $CONFIG['globalcache']['server'] = isset($LOCALHOST) ? $LOCALHOST : "localhost"; } break; case globalcache_CACHE_MEMCACHE: $GLOBALS["memcache_object"] = new Memcache(); // $GLOBALS["memcache_object"]->addServer($CONFIG['memcache']['server'], 11211); if (!isset($CONFIG['globalcache']['port'])) { $CONFIG['globalcache']['port'] = ini_get('memcache.default_port'); } if (!isset($CONFIG['globalcache']['server'])) { $CONFIG['globalcache']['server'] = 'localhost'; } $try = 1; $tries = 5; while ($try++ <= $tries) { try { if ($GLOBALS["memcache_object"]->connect($CONFIG['globalcache']['server'], $CONFIG['globalcache']['port'])) { return true; } } catch (Exception $ex) { } } if ($try >= $tries) { die("globalcache_init unable to connect to memcache server " . $CONFIG['globalcache']['server'] . ":" . $CONFIG['globalcache']['port']); } break; case globalcache_CACHE_ZEND: system_load_module("modules/zend.php"); zend_load("Zend/Cache.php"); $frontendOptions = array('automatic_serialization' => true, 'lifetime' => 3600, 'write_control' => false, 'cache_id_prefix' => $GLOBALS["globalcache_key_prefix"]); $usememcache = extension_loaded('memcache'); // do we want to store in memcache or in files if ($usememcache) { $backendOptions = array('servers' => array(array('host' => $CONFIG['globalcache']['server'], 'port' => $CONFIG['globalcache']['port'], 'persistent' => true, 'weight' => 1, 'timeout' => 5, 'retry_interval' => 15, 'status' => true)), 'read_control' => false, 'hashed_directory_level' => 2, 'automatic_cleaning_factor' => 200); $GLOBALS["zend_cache_object"] = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, $backendOptions); } else { // store data in temp files if (isset($CONFIG['model']['ado_cache'])) { $cache_dir = $CONFIG['model']['ado_cache']; } else { $cache_dir = sys_get_temp_dir() . "/" . $_SERVER["HTTP_HOST"] . "/"; } if (!is_dir($cache_dir)) { @mkdir($cache_dir); } if (!is_dir($cache_dir)) { die("globalcache temp dir not found"); } $backendOptions = array('cache_dir' => $cache_dir, 'read_control' => false, 'hashed_directory_level' => 2, 'automatic_cleaning_factor' => 200); $GLOBALS["zend_cache_object"] = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } break; case globalcache_CACHE_DB: break; } }