public function register(Application $app)
{
// These can be called early
$app['filesystem.config'] = $app->share(function ($app) {
$fs = new Filesystem(new Local($app['resources']->getPath('config')));
$fs->setMountPoint('config');
return $fs;
});
$app['filesystem.cache'] = $app->share(function ($app) {
$fs = new Filesystem(new Local($app['resources']->getPath('cache')));
$fs->setMountPoint('cache');
return $fs;
});
$app['filesystem.themes'] = $app->share(function ($app) {
$fs = new Filesystem(new Local($app['resources']->getPath('themebase')));
$fs->setMountPoint('themes');
return $fs;
});
// Calling this before boot … all bets are off … and if Bolt breaks, you get to keep both pieces!
// @TODO :fire: this when the new configuration loading lands
$app['filesystem.theme'] = $app->share(function ($app) {
$fs = new Filesystem(new Local($app['resources']->getPath('themebase') . '/' . $app['config']->get('general/theme')));
$fs->setMountPoint('theme');
return $fs;
});
// Don't call this until boot.
$app['filesystem'] = $app->share(function ($app) {
$manager = new Manager(['bolt' => new Filesystem(new Local(__DIR__ . '/../../')), 'root' => new Filesystem(new Local($app['resources']->getPath('root'))), 'web' => new Filesystem(new Local($app['resources']->getPath('web'))), 'files' => new Filesystem(new Local($app['resources']->getPath('files'))), 'config' => $app['filesystem.config'], 'themes' => $app['filesystem.themes'], 'theme' => $app['filesystem.theme'], 'extensions' => new Filesystem(new Local($app['resources']->getPath('extensions'))), 'cache' => $app['filesystem.cache'], 'app' => new Filesystem(new Local($app['resources']->getPath('app'))), 'view' => new Filesystem(new Local($app['resources']->getPath('view'))), 'default' => new Filesystem(new Local($app['resources']->getPath('files')))], [new Plugin\HasUrl(), new Plugin\Parents(), new Plugin\ToJs(), new Plugin\Authorized($app['filepermissions']), new Plugin\ThumbnailUrl($app['url_generator.lazy'])]);
return $manager;
});
$app['filesystem.plugin.url'] = function () use($app) {
return new Plugin\AssetUrl($app['asset.packages']);
};
$app['filesystem.matcher'] = $app->share(function ($app) {
return new Matcher($app['filesystem'], $app['filesystem.matcher.mount_points']);
});
$app['filesystem.matcher.mount_points'] = ['files', 'themes', 'theme'];
}