Beispiel #1
0
<?php

/**
 * defines useful DI parameters
 *
 * @author Petr Pliska <*****@*****.**>
 */
return ['app.dir' => __DIR__ . '/../../', 'log.dir' => DI\string('{app.dir}../log/'), 'temp.dir' => DI\string('{app.dir}../temp/'), 'files.dir' => DI\string('{app.dir}../files/'), 'config.dir' => DI\string('{app.dir}_config/'), 'templates.dir' => DI\string('{app.dir}_templates/')];
Beispiel #2
0
use Interop\Container\ContainerInterface;
use Interop\Container\Exception\NotFoundException;
use Piwik\Cache\Eager;
use Piwik\SettingsServer;
return array('path.root' => PIWIK_USER_PATH, 'path.tmp' => function (ContainerInterface $c) {
    $root = $c->get('path.root');
    // TODO remove that special case and instead have plugins override 'path.tmp' to add the instance id
    if ($c->has('ini.General.instance_id')) {
        $instanceId = $c->get('ini.General.instance_id');
        $instanceId = $instanceId ? '/' . $instanceId : '';
    } else {
        $instanceId = '';
    }
    return $root . '/tmp' . $instanceId;
}, 'path.cache' => DI\string('{path.tmp}/cache/tracker/'), 'Piwik\\Cache\\Eager' => function (ContainerInterface $c) {
    $backend = $c->get('Piwik\\Cache\\Backend');
    $cacheId = $c->get('cache.eager.cache_id');
    if (SettingsServer::isTrackerApiRequest()) {
        $eventToPersist = 'Tracker.end';
        $cacheId .= 'tracker';
    } else {
        $eventToPersist = 'Request.dispatch.end';
        $cacheId .= 'ui';
    }
    $cache = new Eager($backend, $cacheId);
    \Piwik\Piwik::addAction($eventToPersist, function () use($cache) {
        $cache->persistCacheIfNeeded(43200);
    });
    return $cache;
}, 'Piwik\\Cache\\Backend' => function (ContainerInterface $c) {