3 namespace Friendica\Factory;
7 use Friendica\Util\BasePath;
8 use Friendica\Util\Config;
10 class DependencyFactory
13 * Setting all default-dependencies of a friendica execution
15 * @param string $channel The channel of this execution
16 * @param string $directory The base directory
17 * @param bool $isBackend True, if it's a backend execution, otherwise false (Default true)
19 * @return App The application
23 public static function setUp($channel, $directory, $isBackend = true)
25 $basePath = BasePath::create($directory, $_SERVER);
26 $mode = new App\Mode($basePath);
27 $configLoader = new Config\ConfigCacheLoader($basePath, $mode);
28 $configCache = Factory\ConfigFactory::createCache($configLoader);
29 $profiler = Factory\ProfilerFactory::create($configCache);
30 Factory\DBFactory::init($basePath, $configCache, $profiler, $_SERVER);
31 $config = Factory\ConfigFactory::createConfig($configCache);
32 // needed to call PConfig::init()
33 Factory\ConfigFactory::createPConfig($configCache);
34 $logger = Factory\LoggerFactory::create($channel, $config, $profiler);
35 Factory\LoggerFactory::createDev($channel, $config, $profiler);
37 return new App($basePath, $config, $mode, $logger, $profiler, $isBackend);