Preventing lib.php code from running during cron runs.

Also reworked logic so that plugin doesn't run if it isn't enabled.