1 | <?php |
||
23 | class AimeosCommandController extends \Neos\Flow\Cli\CommandController |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | * @Flow\InjectConfiguration(path="http.baseUri", package="Neos.Flow") |
||
28 | */ |
||
29 | protected $baseUri; |
||
30 | |||
31 | /** |
||
32 | * @var \Neos\Cache\Frontend\StringFrontend |
||
33 | */ |
||
34 | protected $cache; |
||
35 | |||
36 | /** |
||
37 | * @var \Neos\Flow\ObjectManagement\ObjectManagerInterface |
||
38 | */ |
||
39 | protected $objectManager; |
||
40 | |||
41 | |||
42 | /** |
||
43 | * Clears the content cache |
||
44 | * |
||
45 | * @param string $sites List of sites separated by a space character the jobs should be executed for, e.g. "default unittest" |
||
46 | * @return void |
||
47 | */ |
||
48 | public function cacheCommand( $sites = '' ) |
||
84 | |||
85 | |||
86 | /** |
||
87 | * Executes the Aimeos maintenance jobs |
||
88 | * |
||
89 | * The Aimeos shop system needs some maintenance tasks that must be |
||
90 | * regularly executed. These include |
||
91 | * |
||
92 | * - admin/cache (remove expired cache entries once a day) |
||
93 | * - admin/job (process import/export jobs created in the admin interface every five minutes) |
||
94 | * - admin/log (archivate and delete old log entries once a day) |
||
95 | * - customer/email/watch (send customers e-mails if their watched products have changed) |
||
96 | * - index/rebuild (rebuild the catalog index once a day after midnight) |
||
97 | * - index/optimize (optimize the catalog index once a day one hour after the rebuild) |
||
98 | * - order/cleanup/unfinished (remove unfinised orders once a day) |
||
99 | * - order/cleanup/unfinised (remove unpaid orders once a day) |
||
100 | * - order/email/delivery (send delivery status update e-mails to the customers every few hours) |
||
101 | * - order/email/payment (send payment status update e-mails to the customers every few hours) |
||
102 | * - order/service/async (import batch delivery or payment status updates if necessary) |
||
103 | * - order/service/delivery (sends paid orders to the ERP system or logistic partner) |
||
104 | * - order/service/payment (captures authorized payments after the configured amount of time automatically) |
||
105 | * - product/bought (updates the suggested products based on what other customers bought once a day) |
||
106 | * - product/export (export products) |
||
107 | * - product/export/sitemap (generate product sitemaps for search engines) |
||
108 | * - product/import/csv (import products from CSV files) |
||
109 | * |
||
110 | * Each of these maintenance tasks must be executed for all shop instances |
||
111 | * if you have more than one site in your installation. The sites parameter |
||
112 | * should contain a list of site codes in this case. If you only have one |
||
113 | * site named "default" then you don't need to specify the site. |
||
114 | * |
||
115 | * @param string $jobs List of job names separated by a space character like "admin/job catalog/index/rebuild" |
||
116 | * @param string $sites List of sites separated by a space character the jobs should be executed for, e.g. "default unittest" |
||
117 | * @return void |
||
118 | */ |
||
119 | public function jobsCommand( $jobs, $sites = 'default' ) |
||
150 | |||
151 | |||
152 | /** |
||
153 | * Initialize or update the Aimeos database tables |
||
154 | * |
||
155 | * After installing and updating the Aimeos package, the database structure |
||
156 | * must be created or upgraded to the current version. Depending on the size |
||
157 | * of the database, this may take a while. |
||
158 | * |
||
159 | * @param string $site Site for updating database entries |
||
160 | * @param string $tplsite Template site for creating or updating database entries |
||
161 | * @param array $option Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1". |
||
162 | * @param string|null $task Setup task name to execute |
||
163 | * @param string $action Setup task action, e.g. "migrate", "rollback" or "clean" |
||
164 | * @return void |
||
165 | */ |
||
166 | public function setupCommand( $site = 'default', $tplsite = 'default', array $option = array(), $task = null, $action = 'migrate' ) |
||
196 | |||
197 | |||
198 | /** |
||
199 | * Returns a context object for the jobs command |
||
200 | * |
||
201 | * @return \Aimeos\MShop\Context\Item\Standard Context object |
||
202 | */ |
||
203 | protected function getContext() |
||
227 | |||
228 | |||
229 | /** |
||
230 | * Returns the database configuration from the config object. |
||
231 | * |
||
232 | * @param \Aimeos\MW\Config\Iface $conf Config object |
||
233 | * @return array Multi-dimensional associative list of database configuration parameters |
||
234 | */ |
||
235 | protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
||
248 | |||
249 | |||
250 | /** |
||
251 | * Returns the enabled site items which may be limited by the input arguments. |
||
252 | * |
||
253 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
||
254 | * @param string $sites Unique site codes |
||
255 | * @return \Aimeos\MShop\Locale\Item\Site\Iface[] List of site items |
||
256 | */ |
||
257 | protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites ) |
||
268 | |||
269 | |||
270 | /** |
||
271 | * @param \Neos\Cache\Frontend\StringFrontend $cache |
||
272 | * @return void |
||
273 | */ |
||
274 | public function injectCache( \Neos\Cache\Frontend\StringFrontend $cache ) |
||
278 | |||
279 | |||
280 | /** |
||
281 | * @param \Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager |
||
282 | * @return void |
||
283 | */ |
||
284 | public function injectObjectManager( \Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) |
||
288 | |||
289 | |||
290 | /** |
||
291 | * Extracts the configuration options from the input object and updates the configuration values in the config object. |
||
292 | * |
||
293 | * @param \Aimeos\MW\Config\Iface $conf Configuration object |
||
294 | * @param array $options List of option key/value pairs |
||
295 | * @param array Associative list of database configurations |
||
296 | */ |
||
297 | protected function setOptions( \Aimeos\MW\Config\Iface $conf, array $options ) |
||
305 | } |
||
306 |