]> git.mxchange.org Git - friendica.git/blobdiff - bin/console.php
Merge remote-tracking branch 'upstream/develop' into error-handling
[friendica.git] / bin / console.php
index 27522d8554762bb0a607f21fb38d3020394cb0d4..8305176157661a4dc5f5e345d95a97d9094a2dc8 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env php
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
  *
  */
 
+use Friendica\Network\HTTPException\ForbiddenException;
+
+if (php_sapi_name() !== 'cli') {
+       header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
+       exit();
+}
+
 use Dice\Dice;
 use Psr\Log\LoggerInterface;
 
@@ -28,4 +35,6 @@ require dirname(__DIR__) . '/vendor/autoload.php';
 $dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
 $dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]);
 
+\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
+
 (new Friendica\Core\Console($dice, $argv))->execute();