]> source.dussan.org Git - nextcloud-server.git/commitdiff
inject IDateTimeFormatter to show-remnants command
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 6 Jan 2015 22:40:00 +0000 (23:40 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Tue, 6 Jan 2015 22:40:00 +0000 (23:40 +0100)
apps/user_ldap/appinfo/register_command.php
apps/user_ldap/command/showremnants.php

index 6abfd699c90ca2361b3d074de9b065d92445970c..651e6a564e1ccfb16811d63b7f6528dd4730cd7a 100644 (file)
@@ -31,7 +31,9 @@ $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\Search($ocConfig));
-$application->add(new OCA\user_ldap\Command\ShowRemnants($deletedUsersIndex));
+$application->add(new OCA\user_ldap\Command\ShowRemnants(
+       $deletedUsersIndex, \OC::$server->getDateTimeFormatter())
+);
 $application->add(new OCA\user_ldap\Command\CheckUser(
        $uBackend, $helper, $deletedUsersIndex, $userMapping)
 );
index ab78cee96e70a71b06a2efebe88a0b40542f98d7..5b7322e7711ba9e1ee20898c57a93b3400b674f9 100644 (file)
@@ -17,16 +17,21 @@ use Symfony\Component\Console\Output\OutputInterface;
 use OCA\user_ldap\lib\user\DeletedUsersIndex;
 use OCA\User_LDAP\lib\Connection;
 use OCA\User_LDAP\Mapping\UserMapping;
+use OCP\IDateTimeFormatter;
 
 class ShowRemnants extends Command {
-       /** @var use OCA\User_LDAP\lib\User\DeletedUsersIndex; */
+       /** @var OCA\User_LDAP\lib\User\DeletedUsersIndex */
        protected $dui;
 
+       /** @var OCP\IDateTimeFormatter */
+       protected $dateFormatter;
+
        /**
         * @param OCA\user_ldap\lib\user\DeletedUsersIndex $dui
         */
-       public function __construct(DeletedUsersIndex $dui) {
+       public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) {
                $this->dui = $dui;
+               $this->dateFormatter = $dateFormatter;
                parent::__construct();
        }
 
@@ -53,7 +58,7 @@ class ShowRemnants extends Command {
                foreach($resultSet as $user) {
                        $hAS = $user->getHasActiveShares() ? 'Y' : 'N';
                        $lastLogin = ($user->getLastLogin() > 0) ?
-                               \OCP\Util::formatDate($user->getLastLogin()) : '-';
+                               $this->dateFormatter->formatDate($user->getLastLogin()) : '-';
                        $rows[] = array(
                                $user->getOCName(),
                                $user->getDisplayName(),