project-open-data/csv-to-api

Does this assume that APC is running?

waldoj opened this issue · 1 comments

DB_API::cache_get() and DB_API::cache_set() both make calls to APC without first verifying that it's actually running, but instead simply verifies that the relevant APC function exists. I'm pretty sure that this is wrong.

Imagine that APC is disabled in php.ini. The extension is then loaded (in the sense that extension_loaded('apc') would say that it is), and apc_fetch() and apc_store() would both exist, meaning that neither are reliable methods of determining whether APC is running.

As best as I can determine, the most reliable test is this:

if ( !extension_loaded('apc') OR ini_get('apc.enabled') != 1)
{
    // APC is not running
}
else
{
    // APC is running
}

There are two other possibilities, though. One is that you know more about this than I do, and I'm wrong. :) The other is that you want to require APC in order to use this, and simply haven't said so in the README, although your use of function_exists and an alternate method of gathering the data in question indicate that's probably not so.