$ocConfig, $dbConnection, $userMapping
);
-$application->add(new OCA\user_ldap\Command\ShowConfig());
+$application->add(new OCA\user_ldap\Command\ShowConfig($helper));
$application->add(new OCA\user_ldap\Command\SetConfig());
$application->add(new OCA\user_ldap\Command\TestConfig());
-$application->add(new OCA\user_ldap\Command\CreateEmptyConfig());
-$application->add(new OCA\user_ldap\Command\DeleteConfig());
+$application->add(new OCA\user_ldap\Command\CreateEmptyConfig($helper));
+$application->add(new OCA\user_ldap\Command\DeleteConfig($helper));
$application->add(new OCA\user_ldap\Command\Search($ocConfig));
$application->add(new OCA\user_ldap\Command\ShowRemnants(
$deletedUsersIndex, \OC::$server->getDateTimeFormatter())
use \OCA\user_ldap\lib\Configuration;
class CreateEmptyConfig extends Command {
+ /** @var \OCA\User_LDAP\lib\Helper */
+ protected $helper;
+
+ /**
+ * @param Helper $helper
+ */
+ public function __construct(Helper $helper) {
+ $this->helper = $helper;
+ parent::__construct();
+ }
protected function configure() {
$this
;
}
-
protected function execute(InputInterface $input, OutputInterface $output) {
$configPrefix = $this->getNewConfigurationPrefix();
$output->writeln("Created new configuration with configID '{$configPrefix}'");
}
protected function getNewConfigurationPrefix() {
- $serverConnections = Helper::getServerConfigurationPrefixes();
+ $serverConnections = $this->helper->getServerConfigurationPrefixes();
// first connection uses no prefix
if(sizeof($serverConnections) == 0) {
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
class DeleteConfig extends Command {
+ /** @var \OCA\User_LDAP\lib\Helper */
+ protected $helper;
+
+ /**
+ * @param Helper $helper
+ */
+ public function __construct(Helper $helper) {
+ $this->helper = $helper;
+ parent::__construct();
+ }
protected function configure() {
$this
protected function execute(InputInterface $input, OutputInterface $output) {
- $configPrefix = $input->getArgument('configID');;
+ $configPrefix = $input->getArgument('configID');
- $success = Helper::deleteServerConfiguration($configPrefix);
+ $success = $this->helper->deleteServerConfiguration($configPrefix);
if($success) {
$output->writeln("Deleted configuration with configID '{$configPrefix}'");
use \OCA\user_ldap\lib\Configuration;
class ShowConfig extends Command {
+ /** @var \OCA\User_LDAP\lib\Helper */
+ protected $helper;
+
+ /**
+ * @param Helper $helper
+ */
+ public function __construct(Helper $helper) {
+ $this->helper = $helper;
+ parent::__construct();
+ }
protected function configure() {
$this
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $helper = new Helper();
- $availableConfigs = $helper->getServerConfigurationPrefixes();
+ $availableConfigs = $this->helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if(!is_null($configID)) {
$configIDs[] = $configID;