}
    } else {
        foreach (array_keys($config) as $key) {
            if (isset($_GET[$key])) {
                $config[$key] = $_GET[$key];
            }
        }
    }
    return $config;
}
$config = getParams();
// if requested, clear the lock
if ($config['fix-lock']) {
    if (Lock::release('process_mail_queue')) {
        echo "The lock file was removed successfully.\n";
    }
    exit(0);
}
if (!Lock::acquire('process_mail_queue')) {
    $pid = Lock::getProcessID('process_mail_queue');
    fwrite(STDERR, "ERROR: There is already a process (pid={$pid}) of this script running.");
    fwrite(STDERR, "If this is not accurate, you may fix it by running this script with '--fix-lock' as the only parameter.\n");
    exit(1);
}
// handle only pending emails
$limit = 50;
Mail_Queue::send('pending', $limit);
// handle emails that we tried to send before, but an error happened...
$limit = 50;
Mail_Queue::send('error', $limit);
Lock::release('process_mail_queue');