Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2019-08-22 10:59:45 +0300
committerGitHub <noreply@github.com>2019-08-22 10:59:45 +0300
commit8d3998008e309e83d7d43fca4cb29ae1c9f67a6b (patch)
tree11db2d81ef0e04889d19d96e6c5a1c06aa1ea027
parent4007e0f8e9a01aec0bcac33dd58bf93f7523d4eb (diff)
Initialize Auth implementation in CLI commands. (#14797)
-rw-r--r--core/Console.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/Console.php b/core/Console.php
index a25d65b8da..9a2c45d6ac 100644
--- a/core/Console.php
+++ b/core/Console.php
@@ -8,12 +8,15 @@
*/
namespace Piwik;
+use Exception;
use Piwik\Application\Environment;
use Piwik\Config\ConfigNotFoundException;
use Piwik\Container\StaticContainer;
+use Piwik\Exception\AuthenticationFailedException;
use Piwik\Plugin\Manager as PluginManager;
use Piwik\Plugins\Monolog\Handler\FailureLogMessageDetector;
use Piwik\Version;
+use Psr\Log\LoggerInterface;
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
@@ -79,6 +82,8 @@ class Console extends Application
Log::warning($e->getMessage());
}
+ $this->initAuth();
+
$commands = $this->getAvailableCommands();
foreach ($commands as $command) {
@@ -260,4 +265,18 @@ class Console extends Application
}
return $commands;
}
+
+ private function initAuth()
+ {
+ Piwik::postEvent('Request.initAuthenticationObject');
+ try {
+ StaticContainer::get('Piwik\Auth');
+ } catch (Exception $e) {
+ $message = "Authentication object cannot be found in the container. Maybe the Login plugin is not activated?
+ You can activate the plugin by adding:
+ Plugins[] = Login
+ under the [Plugins] section in your config/config.ini.php";
+ StaticContainer::get(LoggerInterface::class)->warning($message);
+ }
+ }
}