Compare commits

...

6 Commits

Author SHA1 Message Date
Arthur Schiwon bcbc292669
fixup! adjust server tests 2019-10-23 09:41:25 +02:00
Arthur Schiwon 370d2537f9
adjust apps' tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-22 23:44:08 +02:00
Arthur Schiwon ca84fa03e0
adjust server tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-22 23:41:14 +02:00
Arthur Schiwon 264e171c29
switch apps to won GenericEvent
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-22 23:34:50 +02:00
Arthur Schiwon 17f543a0e0
make use of our own GenericEvent class
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-22 23:17:08 +02:00
Arthur Schiwon 79aa4d3ac4
add Nextcloud specific GenericEvent implementation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-10-22 23:17:08 +02:00
56 changed files with 267 additions and 86 deletions

View File

@ -43,12 +43,12 @@ use OCP\App\ManagerEvent;
use OCP\AppFramework\App;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Console\ConsoleEvent;
use OCP\EventDispatcher\GenericEvent;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IPreview;
use OCP\IUserSession;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share;
class Application extends App {

View File

@ -25,7 +25,7 @@
use OCA\DAV\AppInfo\Application;
use OCA\DAV\CardDAV\CardDavBackend;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
\OC_App::loadApps(['dav']);

View File

@ -42,11 +42,11 @@ use OCA\DAV\CardDAV\ContactsManager;
use OCA\DAV\CardDAV\PhotoCache;
use OCA\DAV\CardDAV\SyncService;
use OCA\DAV\HookManager;
use \OCP\AppFramework\App;
use OCP\AppFramework\App;
use OCP\Contacts\IManager as IContactsManager;
use OCP\Calendar\IManager as ICalendarManager;
use OCP\IUser;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
class Application extends App {

View File

@ -38,6 +38,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\DAV\DAV\Sharing\Backend;
use OCP\IDBConnection;
use OCP\EventDispatcher\GenericEvent;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUser;
@ -64,7 +65,6 @@ use Sabre\VObject\Reader;
use Sabre\VObject\Recur\EventIterator;
use Sabre\Uri;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class CalDavBackend

View File

@ -37,6 +37,7 @@ use OCA\DAV\Connector\Sabre\Principal;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCA\DAV\DAV\Sharing\Backend;
use OCA\DAV\DAV\Sharing\IShareable;
use OCP\EventDispatcher\GenericEvent;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUser;
@ -49,7 +50,6 @@ use Sabre\DAV\Exception\BadRequest;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class CardDavBackend implements BackendInterface, SyncSupport {

View File

@ -38,8 +38,8 @@ use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\Connector\Sabre\Principal;
use OCP\App\IAppManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\EventDispatcher\GenericEvent;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IUserManager;
@ -50,7 +50,6 @@ use Sabre\DAV\PropPatch;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Property\Text;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
/**

View File

@ -32,12 +32,12 @@ use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\GenericEvent;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class TrustedServers {

View File

@ -33,6 +33,7 @@ use OCA\Federation\DbHandler;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\GenericEvent;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
@ -221,8 +222,8 @@ class TrustedServersTest extends TestCase {
->willReturnCallback(
function($eventId, $event) {
$this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove');
$this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event);
/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
$this->assertInstanceOf(GenericEvent::class, $event);
/** @var GenericEvent $event */
$this->assertSame('url_hash', $event->getSubject());
}
);

View File

@ -28,7 +28,7 @@ use OC\EventDispatcher\SymfonyAdapter;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
class LegacyLoadAdditionalScriptsAdapter implements IEventListener {

View File

@ -27,12 +27,12 @@ namespace OCA\Files\Service;
use OC\Tags;
use OCA\Files\Activity\FavoriteProvider;
use OCP\Activity\IManager;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\Folder;
use OCP\ITags;
use OCP\IUser;
use OCP\IUserSession;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Service class to manage tags on files.

View File

@ -63,7 +63,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\IRootFolder;
use OCP\Share\Exceptions\ShareNotFound;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
use OCP\Share\IManager as ShareManager;
/**

View File

@ -24,7 +24,7 @@ namespace OCA\LookupServerConnector\AppInfo;
use OCA\LookupServerConnector\UpdateLookupServer;
use OCP\AppFramework\App;
use OCP\IUser;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
class Application extends App {
public function __construct () {

View File

@ -46,6 +46,7 @@ use OCA\Settings\Middleware\SubadminMiddleware;
use OCP\Activity\IManager as IActivityManager;
use OCP\AppFramework\App;
use OCP\Defaults;
use OCP\EventDispatcher\GenericEvent;
use OCP\IContainer;
use OCP\IGroup;
use OCP\ILogger;
@ -53,7 +54,6 @@ use OCP\IUser;
use OCP\Settings\IManager;
use OCP\Util;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App {

View File

@ -48,6 +48,7 @@ use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\EventDispatcher\GenericEvent;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
@ -59,7 +60,6 @@ use OCP\IURLGenerator;
use OCP\Lock\ILockingProvider;
use OCP\Security\ISecureRandom;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class CheckSetupController extends Controller {
/** @var IConfig */

View File

@ -23,12 +23,12 @@ namespace OCA\WorkflowEngine\AppInfo;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\QueryException;
use OCP\EventDispatcher\GenericEvent;
use OCP\Template;
use OCA\WorkflowEngine\Controller\RequestTime;
use OCP\WorkflowEngine\IEntity;
use OCP\WorkflowEngine\IOperation;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends \OCP\AppFramework\App {

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\WorkflowEngine\Entity;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\IRootFolder;
use OCP\IL10N;
use OCP\IURLGenerator;
@ -31,7 +32,6 @@ use OCP\SystemTag\MapperEvent;
use OCP\WorkflowEngine\GenericEntityEvent;
use OCP\WorkflowEngine\IEntity;
use OCP\WorkflowEngine\IRuleMatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
class File implements IEntity {

View File

@ -39,6 +39,7 @@ use OCP\AppFramework\QueryException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Storage\IStorage;
use OCP\IDBConnection;
use OCP\EventDispatcher\GenericEvent;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IServerContainer;
@ -51,7 +52,6 @@ use OCP\WorkflowEngine\IManager;
use OCP\WorkflowEngine\IOperation;
use OCP\WorkflowEngine\IRuleMatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Manager implements IManager {

View File

@ -38,11 +38,10 @@ use OC\Core\Notification\RemoveLinkSharesNotifier;
use OC\DB\MissingIndexInformation;
use OC\DB\SchemaWrapper;
use OCP\AppFramework\App;
use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
use OCP\IServerContainer;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class Application

View File

@ -24,12 +24,12 @@ declare(strict_types=1);
namespace OC\Core\Command\Db;
use OC\DB\SchemaWrapper;
use OCP\EventDispatcher\GenericEvent;
use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class AddMissingIndices

View File

@ -28,6 +28,7 @@ namespace OC\Core\Command\Maintenance;
use Exception;
use OCP\App\IAppManager;
use OCP\EventDispatcher\GenericEvent;
use OCP\IConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
@ -35,7 +36,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Repair extends Command {
/** @var \OC\Repair $repair */

View File

@ -37,6 +37,7 @@ namespace OC\Core\Command;
use OC\Console\TimestampFormatter;
use OC\Installer;
use OC\Updater;
use OCP\EventDispatcher\GenericEvent;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Util;
@ -44,7 +45,6 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Upgrade extends Command {

View File

@ -32,11 +32,11 @@ use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\Authentication\Exceptions\PasswordUnavailableException;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\EventDispatcher\GenericEvent;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\ISecureRandom;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class AppPasswordController extends \OCP\AppFramework\OCSController {
@ -121,6 +121,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
* @NoAdminRequired
*
* @return DataResponse
* @throws OCSForbiddenException
*/
public function deleteAppPassword() {
if (!$this->session->exists('app_password')) {
@ -141,6 +142,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
/**
* @NoAdminRequired
* @throws OCSForbiddenException
*/
public function rotateAppPassword(): DataResponse {
if (!$this->session->exists('app_password')) {

View File

@ -33,11 +33,13 @@ use OC\Authentication\Token\IToken;
use OCA\OAuth2\Db\AccessToken;
use OCA\OAuth2\Db\AccessTokenMapper;
use OCA\OAuth2\Db\ClientMapper;
use OCA\OAuth2\Exceptions\ClientNotFoundException;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\Defaults;
use OCP\EventDispatcher\GenericEvent;
use OCP\IL10N;
use OCP\IRequest;
use OCP\ISession;
@ -47,7 +49,6 @@ use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class ClientFlowLoginController extends Controller {
/** @var IUserSession */
@ -161,6 +162,7 @@ class ClientFlowLoginController extends Controller {
* @param string $clientIdentifier
*
* @return StandaloneTemplateResponse
* @throws ClientNotFoundException
*/
public function showAuthPickerPage($clientIdentifier = '') {
$clientName = $this->getClientName();
@ -230,6 +232,7 @@ class ClientFlowLoginController extends Controller {
* @param string $stateToken
* @param string $clientIdentifier
* @return StandaloneTemplateResponse
* @throws ClientNotFoundException
*/
public function grantPage($stateToken = '',
$clientIdentifier = '') {
@ -277,6 +280,7 @@ class ClientFlowLoginController extends Controller {
* @param string $stateToken
* @param string $clientIdentifier
* @return Http\RedirectResponse|Response
* @throws ClientNotFoundException
*/
public function generateAppPassword($stateToken,
$clientIdentifier = '') {

View File

@ -29,8 +29,11 @@
*
*/
use OCP\EventDispatcher\GenericEvent;
use OCP\IEventSource;
use OCP\IL10N;
use OCP\ILogger;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Util;
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit(0);
@ -53,12 +56,12 @@ class FeedBackHandler {
private $progressStateStep = 0;
/** @var string */
private $currentStep;
/** @var \OCP\IEventSource */
/** @var IEventSource */
private $eventSource;
/** @var \OCP\IL10N */
/** @var IL10N */
private $l10n;
public function __construct(\OCP\IEventSource $eventSource, \OCP\IL10N $l10n) {
public function __construct(IEventSource $eventSource, IL10N $l10n) {
$this->eventSource = $eventSource;
$this->l10n = $l10n;
}
@ -102,7 +105,7 @@ class FeedBackHandler {
}
}
if (\OCP\Util::needUpgrade()) {
if (Util::needUpgrade()) {
$config = \OC::$server->getSystemConfig();
if ($config->getValue('upgrade.disable-web', false)) {

View File

@ -175,6 +175,7 @@ return array(
'OCP\\Encryption\\IManager' => $baseDir . '/lib/public/Encryption/IManager.php',
'OCP\\Encryption\\Keys\\IStorage' => $baseDir . '/lib/public/Encryption/Keys/IStorage.php',
'OCP\\EventDispatcher\\Event' => $baseDir . '/lib/public/EventDispatcher/Event.php',
'OCP\\EventDispatcher\\GenericEvent' => $baseDir . '/lib/public/EventDispatcher/GenericEvent.php',
'OCP\\EventDispatcher\\IEventDispatcher' => $baseDir . '/lib/public/EventDispatcher/IEventDispatcher.php',
'OCP\\EventDispatcher\\IEventListener' => $baseDir . '/lib/public/EventDispatcher/IEventListener.php',
'OCP\\Federation\\Exceptions\\ActionNotSupportedException' => $baseDir . '/lib/public/Federation/Exceptions/ActionNotSupportedException.php',

View File

@ -204,6 +204,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Encryption\\IManager' => __DIR__ . '/../../..' . '/lib/public/Encryption/IManager.php',
'OCP\\Encryption\\Keys\\IStorage' => __DIR__ . '/../../..' . '/lib/public/Encryption/Keys/IStorage.php',
'OCP\\EventDispatcher\\Event' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/Event.php',
'OCP\\EventDispatcher\\GenericEvent' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/GenericEvent.php',
'OCP\\EventDispatcher\\IEventDispatcher' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/IEventDispatcher.php',
'OCP\\EventDispatcher\\IEventListener' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/IEventListener.php',
'OCP\\Federation\\Exceptions\\ActionNotSupportedException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ActionNotSupportedException.php',

View File

@ -29,10 +29,10 @@ namespace OC\Accounts;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\GenericEvent;
use OCP\IDBConnection;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCA\Settings\BackgroundJobs\VerifyUserData;
/**

View File

@ -27,7 +27,6 @@ namespace OC\Authentication\Events;
use OC\Authentication\Token\IToken;
use OCP\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\GenericEvent;
abstract class ARemoteWipeEvent extends Event {

View File

@ -27,17 +27,16 @@ declare(strict_types = 1);
namespace OC\Authentication\TwoFactorAuth;
use OCP\EventDispatcher\GenericEvent;
use function array_diff;
use function array_filter;
use BadMethodCallException;
use Exception;
use OC\Authentication\Exceptions\ExpiredTokenException;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Token\IProvider as TokenProvider;
use OCP\Activity\IManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin;
use OCP\Authentication\TwoFactorAuth\ILoginSetupProvider;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Authentication\TwoFactorAuth\IRegistry;
use OCP\IConfig;
@ -45,7 +44,6 @@ use OCP\ILogger;
use OCP\ISession;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Manager {

View File

@ -23,11 +23,12 @@ declare(strict_types=1);
namespace OC\Collaboration\Resources;
use OC;
use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\GenericEvent;
use OCP\IGroup;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Listener {
@ -36,7 +37,7 @@ class Listener {
/** @var IUser $user */
$user = $event->getArgument('user');
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = OC::$server->query(IManager::class);
$resourceManager->invalidateAccessCacheForUser($user);
};
@ -47,7 +48,7 @@ class Listener {
/** @var IUser $user */
$user = $event->getSubject();
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = OC::$server->query(IManager::class);
$resourceManager->invalidateAccessCacheForUser($user);
});
@ -56,7 +57,7 @@ class Listener {
/** @var IGroup $group */
$group = $event->getSubject();
/** @var IManager $resourceManager */
$resourceManager = \OC::$server->query(IManager::class);
$resourceManager = OC::$server->query(IManager::class);
foreach ($group->getUsers() as $user) {
$resourceManager->invalidateAccessCacheForUser($user);

View File

@ -37,10 +37,10 @@ use \Doctrine\DBAL\Schema\SchemaConfig;
use \Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
use OCP\EventDispatcher\GenericEvent;
use OCP\IConfig;
use OCP\Security\ISecureRandom;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Migrator {

View File

@ -22,12 +22,12 @@
namespace OC\Files\Node;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\FileInfo;
use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Util;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class HookConnector {
/**

View File

@ -29,11 +29,11 @@ namespace OC\Files\Node;
use OC\Files\Filesystem;
use OC\Files\Mount\MoveableMount;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\FileInfo;
use OCP\Files\InvalidPathException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use Symfony\Component\EventDispatcher\GenericEvent;
// FIXME: this class really should be abstract
class Node implements \OCP\Files\Node {

View File

@ -30,6 +30,8 @@
namespace OC\Group;
use OC\User\User;
use OCP\EventDispatcher\GenericEvent;
use OCP\Group\Backend\IGetDisplayNameBackend;
use OCP\Group\Backend\IHideFromCollaborationBackend;
use OC\Hooks\PublicEmitter;
@ -40,7 +42,6 @@ use OCP\IUser;
use OCP\Group\Backend\ICountDisabledInGroup;
use OCP\IUserManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Group implements IGroup {
/** @var null|string */
@ -49,7 +50,7 @@ class Group implements IGroup {
/** @var string */
private $gid;
/** @var \OC\User\User[] */
/** @var User[] */
private $users = array();
/** @var bool */
@ -119,7 +120,7 @@ class Group implements IGroup {
/**
* get all users in the group
*
* @return \OC\User\User[]
* @return User[]
*/
public function getUsers() {
if ($this->usersLoaded) {
@ -179,7 +180,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preAddUser', array($this, $user));
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) {
if ($backend->implementsActions(Backend::ADD_TO_GROUP)) {
$backend->addToGroup($user->getUID(), $this->gid);
if ($this->users) {
$this->users[$user->getUID()] = $user;
@ -200,7 +201,7 @@ class Group implements IGroup {
/**
* remove a user from the group
*
* @param \OC\User\User $user
* @param User $user
*/
public function removeUser($user) {
$result = false;
@ -211,7 +212,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user));
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
if ($backend->implementsActions(Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
$backend->removeFromGroup($user->getUID(), $this->gid);
$result = true;
}
@ -240,7 +241,7 @@ class Group implements IGroup {
* @param string $search
* @param int $limit
* @param int $offset
* @return \OC\User\User[]
* @return User[]
*/
public function searchUsers($search, $limit = null, $offset = null) {
$users = array();
@ -263,7 +264,7 @@ class Group implements IGroup {
public function count($search = '') {
$users = false;
foreach ($this->backends as $backend) {
if($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) {
if($backend->implementsActions(Backend::COUNT_USERS)) {
if($users === false) {
//we could directly add to a bool variable, but this would
//be ugly
@ -301,7 +302,7 @@ class Group implements IGroup {
* @param string $search
* @param int $limit
* @param int $offset
* @return \OC\User\User[]
* @return User[]
*/
public function searchDisplayName($search, $limit = null, $offset = null) {
$users = array();
@ -332,7 +333,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preDelete', array($this));
}
foreach ($this->backends as $backend) {
if ($backend->implementsActions(\OC\Group\Backend::DELETE_GROUP)) {
if ($backend->implementsActions(Backend::DELETE_GROUP)) {
$result = true;
$backend->deleteGroup($this->gid);
}
@ -349,7 +350,7 @@ class Group implements IGroup {
/**
* returns all the Users from an array that really exists
* @param string[] $userIds an array containing user IDs
* @return \OC\User\User[] an Array with the userId as Key and \OC\User\User as value
* @return User[] an Array with the userId as Key and \OC\User\User as value
*/
private function getVerifiedUsers($userIds) {
if (!is_array($userIds)) {

View File

@ -25,7 +25,7 @@
namespace OC\Preview;
use OC\Preview\GeneratorHelper;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\File;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
@ -35,11 +35,9 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\IImage;
use OCP\IPreview;
use OCP\Preview\IProvider;
use OCP\Preview\IVersionedPreviewFile;
use OCP\Preview\IProviderV2;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Generator {

View File

@ -57,10 +57,10 @@ use OC\Template\SCSSCacher;
use OCP\AppFramework\QueryException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\GenericEvent;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Repair implements IOutput {
@ -134,6 +134,7 @@ class Repair implements IOutput {
* command line or after an upgrade.
*
* @return IRepairStep[]
* @throws QueryException
*/
public static function getRepairSteps() {
return [

View File

@ -108,7 +108,6 @@ use OC\Security\Bruteforce\Throttler;
use OC\Security\CertificateManager;
use OC\Security\CredentialsManager;
use OC\Security\Crypto;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Security\CSRF\CsrfTokenGenerator;
use OC\Security\CSRF\CsrfTokenManager;
@ -135,6 +134,7 @@ use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Contacts\ContactsMenu\IContactsStore;
use OCP\Dashboard\IDashboardManager;
use OCP\Defaults;
use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationProviderManager;
@ -159,7 +159,6 @@ use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class Server

View File

@ -25,10 +25,10 @@
namespace OC\Share20;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\File;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share;
class LegacyHooks {

View File

@ -41,6 +41,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Mount\MoveableMount;
use OC\HintException;
use OC\Share20\Exception\ProviderException;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
@ -63,7 +64,6 @@ use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share\IShareProvider;
use OCP\Share;

View File

@ -38,10 +38,10 @@ use OC\DB\MigrationService;
use OC\Hooks\BasicEmitter;
use OC\IntegrityCheck\Checker;
use OC_App;
use OCP\EventDispatcher\GenericEvent;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class that handles autoupdating of ownCloud

View File

@ -58,6 +58,7 @@ declare(strict_types=1);
namespace OC\User;
use OC\Cache\CappedMemoryCache;
use OCP\EventDispatcher\GenericEvent;
use OCP\IDBConnection;
use OCP\User\Backend\ABackend;
use OCP\User\Backend\ICheckPasswordBackend;
@ -69,7 +70,6 @@ use OCP\User\Backend\IGetRealUIDBackend;
use OCP\User\Backend\ISetDisplayNameBackend;
use OCP\User\Backend\ISetPasswordBackend;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class for user management in a SQL Database (e.g. MySQL, SQLite)

View File

@ -50,6 +50,7 @@ use OC_User;
use OC_Util;
use OCA\DAV\Connector\Sabre\Auth;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
@ -62,7 +63,6 @@ use OCP\Lockdown\ILockdownManager;
use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class Session

View File

@ -35,6 +35,7 @@ use OC\Accounts\AccountManager;
use OC\Files\Cache\Storage;
use OC\Hooks\Emitter;
use OC_Helper;
use OCP\EventDispatcher\GenericEvent;
use OCP\IAvatarManager;
use OCP\IImage;
use OCP\IURLGenerator;
@ -43,7 +44,6 @@ use OCP\IConfig;
use OCP\UserInterface;
use \OCP\IUserBackend;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class User implements IUser {
/** @var string */

View File

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace OCP\Collaboration\AutoComplete;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
/**
* @since 16.0.0

View File

@ -0,0 +1,171 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCP\EventDispatcher;
use ArrayAccess;
use ArrayIterator;
use InvalidArgumentException;
use IteratorAggregate;
use Traversable;
use function array_key_exists;
/**
* Class GenericEvent
*
* convenience reimplementation of \Symfony\Component\GenericEvent against
* \OCP\EventDispatcher\Event
*
* @package OCP\EventDispatcher
* @since 18.0.0
*/
class GenericEvent extends Event implements ArrayAccess, IteratorAggregate {
protected $subject;
protected $arguments;
/**
* Encapsulate an event with $subject and $args.
*
* @since 18.0.0
*/
public function __construct($subject = null, array $arguments = []) {
$this->subject = $subject;
$this->arguments = $arguments;
}
/**
* Getter for subject property.
*
* @since 18.0.0
*/
public function getSubject() {
return $this->subject;
}
/**
* Get argument by key.
*
* @throws InvalidArgumentException if key is not found
* @since 18.0.0
*/
public function getArgument(string $key) {
if ($this->hasArgument($key)) {
return $this->arguments[$key];
}
throw new InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
}
/**
* Add argument to event.
*
* @since 18.0.0
*/
public function setArgument(string $key, $value): GenericEvent {
$this->arguments[$key] = $value;
return $this;
}
/**
* Getter for all arguments.
*
* @since 18.0.0
*/
public function getArguments(): array {
return $this->arguments;
}
/**
* Set args property.
*
* @since 18.0.0
*/
public function setArguments(array $args = []): GenericEvent {
$this->arguments = $args;
return $this;
}
/**
* Has argument.
*
* @since 18.0.0
*/
public function hasArgument(string $key): bool {
return array_key_exists($key, $this->arguments);
}
/**
* Retrieve an external iterator
*
* @link https://php.net/manual/en/iteratoraggregate.getiterator.php
* @since 18.0.0
*/
public function getIterator(): Traversable {
return new ArrayIterator($this->arguments);
}
/**
* Whether a offset exists
*
* @link https://php.net/manual/en/arrayaccess.offsetexists.php
* @since 18.0.0
*/
public function offsetExists($offset): bool {
return $this->hasArgument($offset);
}
/**
* Offset to retrieve
*
* @link https://php.net/manual/en/arrayaccess.offsetget.php
* @since 18.0.0
*/
public function offsetGet($offset) {
if ($this->hasArgument($offset)) {
unset($this->arguments[$offset]);
}
}
/**
* Offset to set
*
* @link https://php.net/manual/en/arrayaccess.offsetset.php
* @since 18.0.0
*/
public function offsetSet($offset, $value): void {
$this->setArgument($offset, $value);
}
/**
* Offset to unset
*
* @link https://php.net/manual/en/arrayaccess.offsetunset.php
* @since 18.0.0
*/
public function offsetUnset($offset): void {
if ($this->hasArgument($offset)) {
unset($this->arguments[$offset]);
}
}
}

View File

@ -32,7 +32,6 @@ namespace OCP\Files_FullTextSearch\Model;
use OC\FullTextSearch\Model\IndexDocument;
use OCP\FullTextSearch\Model\IIndexDocument;
/**

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace OCP\WorkflowEngine;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
/**
* Interface IEntity

View File

@ -23,7 +23,7 @@
namespace OCP\WorkflowEngine;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\GenericEvent;
/**
* Interface IOperation

View File

@ -27,9 +27,9 @@ use OC\Accounts\Account;
use OC\Accounts\AccountManager;
use OCP\Accounts\IAccountManager;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\GenericEvent;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
/**

View File

@ -13,11 +13,11 @@ use OC\Files\Node\HookConnector;
use OC\Files\Node\Root;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\Node;
use OCP\ILogger;
use OCP\IUserManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
use Test\Traits\MountProviderTrait;
use Test\Traits\UserTrait;

View File

@ -23,11 +23,11 @@ namespace Test\Migration;
use OC\Migration\BackgroundRepair;
use OC\NeedsUpdateException;
use OCP\EventDispatcher\GenericEvent;
use OCP\ILogger;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
class TestRepairStep implements IRepairStep {

View File

@ -24,6 +24,7 @@ namespace Test\Preview;
use OC\Preview\Generator;
use OC\Preview\GeneratorHelper;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\File;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
@ -32,10 +33,8 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\IImage;
use OCP\IPreview;
use OCP\Preview\IProvider;
use OCP\Preview\IProviderV2;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class GeneratorTest extends \Test\TestCase {

View File

@ -8,6 +8,7 @@
namespace Test;
use OCP\EventDispatcher\GenericEvent;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcher;
@ -45,15 +46,15 @@ class RepairTest extends TestCase {
$this->repair = new \OC\Repair([], $dispatcher);
$dispatcher->addListener('\OC\Repair::warning', function ($event) {
/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
/** @var GenericEvent $event */
$this->outputArray[] = 'warning: ' . $event->getArgument(0);
});
$dispatcher->addListener('\OC\Repair::info', function ($event) {
/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
/** @var GenericEvent $event */
$this->outputArray[] = 'info: ' . $event->getArgument(0);
});
$dispatcher->addListener('\OC\Repair::step', function ($event) {
/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
/** @var GenericEvent $event */
$this->outputArray[] = 'step: ' . $event->getArgument(0);
});
}

View File

@ -22,12 +22,14 @@
*/
namespace Test\Share20;
use OC\EventDispatcher\SymfonyAdapter;
use OC\Share20\LegacyHooks;
use OC\Share20\Manager;
use OCP\Constants;
use OCP\EventDispatcher\GenericEvent;
use OCP\Files\File;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
use OC\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyEventDispatcher;
use Test\TestCase;
class LegacyHooksTest extends TestCase {
@ -44,7 +46,9 @@ class LegacyHooksTest extends TestCase {
public function setUp() {
parent::setUp();
$this->eventDispatcher = new EventDispatcher();
$logger = \OC::$server->getLogger();
$symfonyDispatcher = new SymfonyEventDispatcher();
$this->eventDispatcher = new SymfonyAdapter(new EventDispatcher($symfonyDispatcher, \OC::$server, $logger), $logger);
$this->hooks = new LegacyHooks($this->eventDispatcher);
$this->manager = \OC::$server->getShareManager();
}

View File

@ -41,8 +41,8 @@ use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
use OC\Share20\Manager;
use OC\Share20\Exception;
use OC\Share20\Share;
use OCP\EventDispatcher\GenericEvent;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IConfig;
@ -52,7 +52,6 @@ use OCP\Security\IHasher;
use OCP\Files\Mount\IMountManager;
use OCP\IGroupManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class ManagerTest

View File

@ -21,10 +21,11 @@
*/
namespace Test\User;
use OC\HintException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OC\User\User;
use OCP\EventDispatcher\GenericEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class DatabaseTest