Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120835489
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/app/Console/Commands/Data/Import/OpenExchangeRatesCommand.php b/src/app/Console/Commands/Data/Import/OpenExchangeRatesCommand.php
index 8e5116b6..294f68ea 100644
--- a/src/app/Console/Commands/Data/Import/OpenExchangeRatesCommand.php
+++ b/src/app/Console/Commands/Data/Import/OpenExchangeRatesCommand.php
@@ -1,46 +1,50 @@
<?php
namespace App\Console\Commands\Data\Import;
use App\Console\Command;
class OpenExchangeRatesCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'data:import:open-exchange-rates';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetches exchangerates from openexchangerates.org';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
foreach (['CHF', 'EUR'] as $sourceCurrency) {
- $rates = \App\Backends\OpenExchangeRates::retrieveRates($sourceCurrency);
+ try {
+ $rates = \App\Backends\OpenExchangeRates::retrieveRates($sourceCurrency);
- $file = resource_path("exchangerates-$sourceCurrency.php");
+ $file = resource_path("exchangerates-$sourceCurrency.php");
- $out = "<?php return [\n";
+ $out = "<?php return [\n";
- foreach ($rates as $countryCode => $rate) {
- $out .= sprintf(" '%s' => '%s',\n", $countryCode, $rate);
- }
+ foreach ($rates as $countryCode => $rate) {
+ $out .= sprintf(" '%s' => '%s',\n", $countryCode, $rate);
+ }
- $out .= "];\n";
+ $out .= "];\n";
- file_put_contents($file, $out);
+ file_put_contents($file, $out);
+ } catch (\Exception $exception) {
+ $this->error("Failed to import $sourceCurrency: " . $exception->getMessage());
+ }
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Apr 24, 1:18 PM (3 d, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18853472
Default Alt Text
(2 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline