From dd990b00372f61430d3178fac3e1abac6e028aba Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 16 Dec 2024 14:34:44 +0000 Subject: [PATCH] [core] make config.php supported consistently --- core/extension.php | 4 ++++ core/util.php | 3 ++- ext/auto_tagger/config.php | 2 +- ext/auto_tagger/main.php | 2 -- ext/cron_uploader/config.php | 2 +- ext/cron_uploader/main.php | 2 -- ext/image/config.php | 2 +- ext/image/main.php | 2 -- ext/image_view_counter/config.php | 2 +- ext/image_view_counter/main.php | 4 ---- ext/index/config.php | 2 +- ext/index/main.php | 1 - ext/media/config.php | 2 +- ext/media/main.php | 1 - ext/post_titles/config.php | 2 +- ext/post_titles/main.php | 1 - ext/s3/config.php | 2 +- ext/s3/main.php | 2 -- ext/setup/config.php | 2 +- ext/setup/main.php | 2 -- ext/tag_categories/config.php | 2 +- ext/tag_categories/main.php | 2 -- ext/tag_list/config.php | 2 +- ext/tag_list/main.php | 2 -- ext/tag_map/config.php | 2 +- ext/tag_map/main.php | 2 -- ext/transcode/config.php | 2 +- ext/transcode/main.php | 1 - ext/transcode_video/config.php | 2 +- ext/transcode_video/main.php | 1 - ext/upload/config.php | 2 +- ext/upload/main.php | 2 -- 32 files changed, 21 insertions(+), 43 deletions(-) diff --git a/core/extension.php b/core/extension.php index cb2a005d8..5071579f5 100644 --- a/core/extension.php +++ b/core/extension.php @@ -273,6 +273,10 @@ public static function load_all_extension_info(): void } } +abstract class ExtensionConfig +{ +} + /** * Class FormatterExtension * diff --git a/core/util.php b/core/util.php index d23f5db05..2b7cc4f03 100644 --- a/core/util.php +++ b/core/util.php @@ -600,7 +600,8 @@ function _load_core_files(): void require_all(array_merge( zglob("core/*.php"), zglob("core/imageboard/*.php"), - zglob("ext/*/info.php") + zglob("ext/*/info.php"), + zglob("ext/*/config.php"), )); } diff --git a/ext/auto_tagger/config.php b/ext/auto_tagger/config.php index 6fd5ed8e2..e526eb906 100644 --- a/ext/auto_tagger/config.php +++ b/ext/auto_tagger/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class AutoTaggerConfig +class AutoTaggerConfig extends ExtensionConfig { public const VERSION = "ext_auto_tagger_ver"; public const ITEMS_PER_PAGE = "auto_tagger_items_per_page"; diff --git a/ext/auto_tagger/main.php b/ext/auto_tagger/main.php index 46bec3a0e..df888cb4b 100644 --- a/ext/auto_tagger/main.php +++ b/ext/auto_tagger/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once 'config.php'; - use MicroCRUD\ActionColumn; use MicroCRUD\TextColumn; use MicroCRUD\Table; diff --git a/ext/cron_uploader/config.php b/ext/cron_uploader/config.php index 1c8270490..da824892c 100644 --- a/ext/cron_uploader/config.php +++ b/ext/cron_uploader/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class CronUploaderConfig +class CronUploaderConfig extends ExtensionConfig { public const DEFAULT_PATH = "cron_uploader"; diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index 5b699bdf7..8eeffa67f 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once "config.php"; - class CronUploader extends Extension { /** @var CronUploaderTheme */ diff --git a/ext/image/config.php b/ext/image/config.php index ce65612b8..9750e4400 100644 --- a/ext/image/config.php +++ b/ext/image/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class ImageConfig +class ImageConfig extends ExtensionConfig { public const VERSION = 'ext_image_version'; diff --git a/ext/image/main.php b/ext/image/main.php index 5dba894b0..126159823 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -10,8 +10,6 @@ use function MicroHTML\{INPUT, emptyHTML, STYLE}; -require_once "config.php"; - /** * A class to handle adding / getting / removing image files from the disk. */ diff --git a/ext/image_view_counter/config.php b/ext/image_view_counter/config.php index 2103e6e91..223e24a0d 100644 --- a/ext/image_view_counter/config.php +++ b/ext/image_view_counter/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class ImageViewCounterConfig +class ImageViewCounterConfig extends ExtensionConfig { public const VERSION = 'ext_image_view_counter'; } diff --git a/ext/image_view_counter/main.php b/ext/image_view_counter/main.php index 0ccad1e35..508891c3b 100644 --- a/ext/image_view_counter/main.php +++ b/ext/image_view_counter/main.php @@ -4,10 +4,6 @@ namespace Shimmie2; -use function MicroHTML\{TD,TH,TR}; - -require_once "config.php"; - class ImageViewCounter extends Extension { /** @var ImageViewCounterTheme */ diff --git a/ext/index/config.php b/ext/index/config.php index 7ba35a029..032679b8b 100644 --- a/ext/index/config.php +++ b/ext/index/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class IndexConfig +class IndexConfig extends ExtensionConfig { public const IMAGES = "index_images"; public const SHOW_PAGE_SIZES = "index_show_page_sizes"; diff --git a/ext/index/main.php b/ext/index/main.php index 12022d159..61fabbdc9 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -11,7 +11,6 @@ use function MicroHTML\rawHTML; -require_once "config.php"; require_once "events.php"; class Index extends Extension diff --git a/ext/media/config.php b/ext/media/config.php index 7427aded7..c2bf06b20 100644 --- a/ext/media/config.php +++ b/ext/media/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class MediaConfig +class MediaConfig extends ExtensionConfig { public const FFMPEG_PATH = "media_ffmpeg_path"; public const FFPROBE_PATH = "media_ffprobe_path"; diff --git a/ext/media/main.php b/ext/media/main.php index 8a2a639bb..ace80367d 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Input\{InputInterface,InputArgument}; use Symfony\Component\Console\Output\OutputInterface; -require_once "config.php"; require_once "events.php"; require_once "media_engine.php"; require_once "video_codecs.php"; diff --git a/ext/post_titles/config.php b/ext/post_titles/config.php index a711e4355..ab7fad93b 100644 --- a/ext/post_titles/config.php +++ b/ext/post_titles/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class PostTitlesConfig +class PostTitlesConfig extends ExtensionConfig { public const VERSION = "ext_post_titles_version"; public const DEFAULT_TO_FILENAME = "post_titles_default_to_filename"; diff --git a/ext/post_titles/main.php b/ext/post_titles/main.php index 115577809..ebe5df2ef 100644 --- a/ext/post_titles/main.php +++ b/ext/post_titles/main.php @@ -4,7 +4,6 @@ namespace Shimmie2; -require_once "config.php"; require_once "events/post_title_set_event.php"; class PostTitles extends Extension diff --git a/ext/s3/config.php b/ext/s3/config.php index 818f2a353..35f95e45c 100644 --- a/ext/s3/config.php +++ b/ext/s3/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class S3Config +class S3Config extends ExtensionConfig { public const ACCESS_KEY_ID = 's3_access_key_id'; public const ACCESS_KEY_SECRET = 's3_access_key_secret'; diff --git a/ext/s3/main.php b/ext/s3/main.php index 80c6d4548..52d070cbd 100644 --- a/ext/s3/main.php +++ b/ext/s3/main.php @@ -10,8 +10,6 @@ use function MicroHTML\INPUT; -require_once "config.php"; - class S3 extends Extension { public int $synced = 0; diff --git a/ext/setup/config.php b/ext/setup/config.php index bcf0b5809..bfc1546ab 100644 --- a/ext/setup/config.php +++ b/ext/setup/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class SetupConfig +class SetupConfig extends ExtensionConfig { public const TITLE = "title"; public const FRONT_PAGE = "front_page"; diff --git a/ext/setup/main.php b/ext/setup/main.php index f453f641a..be9680268 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -10,8 +10,6 @@ use function MicroHTML\rawHTML; -require_once "config.php"; - /* * Sent when the setup screen's 'set' button has been activated */ diff --git a/ext/tag_categories/config.php b/ext/tag_categories/config.php index 17c98bcff..c3bd63e17 100644 --- a/ext/tag_categories/config.php +++ b/ext/tag_categories/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -abstract class TagCategoriesConfig +class TagCategoriesConfig extends ExtensionConfig { public const VERSION = "ext_tag_categories_version"; diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php index 871e7abbf..8ce009e20 100644 --- a/ext/tag_categories/main.php +++ b/ext/tag_categories/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once "config.php"; - class TagCategories extends Extension { /** @var TagCategoriesTheme */ diff --git a/ext/tag_list/config.php b/ext/tag_list/config.php index 9eee797ef..fd0f59ac5 100644 --- a/ext/tag_list/config.php +++ b/ext/tag_list/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class TagListConfig +class TagListConfig extends ExtensionConfig { public const LENGTH = "tag_list_length"; public const POPULAR_TAG_LIST_LENGTH = "popular_tag_list_length"; diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 629aa1374..2d589cfc7 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once "config.php"; - class TagList extends Extension { /** @var TagListTheme */ diff --git a/ext/tag_map/config.php b/ext/tag_map/config.php index 4077b13d6..20f4a3ae5 100644 --- a/ext/tag_map/config.php +++ b/ext/tag_map/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class TagMapConfig +class TagMapConfig extends ExtensionConfig { public const TAGS_MIN = "tags_min"; public const PAGES = "tag_list_pages"; diff --git a/ext/tag_map/main.php b/ext/tag_map/main.php index 1268c8207..47adbe865 100644 --- a/ext/tag_map/main.php +++ b/ext/tag_map/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once "config.php"; - class TagMap extends Extension { /** @var TagMapTheme */ diff --git a/ext/transcode/config.php b/ext/transcode/config.php index 598c16bfd..b5cb4b86a 100644 --- a/ext/transcode/config.php +++ b/ext/transcode/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class TranscodeConfig +class TranscodeConfig extends ExtensionConfig { public const VERSION = "ext_transcode_version"; public const ENGINE = "transcode_engine"; diff --git a/ext/transcode/main.php b/ext/transcode/main.php index c90d85378..c14dd09c9 100644 --- a/ext/transcode/main.php +++ b/ext/transcode/main.php @@ -4,7 +4,6 @@ namespace Shimmie2; -require_once "config.php"; /* * This is used by the image transcoding code when there is an error while transcoding */ diff --git a/ext/transcode_video/config.php b/ext/transcode_video/config.php index 9e29c115d..0bb320fb7 100644 --- a/ext/transcode_video/config.php +++ b/ext/transcode_video/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class TranscodeVideoConfig +class TranscodeVideoConfig extends ExtensionConfig { public const ENABLED = "transcode_video_enabled"; public const UPLOAD_TO_NATIVE_CONTAINER = "transcode_video_upload_to_native_container"; diff --git a/ext/transcode_video/main.php b/ext/transcode_video/main.php index e3eab2662..0e3a60f70 100644 --- a/ext/transcode_video/main.php +++ b/ext/transcode_video/main.php @@ -4,7 +4,6 @@ namespace Shimmie2; -require_once "config.php"; /* * This is used by the image transcoding code when there is an error while transcoding */ diff --git a/ext/upload/config.php b/ext/upload/config.php index 313b05368..eb1084cb5 100644 --- a/ext/upload/config.php +++ b/ext/upload/config.php @@ -4,7 +4,7 @@ namespace Shimmie2; -class UploadConfig +class UploadConfig extends ExtensionConfig { public const COUNT = "upload_count"; public const SIZE = "upload_size"; diff --git a/ext/upload/main.php b/ext/upload/main.php index d1439917a..b11c3738b 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -4,8 +4,6 @@ namespace Shimmie2; -require_once "config.php"; - /** * Occurs when some data is being uploaded. */