|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Joomla! Statistics Server |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved. |
|
6
|
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Joomla\StatsServer\Providers; |
|
10
|
|
|
|
|
11
|
|
|
use Joomla\DI\Container; |
|
12
|
|
|
use Joomla\DI\ServiceProviderInterface; |
|
13
|
|
|
use League\Flysystem\Adapter\Local; |
|
14
|
|
|
use League\Flysystem\Filesystem; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Flysystem service provider |
|
18
|
|
|
*/ |
|
19
|
|
|
class FlysystemServiceProvider implements ServiceProviderInterface |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Registers the service provider with a DI container. |
|
23
|
|
|
* |
|
24
|
|
|
* @param Container $container The DI container. |
|
25
|
|
|
* |
|
26
|
|
|
* @return void |
|
27
|
|
|
*/ |
|
28
|
11 |
|
public function register(Container $container): void |
|
29
|
|
|
{ |
|
30
|
11 |
|
$container->share('filesystem.migrations', [$this, 'getMigrationsFilesystemService']); |
|
31
|
11 |
|
$container->share('filesystem.snapshot', [$this, 'getSnapshotFilesystemService']); |
|
32
|
11 |
|
$container->share('filesystem.versions', [$this, 'getVersionsFilesystemService']); |
|
33
|
11 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Get the `filesystem.migrations` service |
|
37
|
|
|
* |
|
38
|
|
|
* @param Container $container The DI container. |
|
39
|
|
|
* |
|
40
|
|
|
* @return Filesystem |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getMigrationsFilesystemService(Container $container): Filesystem |
|
|
|
|
|
|
43
|
|
|
{ |
|
44
|
|
|
return new Filesystem(new Local(APPROOT . '/etc/migrations')); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Get the `filesystem.snapshot` service |
|
49
|
|
|
* |
|
50
|
|
|
* @param Container $container The DI container. |
|
51
|
|
|
* |
|
52
|
|
|
* @return Filesystem |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getSnapshotFilesystemService(Container $container): Filesystem |
|
|
|
|
|
|
55
|
|
|
{ |
|
56
|
|
|
return new Filesystem(new Local(APPROOT . '/snapshots')); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Get the `filesystem.versions` service |
|
61
|
|
|
* |
|
62
|
|
|
* @param Container $container The DI container. |
|
63
|
|
|
* |
|
64
|
|
|
* @return Filesystem |
|
65
|
|
|
*/ |
|
66
|
4 |
|
public function getVersionsFilesystemService(Container $container): Filesystem |
|
|
|
|
|
|
67
|
|
|
{ |
|
68
|
4 |
|
return new Filesystem(new Local(APPROOT . '/versions')); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.