|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2011 |
|
6
|
|
|
* @copyright Aimeos (aimeos.org), 2014 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace Aimeos\MW\Setup\Task; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Adds default records to tables. |
|
15
|
|
|
*/ |
|
16
|
|
|
class TablesAddTypo3TestData extends \Aimeos\MW\Setup\Task\Base |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Returns the list of task names which this task depends on. |
|
20
|
|
|
* |
|
21
|
|
|
* @return array List of task names |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getPreDependencies() |
|
24
|
|
|
{ |
|
25
|
|
|
return array( 'TablesCreateTypo3' ); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Returns the list of task names which depends on this task. |
|
31
|
|
|
* |
|
32
|
|
|
* @return array List of task names |
|
33
|
|
|
*/ |
|
34
|
|
|
public function getPostDependencies() |
|
35
|
|
|
{ |
|
36
|
|
|
return array(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Executes the task for MySQL databases. |
|
42
|
|
|
*/ |
|
43
|
|
|
protected function mysql() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->msg('Setting up Aimeos TYPO3 test data', 0); |
|
46
|
|
|
$this->status(''); |
|
47
|
|
|
|
|
48
|
|
|
$file = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'mysql.sql'; |
|
49
|
|
|
$this->process( $file ); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Insert records from file containing the SQL records. |
|
55
|
|
|
* |
|
56
|
|
|
* @param string $filename Name of the file |
|
57
|
|
|
*/ |
|
58
|
|
|
protected function process( $filename ) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->msg(sprintf('Adding records from "%1$s"', basename($filename)), 1); |
|
61
|
|
|
|
|
62
|
|
|
if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
63
|
|
|
throw new \Aimeos\MW\Setup\Exception( sprintf( 'Unable to get content from file "%1$s"', $filename ) ); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
$this->execute( $content ); |
|
67
|
|
|
$this->status( 'done' ); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
} |