Refactoring Logging to use Configuration
[friendica.git/.git] / index.php
1 <?php
2 /**
3  * @file index.php
4  * Friendica
5  */
6
7 use Friendica\App;
8 use Friendica\Core\Config\Cache;
9 use Friendica\Factory;
10 use Friendica\Util\BasePath;
11
12 if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
13         die('Vendor path not found. Please execute "bin/composer.phar --no-dev install" on the command line in the web root.');
14 }
15
16 require __DIR__ . '/vendor/autoload.php';
17
18 $basedir = BasePath::create(__DIR__, $_SERVER);
19 $configLoader = new Cache\ConfigCacheLoader($basedir);
20 $configCache = Factory\ConfigFactory::createCache($configLoader);
21 Factory\DBFactory::init($configCache, $_SERVER);
22 $config = Factory\ConfigFactory::createConfig($configCache);
23 // needed to call PConfig::init()
24 Factory\ConfigFactory::createPConfig($configCache);
25 $logger = Factory\LoggerFactory::create('index', $config);
26 $profiler = Factory\ProfilerFactory::create($logger, $config);
27
28 // We assume that the index.php is called by a frontend process
29 // The value is set to "true" by default in App
30 $a = new App($config, $logger, $profiler, false);
31
32 $a->runFrontend();