1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @name OpenImporter |
4
|
|
|
* @copyright OpenImporter contributors |
5
|
|
|
* @license BSD https://opensource.org/licenses/BSD-3-Clause |
6
|
|
|
* |
7
|
|
|
* @version 1.0 |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace OpenImporter; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Configurator |
14
|
|
|
* |
15
|
|
|
* The configurator is used to hold common configuration information |
16
|
|
|
* such as the paths (to/from), prefixes, etc. |
17
|
|
|
* Basically a generic getter/setter |
18
|
|
|
* |
19
|
|
|
* @class Configurator |
20
|
|
|
*/ |
21
|
|
|
class Configurator |
22
|
|
|
{ |
23
|
|
|
/** @var mixed|null via magic */ |
24
|
|
|
public $source; |
25
|
|
|
|
26
|
|
|
/** @var mixed|null via magic */ |
27
|
|
|
public $destination; |
28
|
|
|
|
29
|
|
|
/** @var string (via magic) The table prefix for our destination database */ |
30
|
|
|
public $to_prefix; |
31
|
|
|
|
32
|
|
|
/** @var string (via magic) The table prefix for our source database */ |
33
|
|
|
public $from_prefix; |
34
|
|
|
|
35
|
|
|
/** @var string The path to the source forum. */ |
36
|
|
|
public $path_from; |
37
|
|
|
|
38
|
|
|
/** @var string The path to the destination forum. */ |
39
|
|
|
public $path_to; |
40
|
|
|
|
41
|
|
|
/** @var string (via magic) The script recipe we are using */ |
42
|
|
|
public $script; |
43
|
|
|
|
44
|
|
|
/** @var string (via magic, see import.php) */ |
45
|
|
|
public $lang_dir; |
46
|
|
|
|
47
|
|
|
/** @var int (via magic, see importer.php) */ |
48
|
|
|
public $step; |
49
|
|
|
|
50
|
|
|
/** @var int (via magic, see importer.php) */ |
51
|
|
|
public $start; |
52
|
|
|
|
53
|
|
|
/** @var string (via magic, see importer.php) */ |
54
|
|
|
public $boardurl; |
55
|
|
|
|
56
|
|
|
/** @var array */ |
57
|
|
|
protected $data = array(); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Gets a data value via "magic" method |
61
|
|
|
* |
62
|
|
|
* @param string $key |
63
|
|
|
* |
64
|
|
|
* @return mixed|null |
65
|
|
|
*/ |
66
|
|
|
public function __get($key) |
67
|
|
|
{ |
68
|
|
|
return $this->data[$key] ?? null; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Sets a data value via "magic" method |
73
|
|
|
* |
74
|
|
|
* @param string $key |
75
|
|
|
* @param string $val |
76
|
|
|
*/ |
77
|
|
|
public function __set($key, $val) |
78
|
|
|
{ |
79
|
|
|
$this->data[$key] = $val; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Checks if a value is et |
84
|
|
|
* |
85
|
|
|
* @param string $key |
86
|
|
|
* |
87
|
|
|
* @return bool |
88
|
|
|
*/ |
89
|
|
|
public function __isset($key) |
90
|
|
|
{ |
91
|
|
|
return isset($this->data[$key]); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|