Completed
Push — 2018.07 ( 98f507...d6406c )
by Aimeos
09:16 queued 06:49
created

getPreDependencies()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018
6
 */
7
8
9
namespace Aimeos\MW\Setup\Task;
10
11
12
/**
13
 * Removes address and list records without user entry
14
 */
15
class CustomerRemoveLostUserDataTypo3 extends \Aimeos\MW\Setup\Task\Base
16
{
17
	private $sql = [
18
		'address' => 'DELETE FROM "fe_users_address" WHERE NOT EXISTS ( SELECT "uid" FROM "fe_users" AS u WHERE "parentid"=u."uid" )',
19
		'list' => 'DELETE FROM "fe_users_list" WHERE NOT EXISTS ( SELECT "uid" FROM "fe_users" AS u WHERE "parentid"=u."uid" )',
20
	];
21
22
23
	/**
24
	 * Returns the list of task names which this task depends on.
25
	 *
26
	 * @return array List of task names
27
	 */
28
	public function getPreDependencies()
29
	{
30
		return [];
31
	}
32
33
34
	/**
35
	 * Returns the list of task names which depends on this task.
36
	 *
37
	 * @return string[] List of task names
38
	 */
39
	public function getPostDependencies()
40
	{
41
		return array( 'TablesCreateMShop' );
42
	}
43
44
45
	/**
46
	 * Migrate database schema
47
	 */
48
	public function migrate()
49
	{
50
		$this->msg( 'Remove left over TYPO3 fe_users address records', 0 );
51
52
		if( $this->schema->tableExists( 'fe_users' ) && $this->schema->tableExists( 'fe_users_address' ) )
0 ignored issues
show
Deprecated Code introduced by
The property Aimeos\MW\Setup\Task\Base::$schema has been deprecated with message: Use getSchema() instead

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
53
		{
54
			$this->execute( $this->sql['address'] );
55
			$this->status( 'done' );
56
		}
57
		else
58
		{
59
			$this->status( 'OK' );
60
		}
61
62
63
		$this->msg( 'Remove left over TYPO3 fe_users list records', 0 );
64
65
		if( $this->schema->tableExists( 'fe_users' ) && $this->schema->tableExists( 'fe_users_list' ) )
0 ignored issues
show
Deprecated Code introduced by
The property Aimeos\MW\Setup\Task\Base::$schema has been deprecated with message: Use getSchema() instead

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
66
		{
67
			$this->execute( $this->sql['list'] );
68
			$this->status( 'done' );
69
		}
70
		else
71
		{
72
			$this->status( 'OK' );
73
		}
74
	}
75
}
76