|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://www.aimeos.com/en/license |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
namespace Aimeos\MW\Setup\Task; |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Removes locale constraints from feusers_* tables. |
|
14
|
|
|
*/ |
|
15
|
|
|
class CustomerDropLocaleConstraintsTypo3 extends \Aimeos\MW\Setup\Task\Base |
|
16
|
|
|
{ |
|
17
|
|
|
private $mysql = array( |
|
18
|
|
|
'fe_users_list_type' => array( |
|
19
|
|
|
'fk_t3feulity_siteid' => 'ALTER TABLE "fe_users_list_type" DROP FOREIGN KEY "fk_t3feulity_siteid"', |
|
20
|
|
|
), |
|
21
|
|
|
'fe_users_list' => array( |
|
22
|
|
|
'fk_t3feuli_siteid' => 'ALTER TABLE "fe_users_list" DROP FOREIGN KEY "fk_t3feuli_siteid"', |
|
23
|
|
|
), |
|
24
|
|
|
'fe_users_address' => array( |
|
25
|
|
|
'fk_t3feuad_siteid' => 'ALTER TABLE "fe_users_address" DROP FOREIGN KEY "fk_t3feuad_siteid"', |
|
26
|
|
|
'fk_t3feuad_langid' => 'ALTER TABLE "fe_users_address" DROP FOREIGN KEY "fk_t3feuad_langid"', |
|
27
|
|
|
), |
|
28
|
|
|
); |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Returns the list of task names which this task depends on. |
|
35
|
|
|
* |
|
36
|
|
|
* @return string[] List of task names |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getPreDependencies() |
|
39
|
|
|
{ |
|
40
|
|
|
return array(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Returns the list of task names which depends on this task. |
|
46
|
|
|
* |
|
47
|
|
|
* @return string[] List of task names |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getPostDependencies() |
|
50
|
|
|
{ |
|
51
|
|
|
return array( 'TablesCreateTypo3' ); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Executes the task for MySQL databases. |
|
57
|
|
|
*/ |
|
58
|
|
|
protected function mysql() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->process( $this->mysql ); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Drops local constraints. |
|
66
|
|
|
* |
|
67
|
|
|
* @param array $stmts List of SQL statements to execute for adding columns |
|
68
|
|
|
*/ |
|
69
|
|
|
protected function process( array $stmts ) |
|
70
|
|
|
{ |
|
71
|
|
|
$this->msg( 'Removing locale constraints from customer tables', 0 ); |
|
72
|
|
|
$this->status( '' ); |
|
73
|
|
|
|
|
74
|
|
|
$schema = $this->getSchema( 'db-customer' ); |
|
75
|
|
|
|
|
76
|
|
|
foreach( $stmts as $table => $list ) |
|
77
|
|
|
{ |
|
78
|
|
|
if( $schema->tableExists( $table ) === true ) |
|
79
|
|
|
{ |
|
80
|
|
|
foreach( $list as $constraint => $stmt ) |
|
81
|
|
|
{ |
|
82
|
|
|
$this->msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 ); |
|
83
|
|
|
|
|
84
|
|
|
if( $schema->constraintExists( $table, $constraint ) !== false ) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->execute( $stmt, 'db-customer' ); |
|
87
|
|
|
$this->status( 'done' ); |
|
88
|
|
|
} else { |
|
89
|
|
|
$this->status( 'OK' ); |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
} |