mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fixed tests, added migration stuff, added default user.
This commit is contained in:
41
app/lib/Firefly/Helper/Migration/MigrationHelper.php
Normal file
41
app/lib/Firefly/Helper/Migration/MigrationHelper.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sander
|
||||
* Date: 03/07/14
|
||||
* Time: 21:34
|
||||
*/
|
||||
|
||||
namespace Firefly\Helper\Migration;
|
||||
|
||||
|
||||
class MigrationHelper implements MigrationHelperInterface
|
||||
{
|
||||
protected $path;
|
||||
protected $JSON;
|
||||
|
||||
public function loadFile($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function validFile()
|
||||
{
|
||||
// file does not exist:
|
||||
if(!file_exists($this->path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// load the content:
|
||||
$content = file_get_contents($this->path);
|
||||
if($content === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// parse the content
|
||||
$this->JSON = json_decode($content);
|
||||
if(is_null($this->JSON)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sander
|
||||
* Date: 03/07/14
|
||||
* Time: 21:33
|
||||
*/
|
||||
|
||||
namespace Firefly\Helper\Migration;
|
||||
|
||||
|
||||
interface MigrationHelperInterface
|
||||
{
|
||||
public function loadFile($path);
|
||||
|
||||
public function validFile();
|
||||
|
||||
}
|
Reference in New Issue
Block a user