Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
The Sendgrid cron does not belong in Firefly.
James Cole6f2b1a6a76b3
diff --git a/.env.example b/.env.exampleindex f8a2c2d6e0..1784ebbb83 100644--- a/.env.example+++ b/.env.example@@ -27,7 +27,4 @@ ANALYTICS_ID=RUNCLEANUP=true-SENDGRID_USERNAME=-SENDGRID_PASSWORD=-BLOCKED_DOMAINS=\ No newline at end of filediff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.phpdeleted file mode 100644index a2ecd13e04..0000000000--- a/app/Http/Controllers/CronController.php+++ /dev/null@@ -1,94 +0,0 @@-<?php--namespace FireflyIII\Http\Controllers;--use FireflyIII\User;--/**- * Class WebhookController- *- * @package FireflyIII\Http\Controllers- */-class CronController extends Controller-{- /** @var array */- protected $set = [];-- /** @var array */- protected $parameters = [];--- /**- * CronController constructor.- */- public function __construct()- {- parent::__construct();- $this->set = [- 'blocks' => 'https://api.sendgrid.com/api/blocks.get.json',- 'bounces' => 'https://api.sendgrid.com/api/bounces.get.json',- 'invalids' => 'https://api.sendgrid.com/api/invalidemails.get.json',-- ];- $this->parameters = [- 'api_user' => env('SENDGRID_USERNAME'),- 'api_key' => env('SENDGRID_PASSWORD'),- 'date' => 1,- 'days' => 7- ];-- }--- /**- * Firefly doesn't have anything that should be in the a cron job, except maybe this one, and it's fairly exceptional.- *- * If you use SendGrid like I do, you can detect bounces and thereby check if users gave an invalid address. If they did,- * it's easy to block them and change their password. Optionally, you could notify yourself about it and send them a message.- *- * But thats something not supported right now.- */- public function sendgrid()- {-- if (strlen(env('SENDGRID_USERNAME')) > 0 && strlen(env('SENDGRID_PASSWORD')) > 0) {-- echo '<pre>';- foreach ($this->set as $name => $url) {- $data = json_decode(file_get_contents($url . '?' . http_build_query($this->parameters)));- $this->processResult($name, $data);-- }- echo 'Done!' . "\n";- } else {- echo 'Please fill in SendGrid details.';- }-- }-- /**- * @param string $name- * @param array $data- */- protected function processResult($name, array $data)- {- if (is_array($data)) {- echo 'Found ' . count($data) . ' entries in the SendGrid ' . $name . ' list.' . "\n";- foreach ($data as $entry) {- $address = $entry->email;- $user = User::where('email', $address)->where('blocked', 0)->first();- if (!is_null($user)) {- echo 'Found a user: ' . $address . ', who is now blocked.' . "\n";- $user->blocked = 1;- $user->blocked_code = 'bounced';- $user->password = 'bounced';- $user->save();- } else {- echo 'Found no user: ' . $address . ', did nothing.' . "\n";- }- }-- }- }--}diff --git a/app/Http/routes.php b/app/Http/routes.phpindex 07439361ba..891e36424e 100644--- a/app/Http/routes.php+++ b/app/Http/routes.php@@ -264,7 +264,6 @@ Route::bind(* Auth\AuthController*/Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']);-Route::get('/cron/sendgrid', ['uses' => 'CronController@sendgrid']);Route::controllers([