function adinj_activate_hook()
{
    $ops = adinj_options();
    if (empty($ops)) {
        // 1st Install.
        adinj_install_db();
    } else {
        // Upgrade check.
        adinj_upgrade_db_if_necessary();
    }
}
function adinj_upgrade_db_if_necessary()
{
    $cached_options = adinj_options();
    if (empty($cached_options)) {
        // 1st Install.
        require_once ADINJ_PATH . '/ad-injection-admin.php';
        adinj_install_db();
        return;
    }
    $cached_dbversion = adinj_db_version($cached_options);
    if (ADINJ_DB_VERSION != $cached_dbversion) {
        require_once ADINJ_PATH . '/ad-injection-admin.php';
        adinj_upgrade_db();
    }
}