Example #1
0
function getContainer()
{
    static $container;
    if ($container === null) {
        $container = new Amun\Dependency\Container();
        $container->setParameter('config.file', 'configuration.php');
        $container->setParameter('user.id', USER_ID);
        $config = $container->get('config');
        $config['psx_path_cache'] = 'cache';
        $config['psx_path_library'] = 'library';
        $registry = $container->get('registry');
        $registry['core.template_dir'] = 'template/default';
    }
    return $container;
}
Example #2
0
\timport-media.php - imports all files from an specific directory into the
\tmedia table

SYNOPSIS
\timport-media.php PATH [RIGHT_ID]

DESCRIPTION
\tThis script can be used to import recursively an folder into the media 
\ttable. The user id parameter represents the user on wich behalf the
\tmedia files gets imported. Optional if set assigns all media entries to the
\tgiven right id.

USAGE;
} else {
    try {
        $container = new Amun\Dependency\Container();
        $container->setParameter('config.file', '../configuration.php');
        $container->setParameter('user.id', 1);
        // bootstrap
        PSX\Bootstrap::setupEnvironment($container->get('config'));
        $logger = new Monolog\Logger('amun');
        $logger->pushHandler(new Amun\Logger\EchoHandler(Monolog\Logger::INFO));
        $container->set('logger', $logger);
        $handler = new AmunService\Media\Handler($container);
        $handler->import($path, $rightId);
        echo 'Import successful';
        exit(0);
    } catch (\Exception $e) {
        echo 'Exception: ' . $e->getMessage() . "\n";
        exit(1);
    }