-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.php
33 lines (28 loc) · 1.04 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
use Xi\Filelib\Backend\Adapter\JsonBackendAdapter;
use Xi\Filelib\FileLibrary;
use Xi\Filelib\Plugin\RandomizeNamePlugin;
use Xi\Filelib\Storage\Adapter\Filesystem\DirectoryIdCalculator\TimeDirectoryIdCalculator;
use Xi\Filelib\Storage\Adapter\FilesystemStorageAdapter;
use Xi\Filelib\Storage\Adapter\Filesystem\PathCalculator\LegacyPathCalculator;
use Symfony\Component\EventDispatcher\EventDispatcher;
require_once __DIR__ . '/vendor/autoload.php';
$filelib = new FileLibrary(
new FilesystemStorageAdapter(
realpath(__DIR__ . '/data/private'),
new LegacyPathCalculator(new TimeDirectoryIdCalculator())
),
new JsonBackendAdapter(__DIR__ . '/filelib-example.json'),
new EventDispatcher(),
__DIR__ . '/temp'
);
/*
// Uncomment me to enable caching
$memcached = new \Memcached();
$memcached->addServer('localhost', 11211);
$filelib->createCacheFromAdapter(
new Cache(new MemcachedCacheAdapter($memcached))
);
*/
// Randomizes the name of the uploaded file every time
$filelib->addPlugin(new RandomizeNamePlugin());