mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-22 22:43:20 -06:00
41 lines
1000 B
PHP
41 lines
1000 B
PHP
<?php
|
|
|
|
use Firefly\Helper\Migration\MigrationHelperInterface as MHI;
|
|
|
|
class MigrationController extends BaseController
|
|
{
|
|
protected $migration;
|
|
|
|
public function __construct(MHI $migration)
|
|
{
|
|
$this->migration = $migration;
|
|
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return View::make('migrate.index');
|
|
}
|
|
|
|
public function postIndex()
|
|
{
|
|
// @codeCoverageIgnoreStart
|
|
if (Input::hasFile('exportFile')) {
|
|
|
|
// get content:
|
|
$file = Input::file('exportFile');
|
|
$path = $file->getRealPath();
|
|
|
|
$this->migration->loadFile($path);
|
|
|
|
if (!$this->migration->validFile()) {
|
|
return View::make('error')->with('message', 'Invalid JSON content.');
|
|
}
|
|
$this->migration->migrate();
|
|
return Redirect::route('index');
|
|
} else {
|
|
return View::make('error')->with('message', 'No file selected');
|
|
}
|
|
// @codeCoverageIgnoreEnd
|
|
}
|
|
} |