1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Batch that install plugins |
5
|
|
|
* |
6
|
|
|
* @category src |
7
|
|
|
* @package src\Batch\Controller |
8
|
|
|
* @author Judicaël Paquet <[email protected]> |
9
|
|
|
* @copyright Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93) |
10
|
|
|
* @license http://www.iscreenway.com/framework/licence.php Tout droit réservé à http://www.iscreenway.com |
11
|
|
|
* @version Release: 2.0.0 |
12
|
|
|
* @filesource https://github.com/las93/venus2 |
13
|
|
|
* @link https://github.com/las93 |
14
|
|
|
* @since 2.0.0 |
15
|
|
|
* |
16
|
|
|
* @tutorial You could launch this Batch in /bundles/ |
17
|
|
|
* php bin/console scaffolding -p [portal] |
18
|
|
|
* -p [portal] => it's the name where you want add your entities and models |
19
|
|
|
* -r [rewrite] => if we force rewrite file |
20
|
|
|
* by default, it's Batch |
21
|
|
|
*/ |
22
|
|
|
namespace Venus\src\Batch\Controller; |
23
|
|
|
|
24
|
|
|
use \Venus\src\Batch\common\Controller as Controller; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Batch that install plugins |
28
|
|
|
* |
29
|
|
|
* @category src |
30
|
|
|
* @package src\Batch\Controller |
31
|
|
|
* @author Judicaël Paquet <[email protected]> |
32
|
|
|
* @copyright Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93) |
33
|
|
|
* @license http://www.iscreenway.com/framework/licence.php Tout droit réservé à http://www.iscreenway.com |
34
|
|
|
* @version Release: 2.0.0 |
35
|
|
|
* @filesource https://github.com/las93/venus2 |
36
|
|
|
* @link https://github.com/las93 |
37
|
|
|
* @since 2.0.0 |
38
|
|
|
*/ |
39
|
|
|
class Plugin extends Controller |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* run the batch to install plugin |
43
|
|
|
* @tutorial bin/console plugin |
44
|
|
|
* |
45
|
|
|
* @access public |
46
|
|
|
* @return void |
47
|
|
|
*/ |
48
|
|
|
public function install(array $aOptions = array()) |
49
|
|
|
{ |
50
|
|
|
$sFile = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugins.conf'); |
51
|
|
|
$aPlugins = json_decode($sFile); |
52
|
|
|
|
53
|
|
|
if (isset($aOptions['p'])) { |
54
|
|
|
|
55
|
|
|
define('CREATE_PORTAL', $aOptions['p']); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
foreach ($aPlugins->list as $sPluginName) { |
59
|
|
|
|
60
|
|
|
$sClassName = 'Venus\src\plugins\\'.$sPluginName.'\Controller\\'.$sPluginName; |
61
|
|
|
$oPlugin = new $sClassName; |
62
|
|
|
$oPlugin->install($aOptions['p']); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* run the batch to create plugin |
68
|
|
|
* @tutorial bin/console plugin |
69
|
|
|
* |
70
|
|
|
* @access public |
71
|
|
|
* @param array $aOptions |
72
|
|
|
* @return void |
73
|
|
|
*/ |
74
|
|
|
public function create(array $aOptions = array()) |
75
|
|
|
{ |
76
|
|
|
$sDefaultFolder = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$aOptions['n']; |
77
|
|
|
mkdir($sDefaultFolder, 0777, true); |
78
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'conf', 0777, true); |
79
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller', 0777, true); |
80
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'data', 0777, true); |
81
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n', 0777, true); |
82
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'meta', 0777, true); |
83
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public', 0777, true); |
84
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'css', 0777, true); |
85
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'img', 0777, true); |
86
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'js', 0777, true); |
87
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'View', 0777, true); |
88
|
|
|
|
89
|
|
|
file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Db.conf', '{}'); |
90
|
|
|
file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugin.conf', '{}'); |
91
|
|
|
|
92
|
|
|
$sContent = "<?php |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Controller of the plugin ".$aOptions['n']." |
96
|
|
|
* |
97
|
|
|
* @category Venus\src |
98
|
|
|
* @package Venus\src\plugins\\".$aOptions['n']."\Controller |
99
|
|
|
* @author Judicaël Paquet <[email protected]> |
100
|
|
|
* @copyright Copyright (c) 2013-2015 PAQUET Judicaël FR Inc. (https://github.com/las93) |
101
|
|
|
* @license https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël |
102
|
|
|
* @version Release: 1.0.0 |
103
|
|
|
* @filesource https://github.com/las93/venus2 |
104
|
|
|
* @link https://github.com/las93 |
105
|
|
|
* @since 1.0 |
106
|
|
|
*/ |
107
|
|
|
namespace Venus\src\plugins\\".$aOptions['n']."\Controller; |
108
|
|
|
|
109
|
|
|
use \Venus\src\plugins\common\Controller as Controller; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Controller to test |
113
|
|
|
* |
114
|
|
|
* @category Venus\src |
115
|
|
|
* @package Venus\src\plugins\\".$aOptions['n']."\Controller |
116
|
|
|
* @author Judicaël Paquet <[email protected]> |
117
|
|
|
* @copyright Copyright (c) 2013-2015 PAQUET Judicaël FR Inc. (https://github.com/las93) |
118
|
|
|
* @license https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël |
119
|
|
|
* @version Release: 1.0.0 |
120
|
|
|
* @filesource https://github.com/las93/venus2 |
121
|
|
|
* @link https://github.com/las93 |
122
|
|
|
* @since 1.0 |
123
|
|
|
*/ |
124
|
|
|
class ".$aOptions['n']." extends Controller |
125
|
|
|
{ |
126
|
|
|
/** |
127
|
|
|
* Constructor |
128
|
|
|
* |
129
|
|
|
* @access public |
130
|
|
|
* @return object |
131
|
|
|
*/ |
132
|
|
|
public function __construct() |
133
|
|
|
{ |
134
|
|
|
parent::__construct(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* bootstrap |
139
|
|
|
* |
140
|
|
|
* @access public |
141
|
|
|
* @return void |
142
|
|
|
*/ |
143
|
|
|
public function bootstrap() |
144
|
|
|
{ |
145
|
|
|
; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* install method |
150
|
|
|
* |
151
|
|
|
* @access public |
152
|
|
|
* @return void |
153
|
|
|
*/ |
154
|
|
|
public function install() |
155
|
|
|
{ |
156
|
|
|
$this->installDb; |
|
|
|
|
157
|
|
|
} |
158
|
|
|
}"; |
159
|
|
|
|
160
|
|
|
file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller'.DIRECTORY_SEPARATOR.$aOptions['n'].'.php', $sContent); |
161
|
|
|
mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.'en_US'.DIRECTORY_SEPARATOR.'LC_MESSAGES', 0777, true); |
162
|
|
|
file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'LICENSE.md', ''); |
163
|
|
|
file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'README.md', ''); |
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.