Skip to content

Commit

Permalink
feat: update patch
Browse files Browse the repository at this point in the history
  • Loading branch information
zgq354 committed Dec 28, 2024
1 parent 09ef008 commit f532929
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 85 deletions.
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
"extra": {
"patches": {
"fof/upload": [
"patches/fof-upload-src-templates-markdownimagetemplate-php.patch",
"patches/fof-upload-src-adapters-manager-php.patch"
],
"askvortsov/flarum-pwa": [
Expand All @@ -114,9 +113,6 @@
"4": "patches/flarum-core-js-package-json.patch",
"Get User Ip from CDN": "patches/core-1.patch"
},
"fof/webhooks": [
"patches/fof-webhooks-override-opis-closure-serializableclosure-php.patch"
],
"fof/sitemap": {
"Remove User in Sitemap": "patches/fof-sitemap-1.patch"
},
Expand All @@ -135,4 +131,4 @@
"require-dev": {
"symplify/vendor-patches": "^11.2"
}
}
}
52 changes: 17 additions & 35 deletions patches/fof-upload-src-adapters-manager-php.patch
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
--- /dev/null
+++ ../src/Adapters/Manager.php
@@ -13,6 +13,7 @@
namespace FoF\Upload\Adapters;

use Aws\S3\S3Client;
+use Flarum\Foundation\Application;
use Flarum\Foundation\Paths;
use Flarum\Foundation\ValidationException;
use Flarum\Settings\SettingsRepositoryInterface;
@@ -49,12 +50,18 @@
*/
protected $settings;

- public function __construct(Dispatcher $events, Paths $paths, Util $util, SettingsRepositoryInterface $settings)
+ /**
+ * @var Application
+ */
+ protected $app;
+
+ public function __construct(Dispatcher $events, Paths $paths, Util $util, SettingsRepositoryInterface $settings, Application $app)
{
$this->events = $events;
$this->paths = $paths;
$this->util = $util;
$this->settings = $settings;
+ $this->app = $app;
@@ -39,7 +39,8 @@
protected Paths $paths,
protected Util $util,
protected SettingsRepositoryInterface $settings,
- protected UrlGenerator $url
+ protected UrlGenerator $url,
+ protected Application $app,
) {
}

public function adapters(): Collection
@@ -125,7 +132,8 @@
return new Adapters\AwsS3(
new AwsS3Adapter(
new S3Client($s3Config),
- $this->settings->get('fof-upload.awsS3Bucket')
+ $this->settings->get('fof-upload.awsS3Bucket'),
+ $this->app->config('fof_upload_prefix', ''),
)
@@ -107,7 +108,8 @@

$leagueAdapter = new AwsS3Adapter(
new S3Client($s3Config),
- $this->settings->get('fof-upload.awsS3Bucket')
+ $this->settings->get('fof-upload.awsS3Bucket'),
+ $this->app->config('fof_upload_prefix', ''),
);
}

return new Adapters\AwsS3($leagueAdapter, $this->settings, $this->url);
10 changes: 0 additions & 10 deletions patches/fof-upload-src-templates-markdownimagetemplate-php.patch

This file was deleted.

This file was deleted.

0 comments on commit f532929

Please sign in to comment.