4646use OCP \Files \FileInfo ;
4747use OCP \Files \IRootFolder ;
4848use OCP \Util ;
49- use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
5049
5150class HookConnector {
5251 /** @var IRootFolder */
@@ -58,26 +57,15 @@ class HookConnector {
5857 /** @var FileInfo[] */
5958 private $ deleteMetaCache = [];
6059
61- /** @var EventDispatcherInterface */
62- private $ legacyDispatcher ;
63-
6460 /** @var IEventDispatcher */
6561 private $ dispatcher ;
6662
67- /**
68- * HookConnector constructor.
69- *
70- * @param Root $root
71- * @param View $view
72- */
7363 public function __construct (
7464 IRootFolder $ root ,
7565 View $ view ,
76- EventDispatcherInterface $ legacyDispatcher ,
7766 IEventDispatcher $ dispatcher ) {
7867 $ this ->root = $ root ;
7968 $ this ->view = $ view ;
80- $ this ->legacyDispatcher = $ legacyDispatcher ;
8169 $ this ->dispatcher = $ dispatcher ;
8270 }
8371
@@ -106,7 +94,7 @@ public function viewToNode() {
10694 public function write ($ arguments ) {
10795 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
10896 $ this ->root ->emit ('\OC\Files ' , 'preWrite ' , [$ node ]);
109- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preWrite ' , new GenericEvent ($ node ));
97+ $ this ->dispatcher ->dispatch ('\OCP\Files::preWrite ' , new GenericEvent ($ node ));
11098
11199 $ event = new BeforeNodeWrittenEvent ($ node );
112100 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -115,7 +103,7 @@ public function write($arguments) {
115103 public function postWrite ($ arguments ) {
116104 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
117105 $ this ->root ->emit ('\OC\Files ' , 'postWrite ' , [$ node ]);
118- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postWrite ' , new GenericEvent ($ node ));
106+ $ this ->dispatcher ->dispatch ('\OCP\Files::postWrite ' , new GenericEvent ($ node ));
119107
120108 $ event = new NodeWrittenEvent ($ node );
121109 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -124,7 +112,7 @@ public function postWrite($arguments) {
124112 public function create ($ arguments ) {
125113 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
126114 $ this ->root ->emit ('\OC\Files ' , 'preCreate ' , [$ node ]);
127- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preCreate ' , new GenericEvent ($ node ));
115+ $ this ->dispatcher ->dispatch ('\OCP\Files::preCreate ' , new GenericEvent ($ node ));
128116
129117 $ event = new BeforeNodeCreatedEvent ($ node );
130118 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -133,7 +121,7 @@ public function create($arguments) {
133121 public function postCreate ($ arguments ) {
134122 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
135123 $ this ->root ->emit ('\OC\Files ' , 'postCreate ' , [$ node ]);
136- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postCreate ' , new GenericEvent ($ node ));
124+ $ this ->dispatcher ->dispatch ('\OCP\Files::postCreate ' , new GenericEvent ($ node ));
137125
138126 $ event = new NodeCreatedEvent ($ node );
139127 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -143,7 +131,7 @@ public function delete($arguments) {
143131 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
144132 $ this ->deleteMetaCache [$ node ->getPath ()] = $ node ->getFileInfo ();
145133 $ this ->root ->emit ('\OC\Files ' , 'preDelete ' , [$ node ]);
146- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preDelete ' , new GenericEvent ($ node ));
134+ $ this ->dispatcher ->dispatch ('\OCP\Files::preDelete ' , new GenericEvent ($ node ));
147135
148136 $ event = new BeforeNodeDeletedEvent ($ node );
149137 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -153,7 +141,7 @@ public function postDelete($arguments) {
153141 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
154142 unset($ this ->deleteMetaCache [$ node ->getPath ()]);
155143 $ this ->root ->emit ('\OC\Files ' , 'postDelete ' , [$ node ]);
156- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postDelete ' , new GenericEvent ($ node ));
144+ $ this ->dispatcher ->dispatch ('\OCP\Files::postDelete ' , new GenericEvent ($ node ));
157145
158146 $ event = new NodeDeletedEvent ($ node );
159147 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -162,7 +150,7 @@ public function postDelete($arguments) {
162150 public function touch ($ arguments ) {
163151 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
164152 $ this ->root ->emit ('\OC\Files ' , 'preTouch ' , [$ node ]);
165- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preTouch ' , new GenericEvent ($ node ));
153+ $ this ->dispatcher ->dispatch ('\OCP\Files::preTouch ' , new GenericEvent ($ node ));
166154
167155 $ event = new BeforeNodeTouchedEvent ($ node );
168156 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -171,7 +159,7 @@ public function touch($arguments) {
171159 public function postTouch ($ arguments ) {
172160 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
173161 $ this ->root ->emit ('\OC\Files ' , 'postTouch ' , [$ node ]);
174- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postTouch ' , new GenericEvent ($ node ));
162+ $ this ->dispatcher ->dispatch ('\OCP\Files::postTouch ' , new GenericEvent ($ node ));
175163
176164 $ event = new NodeTouchedEvent ($ node );
177165 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -181,7 +169,7 @@ public function rename($arguments) {
181169 $ source = $ this ->getNodeForPath ($ arguments ['oldpath ' ]);
182170 $ target = $ this ->getNodeForPath ($ arguments ['newpath ' ]);
183171 $ this ->root ->emit ('\OC\Files ' , 'preRename ' , [$ source , $ target ]);
184- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preRename ' , new GenericEvent ([$ source , $ target ]));
172+ $ this ->dispatcher ->dispatch ('\OCP\Files::preRename ' , new GenericEvent ([$ source , $ target ]));
185173
186174 $ event = new BeforeNodeRenamedEvent ($ source , $ target );
187175 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -191,7 +179,7 @@ public function postRename($arguments) {
191179 $ source = $ this ->getNodeForPath ($ arguments ['oldpath ' ]);
192180 $ target = $ this ->getNodeForPath ($ arguments ['newpath ' ]);
193181 $ this ->root ->emit ('\OC\Files ' , 'postRename ' , [$ source , $ target ]);
194- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postRename ' , new GenericEvent ([$ source , $ target ]));
182+ $ this ->dispatcher ->dispatch ('\OCP\Files::postRename ' , new GenericEvent ([$ source , $ target ]));
195183
196184 $ event = new NodeRenamedEvent ($ source , $ target );
197185 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -201,7 +189,7 @@ public function copy($arguments) {
201189 $ source = $ this ->getNodeForPath ($ arguments ['oldpath ' ]);
202190 $ target = $ this ->getNodeForPath ($ arguments ['newpath ' ]);
203191 $ this ->root ->emit ('\OC\Files ' , 'preCopy ' , [$ source , $ target ]);
204- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::preCopy ' , new GenericEvent ([$ source , $ target ]));
192+ $ this ->dispatcher ->dispatch ('\OCP\Files::preCopy ' , new GenericEvent ([$ source , $ target ]));
205193
206194 $ event = new BeforeNodeCopiedEvent ($ source , $ target );
207195 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -211,7 +199,7 @@ public function postCopy($arguments) {
211199 $ source = $ this ->getNodeForPath ($ arguments ['oldpath ' ]);
212200 $ target = $ this ->getNodeForPath ($ arguments ['newpath ' ]);
213201 $ this ->root ->emit ('\OC\Files ' , 'postCopy ' , [$ source , $ target ]);
214- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::postCopy ' , new GenericEvent ([$ source , $ target ]));
202+ $ this ->dispatcher ->dispatch ('\OCP\Files::postCopy ' , new GenericEvent ([$ source , $ target ]));
215203
216204 $ event = new NodeCopiedEvent ($ source , $ target );
217205 $ this ->dispatcher ->dispatchTyped ($ event );
@@ -220,7 +208,7 @@ public function postCopy($arguments) {
220208 public function read ($ arguments ) {
221209 $ node = $ this ->getNodeForPath ($ arguments ['path ' ]);
222210 $ this ->root ->emit ('\OC\Files ' , 'read ' , [$ node ]);
223- $ this ->legacyDispatcher ->dispatch ('\OCP\Files::read ' , new GenericEvent ([$ node ]));
211+ $ this ->dispatcher ->dispatch ('\OCP\Files::read ' , new GenericEvent ([$ node ]));
224212
225213 $ event = new BeforeNodeReadEvent ($ node );
226214 $ this ->dispatcher ->dispatchTyped ($ event );
0 commit comments