1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Add lookups to check data

This commit is contained in:
Hillel Coren 2017-05-11 12:46:26 +03:00
parent 77bfabd386
commit a1cb870a9a

View File

@ -83,9 +83,10 @@ class CheckData extends Command
$this->checkInvitations();
$this->checkFailedJobs();
$this->checkAccountData();
$this->checkLookupData();
}
$this->logMessage('Done');
$this->logMessage('Done: ' . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
$errorEmail = env('ERROR_EMAIL');
$this->info($this->log);
@ -106,6 +107,26 @@ class CheckData extends Command
$this->log .= $str . "\n";
}
private function checkLookupData()
{
$tables = [
'account_tokens',
'accounts',
'companies',
'contacts',
'invitations',
'users',
];
foreach ($tables as $table) {
$count = DB::table('lookup_' . $table)->count();
if ($count > 0) {
$this->logMessage("Lookup table {$table} has {$count} records");
$this->isValid = false;
}
}
}
private function checkUserAccounts()
{
$userAccounts = DB::table('user_accounts')