File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed
private/Files/ObjectStore
public/Files/ObjectStore/Events Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 460460 'OCP \\Files \\Notify \\IChange ' => $ baseDir . '/lib/public/Files/Notify/IChange.php ' ,
461461 'OCP \\Files \\Notify \\INotifyHandler ' => $ baseDir . '/lib/public/Files/Notify/INotifyHandler.php ' ,
462462 'OCP \\Files \\Notify \\IRenameChange ' => $ baseDir . '/lib/public/Files/Notify/IRenameChange.php ' ,
463+ 'OCP \\Files \\ObjectStore \\Events \\BucketCreatedEvent ' => $ baseDir . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php ' ,
463464 'OCP \\Files \\ObjectStore \\IObjectStore ' => $ baseDir . '/lib/public/Files/ObjectStore/IObjectStore.php ' ,
464465 'OCP \\Files \\ObjectStore \\IObjectStoreMultiPartUpload ' => $ baseDir . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php ' ,
465466 'OCP \\Files \\ReservedWordException ' => $ baseDir . '/lib/public/Files/ReservedWordException.php ' ,
Original file line number Diff line number Diff line change @@ -509,6 +509,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
509509 'OCP \\Files \\Notify \\IChange ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/IChange.php ' ,
510510 'OCP \\Files \\Notify \\INotifyHandler ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/INotifyHandler.php ' ,
511511 'OCP \\Files \\Notify \\IRenameChange ' => __DIR__ . '/../../.. ' . '/lib/public/Files/Notify/IRenameChange.php ' ,
512+ 'OCP \\Files \\ObjectStore \\Events \\BucketCreatedEvent ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/Events/BucketCreatedEvent.php ' ,
512513 'OCP \\Files \\ObjectStore \\IObjectStore ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/IObjectStore.php ' ,
513514 'OCP \\Files \\ObjectStore \\IObjectStoreMultiPartUpload ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ObjectStore/IObjectStoreMultiPartUpload.php ' ,
514515 'OCP \\Files \\ReservedWordException ' => __DIR__ . '/../../.. ' . '/lib/public/Files/ReservedWordException.php ' ,
Original file line number Diff line number Diff line change 1313use Aws \S3 \S3Client ;
1414use GuzzleHttp \Promise \Create ;
1515use GuzzleHttp \Promise \RejectedPromise ;
16+ use OCP \EventDispatcher \IEventDispatcher ;
17+ use OCP \Files \ObjectStore \Events \BucketCreatedEvent ;
1618use OCP \Files \StorageNotAvailableException ;
1719use OCP \ICertificateManager ;
1820use OCP \Server ;
@@ -140,6 +142,13 @@ public function getConnection() {
140142 throw new StorageNotAvailableException ('The bucket will not be created because the name is not dns compatible, please correct it: ' . $ this ->bucket );
141143 }
142144 $ this ->connection ->createBucket (['Bucket ' => $ this ->bucket ]);
145+ Server::get (IEventDispatcher::class)
146+ ->dispatchTyped (new BucketCreatedEvent (
147+ $ this ->bucket ,
148+ $ options ['endpoint ' ],
149+ $ options ['region ' ],
150+ $ options ['version ' ]
151+ ));
143152 $ this ->testTimeout ();
144153 } catch (S3Exception $ e ) {
145154 $ logger ->debug ('Invalid remote storage. ' , [
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+ * SPDX-License-Identifier: AGPL-3.0-only
8+ */
9+ namespace OCP \Files \ObjectStore \Events ;
10+
11+ use OCP \EventDispatcher \Event ;
12+
13+ class BucketCreatedEvent extends Event {
14+
15+ public function __construct (
16+ private readonly string $ bucket ,
17+ private readonly string $ endpoint ,
18+ private readonly string $ region ,
19+ private readonly string $ version = 'latest ' ,
20+ ) {
21+ parent ::__construct ();
22+ }
23+
24+ public function getBucket (): string {
25+ return $ this ->bucket ;
26+ }
27+
28+ public function getEndpoint (): string {
29+ return $ this ->endpoint ;
30+ }
31+
32+ public function getRegion (): string {
33+ return $ this ->region ;
34+ }
35+
36+ public function getVersion (): string {
37+ return $ this ->version ;
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments