File tree Expand file tree Collapse file tree 4 files changed +22
-10
lines changed
Expand file tree Collapse file tree 4 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -30,20 +30,21 @@ public function register(IRegistrationContext $context): void {
3030 BeforeTemplateRenderedEvent::class,
3131 BeforeTemplateRenderedListener::class
3232 );
33- if (\OCA \ OpenProject \ Service \ class_exists (BeforeShareCreatedEvent::class)) {
33+ if (\class_exists (BeforeShareCreatedEvent::class)) {
3434 $ context ->registerEventListener (
3535 BeforeShareCreatedEvent::class,
3636 BeforeShareCreatedListener::class
3737 );
38+ } else {
39+ // FIXME: Remove once Nextcloud 28 is the minimum supported version
40+ \OCP \Server::get (IEventDispatcher::class)->addListener ('OCP\Share::preShare ' , function (GenericEvent $ event ) {
41+ /** @var IShare $share */
42+ $ share = $ event ->getSubject ();
43+
44+ $ modernListener = \OCP \Server::get (BeforeShareCreatedListener::class);
45+ $ modernListener ->overwriteShareTarget ($ share );
46+ }, 1000 );
3847 }
39- // FIXME: Remove once Nextcloud 28 is the minimum supported version
40- \OCP \Server::get (IEventDispatcher::class)->addListener ('OCP\Share::preShare ' , function (GenericEvent $ event ) {
41- /** @var IShare $share */
42- $ share = $ event ->getSubject ();
43-
44- $ modernListener = \OCP \Server::get (BeforeShareCreatedListener::class);
45- $ modernListener ->overwriteShareTarget ($ share );
46- }, 1000 );
4748 }
4849
4950 public function boot (IBootContext $ context ): void {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public function __construct(
2828 IDBConnection $ db ,
2929 TagService $ tagService ,
3030 IManager $ shareManager ,
31- IUserSession $ userSession,
31+ IUserSession $ userSession
3232 ) {
3333 $ this ->util = $ util ;
3434 $ this ->root = $ root ;
Original file line number Diff line number Diff line change 44 'directory_list ' => [
55 'lib/ ' ,
66 'vendor/ ' ,
7+ 'tests/stubs/ ' ,
78 ],
89 "exclude_analysis_directory_list " => [
910 'vendor/ ' ,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace OCP \Share \Events {
4+
5+ use OCP \Share \IShare ;
6+
7+ abstract class BeforeShareCreatedEvent extends \OCP \EventDispatcher \Event {
8+ abstract public function getShare (): IShare ;
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments