protected function execute(InputInterface $input, OutputInterface $output) { $consoleLogger = ConsoleLogger::get($output); $chatManager = $this->getContainer()->get('claroline.manager.chat_manager'); $chatManager->setLogger($consoleLogger); $chatManager->isConfigured(); }
protected function execute(InputInterface $input, OutputInterface $output) { //validate the csv file... $consoleLogger = ConsoleLogger::get($output); $om = $this->getContainer()->get('claroline.persistence.object_manager'); if ($output->isDebug()) { $om->setLogger($consoleLogger)->activateLog(); $this->getContainer()->get('claroline.doctrine.debug')->setLogger($consoleLogger)->activateLog()->setDebugLevel(DoctrineDebug::DEBUG_ALL)->setVendor('Claroline'); } $file = $input->getArgument('csv_user_path'); $lines = str_getcsv(file_get_contents($file), PHP_EOL); if ($input->getOption('validate')) { $validator = $this->getContainer()->get('validator'); $constraint = new CsvUser(1); $errors = $validator->validateValue($file, $constraint); if (count($errors)) { foreach ($errors as $error) { $output->writeln("<error> {$error->getMessage()} </error>"); } throw new \Exception('The csv file is incorrect'); } } foreach ($lines as $line) { $users[] = str_getcsv($line, ';'); } $options['ignore-update'] = $input->getOption('ignore-update'); $options['single-validate'] = !$input->getOption('validate'); $userManager = $this->getContainer()->get('claroline.manager.user_manager'); $userManager->importUsers($users, false, function ($message) use($consoleLogger) { $consoleLogger->log(LogLevel::DEBUG, $message); }, [], false, $options); }
protected function execute(InputInterface $input, OutputInterface $output) { $consoleLogger = ConsoleLogger::get($output); $rightsManager = $this->getContainer()->get('claroline.manager.rights_manager'); $rightsManager->setLogger($consoleLogger); $rightsManager->checkIntegrity(); }
protected function execute(InputInterface $input, OutputInterface $output) { $consoleLogger = ConsoleLogger::get($output); $chatManager = $this->getContainer()->get('claroline.manager.chat_manager'); $chatManager->setLogger($consoleLogger); $username = $input->getArgument('user_first_name'); $user = $this->getContainer()->get('doctrine.orm.entity_manager')->getRepository('ClarolineCoreBundle:User')->findOneByUsername($username); if ($user) { $chatManager->importUser($user); } else { $chatManager->importExistingUsers(); } }
protected function execute(InputInterface $input, OutputInterface $output) { //validate the csv file... $validator = $this->getContainer()->get('validator'); $file = $input->getArgument('csv_directories_path'); $errors = $validator->validateValue($file, new CsvDirectory()); if (count($errors)) { foreach ($errors as $error) { $output->writeln("<error> {$error->getMessage()} </error>"); } throw new \Exception('The csv file is incorrect'); } $consoleLogger = ConsoleLogger::get($output); $widgetManager = $this->getContainer()->get('claroline.manager.resource_manager'); $widgetManager->setLogger($consoleLogger); $widgetManager->importDirectoriesFromCsv($file); }
protected function execute(InputInterface $input, OutputInterface $output) { $user = new User(); $user->setFirstName($input->getArgument('user_first_name')); $user->setLastName($input->getArgument('user_last_name')); $user->setUsername($input->getArgument('user_username')); $user->setPlainPassword($input->getArgument('user_password')); $email = $input->getArgument('user_email'); $email = filter_var($email, FILTER_VALIDATE_EMAIL) ? $email : $email . '@debug.net'; $user->setMail($email); if ($input->getOption('admin')) { $roleName = PlatformRoles::ADMIN; } elseif ($input->getOption('ws_creator')) { $roleName = PlatformRoles::WS_CREATOR; } else { $roleName = PlatformRoles::USER; } $userManager = $this->getContainer()->get('claroline.manager.user_manager'); $consoleLogger = ConsoleLogger::get($output); $userManager->setLogger($consoleLogger); $userManager->createUser($user, false, [$roleName]); }
protected function execute(InputInterface $input, OutputInterface $output) { $update = $input->getOption('update'); $username = $input->getArgument('owner_username'); $consoleLogger = ConsoleLogger::get($output); $om = $this->getContainer()->get('claroline.persistence.object_manager'); $om->setLogger($consoleLogger)->activateLog(); $this->getContainer()->get('claroline.doctrine.debug')->setLogger($consoleLogger)->activateLog()->setDebugLevel(DoctrineDebug::DEBUG_ALL)->setVendor('Claroline'); $user = $this->getContainer()->get('claroline.manager.user_manager')->getUserByUsername($username); $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles()); $this->getContainer()->get('security.context')->setToken($token); //validate the csv file... $validator = $this->getContainer()->get('validator'); $file = $input->getArgument('csv_workspace_path'); $lines = str_getcsv(file_get_contents($file), PHP_EOL); $constraint = new CsvWorkspace(); if ($update) { $constraint->updateMode(); } $errors = $validator->validateValue($file, $constraint); if (count($errors)) { foreach ($errors as $error) { $output->writeln("<error> {$error->getMessage()} </error>"); } throw new \Exception('The csv file is incorrect'); } foreach ($lines as $line) { if (trim($line) !== '') { $workspaces[] = str_getcsv($line, ';'); } } $workspaceManager = $this->getContainer()->get('claroline.manager.workspace_manager'); $workspaceManager->importWorkspaces($workspaces, function ($message) use($consoleLogger) { $consoleLogger->log(LogLevel::DEBUG, $message); }, $update); }
protected function execute(InputInterface $input, OutputInterface $output) { $consoleLogger = ConsoleLogger::get($output); $manager = $this->getContainer()->get($input->getArgument('service_name')); if (method_exists($manager, 'setLogger')) { $manager->setLogger($consoleLogger); } $method = $input->getArgument('method_name'); $om = $this->getContainer()->get('claroline.persistence.object_manager'); if ($input->getOption('debug_doctrine_all')) { $om->setLogger($consoleLogger)->activateLog(); $this->getContainer()->get('claroline.doctrine.debug')->setLogger($consoleLogger)->activateLog()->setDebugLevel(DoctrineDebug::DEBUG_ALL)->setVendor('Claroline'); } $this->getContainer()->get('claroline.authenticator')->authenticate($input->getArgument('owner'), null, false); $variables = $input->getArgument('parameters'); $args = array(); $class = get_class($manager); for ($i = 0; $i < count($variables); $i++) { $param = new \ReflectionParameter(array($class, $method), $i); $pclass = $param->getClass(); $args[] = $pclass ? $om->getRepository($pclass->name)->find($variables[$i]) : $variables[$i]; } call_user_func_array(array($manager, $method), $args); }