Skip to content

Firefly III: a personal finances manager

Update (disabled) telemetry settings.

James Colef76585dc9bba
diff --git a/app/Console/Commands/Correction/CorrectDatabase.php b/app/Console/Commands/Correction/CorrectDatabase.php
index d2e88f4725..224ed7e5fd 100644
--- a/app/Console/Commands/Correction/CorrectDatabase.php
+++ b/app/Console/Commands/Correction/CorrectDatabase.php
@@ -82,6 +82,7 @@ class CorrectDatabase extends Command
$result = Artisan::output();
echo $result;
}
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
index 6b1fc6a04f..216a364e60 100644
--- a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
+++ b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
@@ -76,6 +76,8 @@ class CorrectOpeningBalanceCurrencies extends Command
$this->info('There was nothing to fix in the opening balance transactions.');
}
+ // app('telemetry')->feature('executed-command', $this->signature);
+
return 0;
}
diff --git a/app/Console/Commands/Correction/CreateAccessTokens.php b/app/Console/Commands/Correction/CreateAccessTokens.php
index 9dd515c17a..4c859f6d5d 100644
--- a/app/Console/Commands/Correction/CreateAccessTokens.php
+++ b/app/Console/Commands/Correction/CreateAccessTokens.php
@@ -77,6 +77,7 @@ class CreateAccessTokens extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verify access tokens in %s seconds.', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/CreateLinkTypes.php b/app/Console/Commands/Correction/CreateLinkTypes.php
index af17f45bf7..cbf2dc4ebc 100644
--- a/app/Console/Commands/Correction/CreateLinkTypes.php
+++ b/app/Console/Commands/Correction/CreateLinkTypes.php
@@ -78,6 +78,7 @@ class CreateLinkTypes extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified link types in %s seconds', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/DeleteEmptyGroups.php b/app/Console/Commands/Correction/DeleteEmptyGroups.php
index abf75ac2a7..c15c1ff0bd 100644
--- a/app/Console/Commands/Correction/DeleteEmptyGroups.php
+++ b/app/Console/Commands/Correction/DeleteEmptyGroups.php
@@ -74,6 +74,7 @@ class DeleteEmptyGroups extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified empty groups in %s seconds', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php
index 034aeb89d3..832529ef0e 100644
--- a/app/Console/Commands/Correction/DeleteEmptyJournals.php
+++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php
@@ -57,7 +57,7 @@ class DeleteEmptyJournals extends Command
{
$this->deleteUnevenJournals();
$this->deleteEmptyJournals();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
index c95007b60f..dfa5e4d96c 100644
--- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
+++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
@@ -61,7 +61,7 @@ class DeleteOrphanedTransactions extends Command
$this->deleteFromOrphanedAccounts();
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified orphans in %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.php
index f96b426eee..16e9abf641 100644
--- a/app/Console/Commands/Correction/DeleteZeroAmount.php
+++ b/app/Console/Commands/Correction/DeleteZeroAmount.php
@@ -77,6 +77,7 @@ class DeleteZeroAmount extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified zero-amount integrity in %s seconds', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php
index f31d8d102a..fbac80536c 100644
--- a/app/Console/Commands/Correction/EnableCurrencies.php
+++ b/app/Console/Commands/Correction/EnableCurrencies.php
@@ -100,6 +100,7 @@ class EnableCurrencies extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified currencies in %s seconds.', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/FixAccountTypes.php b/app/Console/Commands/Correction/FixAccountTypes.php
index 8b6bd26d8e..86ba9cb940 100644
--- a/app/Console/Commands/Correction/FixAccountTypes.php
+++ b/app/Console/Commands/Correction/FixAccountTypes.php
@@ -105,7 +105,7 @@ class FixAccountTypes extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verifying account types took %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/FixLongDescriptions.php b/app/Console/Commands/Correction/FixLongDescriptions.php
index 264c728d58..b6c44c888d 100644
--- a/app/Console/Commands/Correction/FixLongDescriptions.php
+++ b/app/Console/Commands/Correction/FixLongDescriptions.php
@@ -73,7 +73,7 @@ class FixLongDescriptions extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified all transaction group and journal title lengths in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/Correction/FixPiggies.php b/app/Console/Commands/Correction/FixPiggies.php
index fd931160a6..215d005c77 100644
--- a/app/Console/Commands/Correction/FixPiggies.php
+++ b/app/Console/Commands/Correction/FixPiggies.php
@@ -97,7 +97,7 @@ class FixPiggies extends Command
$end = round(microtime(true) - $start, 2);
$this->line(sprintf('Verified the content of %d piggy bank events in %s seconds.', $set->count(), $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/Correction/FixRecurringTransactions.php b/app/Console/Commands/Correction/FixRecurringTransactions.php
index c64039a6f8..c8f6cd0ba1 100644
--- a/app/Console/Commands/Correction/FixRecurringTransactions.php
+++ b/app/Console/Commands/Correction/FixRecurringTransactions.php
@@ -65,7 +65,7 @@ class FixRecurringTransactions extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Corrected recurring transactions %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.php
index d545d2f11e..7db74aacd7 100644
--- a/app/Console/Commands/Correction/FixUnevenAmount.php
+++ b/app/Console/Commands/Correction/FixUnevenAmount.php
@@ -74,7 +74,7 @@ class FixUnevenAmount extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified amount integrity in %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/RemoveBills.php b/app/Console/Commands/Correction/RemoveBills.php
index 5989b08f22..e387fdcd42 100644
--- a/app/Console/Commands/Correction/RemoveBills.php
+++ b/app/Console/Commands/Correction/RemoveBills.php
@@ -70,7 +70,7 @@ class RemoveBills extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified bills / journals in %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/Correction/RenameMetaFields.php b/app/Console/Commands/Correction/RenameMetaFields.php
index 0b1adad4f5..ed779d3b34 100644
--- a/app/Console/Commands/Correction/RenameMetaFields.php
+++ b/app/Console/Commands/Correction/RenameMetaFields.php
@@ -82,7 +82,7 @@ class RenameMetaFields extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Renamed meta fields in %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Correction/TransferBudgets.php b/app/Console/Commands/Correction/TransferBudgets.php
index 38b8a5684e..7631d1788e 100644
--- a/app/Console/Commands/Correction/TransferBudgets.php
+++ b/app/Console/Commands/Correction/TransferBudgets.php
@@ -73,7 +73,7 @@ class TransferBudgets extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified budget/journals in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/CreateDatabase.php b/app/Console/Commands/CreateDatabase.php
index 46cd5109ba..e6a202adeb 100644
--- a/app/Console/Commands/CreateDatabase.php
+++ b/app/Console/Commands/CreateDatabase.php
@@ -55,7 +55,6 @@ class CreateDatabase extends Command
{
if ('mysql' !== env('DB_CONNECTION')) {
$this->info(sprintf('CreateDB does not apply to "%s", skipped.', env('DB_CONNECTION')));
-
return 0;
}
// try to set up a raw connection:
@@ -69,7 +68,6 @@ class CreateDatabase extends Command
$pdo = new PDO($dsn, env('DB_USERNAME'), env('DB_PASSWORD'), $options);
} catch (PDOException $e) {
$this->error(sprintf('Error when connecting to DB: %s', $e->getMessage()));
-
return 1;
}
// with PDO, try to list DB's (
diff --git a/app/Console/Commands/DecryptDatabase.php b/app/Console/Commands/DecryptDatabase.php
index 8d90e1134b..0eced08e11 100644
--- a/app/Console/Commands/DecryptDatabase.php
+++ b/app/Console/Commands/DecryptDatabase.php
@@ -117,7 +117,7 @@ class DecryptDatabase extends Command
}
$this->info('Done!');
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php
index 6b38974478..f901274640 100644
--- a/app/Console/Commands/Export/ExportData.php
+++ b/app/Console/Commands/Export/ExportData.php
@@ -135,8 +135,10 @@ class ExportData extends Command
$this->exportData($options, $data);
} catch (FireflyException $e) {
$this->error(sprintf('Could not store data: %s', $e->getMessage()));
+ // app('telemetry')->feature('executed-command-with-error', $this->signature);
+ return 1;
}
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Import/CreateCSVImport.php b/app/Console/Commands/Import/CreateCSVImport.php
index c6390e440d..8fc7dea518 100644
--- a/app/Console/Commands/Import/CreateCSVImport.php
+++ b/app/Console/Commands/Import/CreateCSVImport.php
@@ -127,7 +127,7 @@ class CreateCSVImport extends Command
$this->processFile();
} catch (FireflyException $e) {
$this->errorLine($e->getMessage());
-
+ // app('telemetry')->feature('executed-command-with-error', $this->signature);
return 1;
}
@@ -136,7 +136,7 @@ class CreateCSVImport extends Command
$this->storeData();
} catch (FireflyException $e) {
$this->errorLine($e->getMessage());
-
+ // app('telemetry')->feature('executed-command-with-error', $this->signature);
return 1;
}
@@ -145,7 +145,7 @@ class CreateCSVImport extends Command
// clear cache for user:
app('preferences')->setForUser($user, 'lastActivity', microtime());
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Integrity/ReportEmptyObjects.php b/app/Console/Commands/Integrity/ReportEmptyObjects.php
index 4cca37288b..25cc137e72 100644
--- a/app/Console/Commands/Integrity/ReportEmptyObjects.php
+++ b/app/Console/Commands/Integrity/ReportEmptyObjects.php
@@ -63,7 +63,7 @@ class ReportEmptyObjects extends Command
$this->reportBudgetLimits();
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Report on empty objects finished in %s seconds', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Integrity/ReportIntegrity.php b/app/Console/Commands/Integrity/ReportIntegrity.php
index 62e45ed110..e4cfd70ad2 100644
--- a/app/Console/Commands/Integrity/ReportIntegrity.php
+++ b/app/Console/Commands/Integrity/ReportIntegrity.php
@@ -68,7 +68,7 @@ class ReportIntegrity extends Command
$result = Artisan::output();
echo $result;
}
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/Integrity/ReportSum.php b/app/Console/Commands/Integrity/ReportSum.php
index 2f24e1f00a..446644c3ec 100644
--- a/app/Console/Commands/Integrity/ReportSum.php
+++ b/app/Console/Commands/Integrity/ReportSum.php
@@ -53,7 +53,7 @@ class ReportSum extends Command
public function handle(): int
{
$this->reportSum();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Integrity/RestoreOAuthKeys.php b/app/Console/Commands/Integrity/RestoreOAuthKeys.php
index ec5f0d9d67..079d215fd2 100644
--- a/app/Console/Commands/Integrity/RestoreOAuthKeys.php
+++ b/app/Console/Commands/Integrity/RestoreOAuthKeys.php
@@ -50,7 +50,7 @@ class RestoreOAuthKeys extends Command
public function handle(): int
{
$this->restoreOAuthKeys();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/ScanAttachments.php b/app/Console/Commands/ScanAttachments.php
index 8ba285ff00..8cda6f68fd 100644
--- a/app/Console/Commands/ScanAttachments.php
+++ b/app/Console/Commands/ScanAttachments.php
@@ -85,7 +85,7 @@ class ScanAttachments extends Command
$attachment->save();
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
}
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
}
diff --git a/app/Console/Commands/SetLatestVersion.php b/app/Console/Commands/SetLatestVersion.php
index f18441793a..893b911941 100644
--- a/app/Console/Commands/SetLatestVersion.php
+++ b/app/Console/Commands/SetLatestVersion.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
/**
* SetLatestVersion.php
@@ -59,8 +59,7 @@ class SetLatestVersion extends Command
app('fireflyconfig')->set('ff3_version', config('firefly.version'));
$this->line('Updated version.');
- //Telemetry::string('db_version', config('firefly.db_version'));
- //Telemetry::string('ff3_version', config('firefly.version'));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php
index 419b1ec3d2..6858255607 100644
--- a/app/Console/Commands/Tools/ApplyRules.php
+++ b/app/Console/Commands/Tools/ApplyRules.php
@@ -112,6 +112,7 @@ class ApplyRules extends Command
$result = $this->verifyInput();
if (false === $result) {
+ // app('telemetry')->feature('executed-command-with-error', $this->signature);
return 1;
}
@@ -129,6 +130,8 @@ class ApplyRules extends Command
$this->warn(' --rules=1,2,...');
$this->warn(' --rule_groups=1,2,...');
$this->warn(' --all_rules');
+ // app('telemetry')->feature('executed-command-with-error', $this->signature);
+ return 1;
}
/** @var GroupCollectorInterface $collector */
@@ -162,7 +165,7 @@ class ApplyRules extends Command
}
$this->line('');
$this->line('Done!');
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php
index 31fc056f76..f6061308e6 100644
--- a/app/Console/Commands/Tools/Cron.php
+++ b/app/Console/Commands/Tools/Cron.php
@@ -93,7 +93,7 @@ class Cron extends Command
}
$this->info('More feedback on the cron jobs can be found in the log files.');
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php
index 113e1d829a..3af0086908 100644
--- a/app/Console/Commands/Upgrade/AccountCurrencies.php
+++ b/app/Console/Commands/Upgrade/AccountCurrencies.php
@@ -86,6 +86,7 @@ class AccountCurrencies extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified and fixed account currencies in %s seconds.', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php
index bc6a2aead2..a3951e7799 100644
--- a/app/Console/Commands/Upgrade/BackToJournals.php
+++ b/app/Console/Commands/Upgrade/BackToJournals.php
@@ -77,6 +77,7 @@ class BackToJournals extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Updated category and budget info for all transaction journals in %s seconds.', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
index 990b02bbf8..d85b004cea 100644
--- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
+++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
@@ -91,6 +91,7 @@ class BudgetLimitCurrency extends Command
$this->info(sprintf('Verified budget limits in %s seconds.', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/CCLiabilities.php b/app/Console/Commands/Upgrade/CCLiabilities.php
index e5904a7198..8ed8c600d2 100644
--- a/app/Console/Commands/Upgrade/CCLiabilities.php
+++ b/app/Console/Commands/Upgrade/CCLiabilities.php
@@ -90,6 +90,7 @@ class CCLiabilities extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified credit card liabilities in %s seconds', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php
index 9e2270d7d2..40107557f4 100644
--- a/app/Console/Commands/Upgrade/MigrateAttachments.php
+++ b/app/Console/Commands/Upgrade/MigrateAttachments.php
@@ -100,6 +100,7 @@ class MigrateAttachments extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Migrated attachment notes in %s seconds.', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
index a234c2948f..e61a9ee90f 100644
--- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php
+++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
@@ -99,6 +99,7 @@ class MigrateJournalNotes extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Migrated notes in %s seconds.', $end));
$this->markAsExecuted();
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
index 8ec5d2b47e..dbf678020f 100644
--- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
+++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
@@ -70,6 +70,7 @@ class MigrateRecurrenceMeta extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Migrated recurrence meta data in %s seconds.', $end));
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateTagLocations.php b/app/Console/Commands/Upgrade/MigrateTagLocations.php
index 9989e10b4e..88e9b5aefd 100644
--- a/app/Console/Commands/Upgrade/MigrateTagLocations.php
+++ b/app/Console/Commands/Upgrade/MigrateTagLocations.php
@@ -63,7 +63,7 @@ class MigrateTagLocations extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Migrated tag locations in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php
index f953b784ed..3a997e0a17 100644
--- a/app/Console/Commands/Upgrade/MigrateToGroups.php
+++ b/app/Console/Commands/Upgrade/MigrateToGroups.php
@@ -111,7 +111,7 @@ class MigrateToGroups extends Command
$this->markAsMigrated();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/MigrateToRules.php b/app/Console/Commands/Upgrade/MigrateToRules.php
index d751ffa7cd..1052079580 100644
--- a/app/Console/Commands/Upgrade/MigrateToRules.php
+++ b/app/Console/Commands/Upgrade/MigrateToRules.php
@@ -98,7 +98,7 @@ class MigrateToRules extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified and fixed bills in %s seconds.', $end));
$this->markAsExecuted();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
index 2c40887fc9..46bc609e82 100644
--- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
@@ -89,7 +89,7 @@ class OtherCurrenciesCorrections extends Command
$this->line(sprintf('Verified %d transaction(s) and journal(s).', $this->count));
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified and fixed transaction currencies in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/RenameAccountMeta.php b/app/Console/Commands/Upgrade/RenameAccountMeta.php
index 6a6e369a8d..37c5dcec12 100644
--- a/app/Console/Commands/Upgrade/RenameAccountMeta.php
+++ b/app/Console/Commands/Upgrade/RenameAccountMeta.php
@@ -90,7 +90,7 @@ class RenameAccountMeta extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Fixed account meta data in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php
index a60db0b924..d7b2718e37 100644
--- a/app/Console/Commands/Upgrade/TransactionIdentifier.php
+++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php
@@ -100,7 +100,7 @@ class TransactionIdentifier extends Command
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified and fixed transaction identifiers in %s seconds.', $end));
$this->markAsExecuted();
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
index 90023cbb92..fd6d18cf9d 100644
--- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
@@ -110,7 +110,7 @@ class TransferCurrenciesCorrections extends Command
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified and fixed currency information for transfers in %s seconds.', $end));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/Upgrade/UpgradeDatabase.php b/app/Console/Commands/Upgrade/UpgradeDatabase.php
index 9c330c9554..7501b6739d 100644
--- a/app/Console/Commands/Upgrade/UpgradeDatabase.php
+++ b/app/Console/Commands/Upgrade/UpgradeDatabase.php
@@ -116,7 +116,7 @@ class UpgradeDatabase extends Command
app('fireflyconfig')->set('db_version', (int) config('firefly.db_version'));
// index will set FF3 version.
app('fireflyconfig')->set('ff3_version', (string) config('firefly.version'));
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php
index 3cfbb15f53..99ff2575e7 100644
--- a/app/Console/Commands/UpgradeFireflyInstructions.php
+++ b/app/Console/Commands/UpgradeFireflyInstructions.php
@@ -56,7 +56,7 @@ class UpgradeFireflyInstructions extends Command
if ('install' === (string) $this->argument('task')) {
$this->installInstructions();
}
-
+ // app('telemetry')->feature('executed-command', $this->signature);
return 0;
}
@@ -102,7 +102,6 @@ class UpgradeFireflyInstructions extends Command
}
}
- // app('telemetry')->string('show-install-instructions', $version);
$this->showLine();
$this->boxed('');
@@ -151,8 +150,6 @@ class UpgradeFireflyInstructions extends Command
}
}
- //app('telemetry')->string('show-update-instructions', $version);
-
$this->showLine();
$this->boxed('');
if (null === $text) {
diff --git a/app/Models/Telemetry.php b/app/Models/Telemetry.php
index aad89e8a7e..203f467cc8 100644
--- a/app/Models/Telemetry.php
+++ b/app/Models/Telemetry.php
@@ -29,10 +29,20 @@ use Illuminate\Database\Eloquent\Model;
*/
class Telemetry extends Model
{
- /** @var string */
+ /** @var string */
protected $table = 'telemetry';
- /** @var array */
- protected $fillable = ['installation_id','submitted','user_id','key','type','value'];
+ /** @var array */
+ protected $fillable = ['installation_id', 'submitted', 'user_id', 'key', 'type', 'value'];
+ /**
+ * The attributes that should be cast to native types.
+ *
+ * @var array
+ */
+ protected $casts
+ = [
+ 'submitted' => 'datetime',
+ 'value' => 'array',
+ ];
}
\ No newline at end of file
diff --git a/app/Support/Telemetry.php b/app/Support/Telemetry.php
index 4a1a7bc114..fe458781b2 100644
--- a/app/Support/Telemetry.php
+++ b/app/Support/Telemetry.php
@@ -30,9 +30,12 @@ use Log;
class Telemetry
{
/**
- * Feature telemetry stores a boolean "true" for the given $flag.
+ * Feature telemetry stores a $value for the given $feature.
+ * Will only store the given $feature / $value combination once.
+ *
*
* Examples:
+ * - execute-cli-command [value]
* - use-help-pages
* - has-created-bill
* - do-big-import
@@ -44,18 +47,21 @@ class Telemetry
*
* Any meta-data stored is strictly non-financial.
*
- * @param string $flag
+ * @param string $key
+ * @param string $value
*/
- public function feature(string $flag): void
+ public function feature(string $key, string $value): void
{
if (false === config('firefly.send_telemetry') || false === config('firefly.feature_flags.telemetry')) {
// hard stop if not allowed to do telemetry.
// do nothing!
return;
}
- Log::info(sprintf('Logged telemetry feature flag "%s".', $flag));
- $this->storeEntry('flag', $flag, '');
+ Log::info(sprintf('Logged telemetry feature "%s" with value "%s".', $key, $value));
+ if (!$this->hasEntry('feature', $key, $value)) {
+ $this->storeEntry('feature', $key, $value);
+ }
}
/**
@@ -79,7 +85,23 @@ class Telemetry
Log::info(sprintf('Logged telemetry string "%s" with value "%s".', $name, $value));
// no storage backend yet, do nothing.
- $this->storeEntry('string', $name, json_encode($value, JSON_THROW_ON_ERROR, 512));
+ $this->storeEntry('string', $name, $value);
+ }
+
+ /**
+ * @param string $type
+ * @param string $key
+ * @param string $value
+ *
+ * @return bool
+ */
+ private function hasEntry(string $type, string $key, string $value): bool
+ {
+ return TelemetryModel
+ ::where('type', $type)
+ ->where('key', $key)
+ ->where('value', json_encode($value, JSON_THROW_ON_ERROR, 512))
+ ->count() > 0;
}
/**
diff --git a/database/migrations/2020_03_13_201950_changes_for_v520.php b/database/migrations/2020_03_13_201950_changes_for_v520.php
index ef5aa00a73..ce0720fb6f 100644
--- a/database/migrations/2020_03_13_201950_changes_for_v520.php
+++ b/database/migrations/2020_03_13_201950_changes_for_v520.php
@@ -56,8 +56,8 @@ class ChangesForV520 extends Migration
$table->dateTime('submitted')->nullable();
$table->integer('user_id', false, true)->nullable();
$table->string('installation_id', 50);
- $table->string('key', 50);
$table->string('type', 25);
+ $table->string('key', 50);
$table->text('value');
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');