[various] use set_default_int in InitExt rather than set_int in DatabaseUpgrade
This commit is contained in:
parent
68d87e3a84
commit
e3e25c1228
3 changed files with 15 additions and 11 deletions
|
@ -32,7 +32,9 @@ class Artists extends Extension
|
|||
|
||||
public function onInitExt(InitExtEvent $event): void
|
||||
{
|
||||
global $config;
|
||||
Image::$prop_types["author"] = ImagePropType::STRING;
|
||||
$config->set_default_int("artistsPerPage", 20);
|
||||
}
|
||||
|
||||
public function onImageInfoSet(ImageInfoSetEvent $event): void
|
||||
|
@ -120,7 +122,6 @@ class Artists extends Extension
|
|||
");
|
||||
$database->execute("ALTER TABLE images ADD COLUMN author VARCHAR(255) NULL");
|
||||
|
||||
$config->set_int("artistsPerPage", 20);
|
||||
$this->set_version("ext_artists_version", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,15 @@ class Forum extends Extension
|
|||
/** @var ForumTheme */
|
||||
protected Themelet $theme;
|
||||
|
||||
public function onInitExt(InitExtEvent $event): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_default_int("forumTitleSubString", 25);
|
||||
$config->set_default_int("forumThreadsPerPage", 15);
|
||||
$config->set_default_int("forumPostsPerPage", 15);
|
||||
$config->set_default_int("forumMaxCharsPerPost", 512);
|
||||
}
|
||||
|
||||
public function onDatabaseUpgrade(DatabaseUpgradeEvent $event): void
|
||||
{
|
||||
global $config, $database;
|
||||
|
@ -46,12 +55,6 @@ class Forum extends Extension
|
|||
");
|
||||
$database->execute("CREATE INDEX forum_posts_date_idx ON forum_posts(date)", []);
|
||||
|
||||
$config->set_int("forumTitleSubString", 25);
|
||||
$config->set_int("forumThreadsPerPage", 15);
|
||||
$config->set_int("forumPostsPerPage", 15);
|
||||
|
||||
$config->set_int("forumMaxCharsPerPost", 512);
|
||||
|
||||
$this->set_version("forum_version", 3);
|
||||
}
|
||||
if ($this->get_version("forum_version") < 2) {
|
||||
|
|
|
@ -11,7 +11,11 @@ class Notes extends Extension
|
|||
|
||||
public function onInitExt(InitExtEvent $event): void
|
||||
{
|
||||
global $config;
|
||||
Image::$prop_types["notes"] = ImagePropType::INT;
|
||||
$config->set_default_int("notesNotesPerPage", 20);
|
||||
$config->set_default_int("notesRequestsPerPage", 20);
|
||||
$config->set_default_int("notesHistoriesPerPage", 20);
|
||||
}
|
||||
|
||||
public function onDatabaseUpgrade(DatabaseUpgradeEvent $event): void
|
||||
|
@ -67,10 +71,6 @@ class Notes extends Extension
|
|||
");
|
||||
$database->execute("CREATE INDEX note_histories_image_id_idx ON note_histories(image_id)", []);
|
||||
|
||||
$config->set_int("notesNotesPerPage", 20);
|
||||
$config->set_int("notesRequestsPerPage", 20);
|
||||
$config->set_int("notesHistoriesPerPage", 20);
|
||||
|
||||
$this->set_version("ext_notes_version", 1);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue