Skip to content

Commit

Permalink
[core] make config.php supported consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Dec 16, 2024
1 parent bc591a4 commit dd990b0
Show file tree
Hide file tree
Showing 32 changed files with 21 additions and 43 deletions.
4 changes: 4 additions & 0 deletions core/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ public static function load_all_extension_info(): void
}
}

abstract class ExtensionConfig
{
}

/**
* Class FormatterExtension
*
Expand Down
3 changes: 2 additions & 1 deletion core/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
));
}

Expand Down
2 changes: 1 addition & 1 deletion ext/auto_tagger/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 0 additions & 2 deletions ext/auto_tagger/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once 'config.php';

use MicroCRUD\ActionColumn;
use MicroCRUD\TextColumn;
use MicroCRUD\Table;
Expand Down
2 changes: 1 addition & 1 deletion ext/cron_uploader/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

abstract class CronUploaderConfig
class CronUploaderConfig extends ExtensionConfig
{
public const DEFAULT_PATH = "cron_uploader";

Expand Down
2 changes: 0 additions & 2 deletions ext/cron_uploader/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once "config.php";

class CronUploader extends Extension
{
/** @var CronUploaderTheme */
Expand Down
2 changes: 1 addition & 1 deletion ext/image/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

abstract class ImageConfig
class ImageConfig extends ExtensionConfig
{
public const VERSION = 'ext_image_version';

Expand Down
2 changes: 0 additions & 2 deletions ext/image/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/image_view_counter/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

abstract class ImageViewCounterConfig
class ImageViewCounterConfig extends ExtensionConfig
{
public const VERSION = 'ext_image_view_counter';
}
4 changes: 0 additions & 4 deletions ext/image_view_counter/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

namespace Shimmie2;

use function MicroHTML\{TD,TH,TR};

require_once "config.php";

class ImageViewCounter extends Extension
{
/** @var ImageViewCounterTheme */
Expand Down
2 changes: 1 addition & 1 deletion ext/index/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion ext/index/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use function MicroHTML\rawHTML;

require_once "config.php";
require_once "events.php";

class Index extends Extension
Expand Down
2 changes: 1 addition & 1 deletion ext/media/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion ext/media/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion ext/post_titles/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion ext/post_titles/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Shimmie2;

require_once "config.php";
require_once "events/post_title_set_event.php";

class PostTitles extends Extension
Expand Down
2 changes: 1 addition & 1 deletion ext/s3/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 0 additions & 2 deletions ext/s3/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

use function MicroHTML\INPUT;

require_once "config.php";

class S3 extends Extension
{
public int $synced = 0;
Expand Down
2 changes: 1 addition & 1 deletion ext/setup/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

class SetupConfig
class SetupConfig extends ExtensionConfig
{
public const TITLE = "title";
public const FRONT_PAGE = "front_page";
Expand Down
2 changes: 0 additions & 2 deletions ext/setup/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

use function MicroHTML\rawHTML;

require_once "config.php";

/*
* Sent when the setup screen's 'set' button has been activated
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/tag_categories/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

abstract class TagCategoriesConfig
class TagCategoriesConfig extends ExtensionConfig
{
public const VERSION = "ext_tag_categories_version";

Expand Down
2 changes: 0 additions & 2 deletions ext/tag_categories/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once "config.php";

class TagCategories extends Extension
{
/** @var TagCategoriesTheme */
Expand Down
2 changes: 1 addition & 1 deletion ext/tag_list/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 0 additions & 2 deletions ext/tag_list/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once "config.php";

class TagList extends Extension
{
/** @var TagListTheme */
Expand Down
2 changes: 1 addition & 1 deletion ext/tag_map/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

class TagMapConfig
class TagMapConfig extends ExtensionConfig
{
public const TAGS_MIN = "tags_min";
public const PAGES = "tag_list_pages";
Expand Down
2 changes: 0 additions & 2 deletions ext/tag_map/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once "config.php";

class TagMap extends Extension
{
/** @var TagMapTheme */
Expand Down
2 changes: 1 addition & 1 deletion ext/transcode/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

class TranscodeConfig
class TranscodeConfig extends ExtensionConfig
{
public const VERSION = "ext_transcode_version";
public const ENGINE = "transcode_engine";
Expand Down
1 change: 0 additions & 1 deletion ext/transcode/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/transcode_video/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion ext/transcode_video/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/upload/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shimmie2;

class UploadConfig
class UploadConfig extends ExtensionConfig
{
public const COUNT = "upload_count";
public const SIZE = "upload_size";
Expand Down
2 changes: 0 additions & 2 deletions ext/upload/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Shimmie2;

require_once "config.php";

/**
* Occurs when some data is being uploaded.
*/
Expand Down

0 comments on commit dd990b0

Please sign in to comment.