From 6dc4234aa45f8c90e393b0b5e41804f608f3b5ee Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Wed, 24 Jan 2024 21:37:12 -0700 Subject: [PATCH 001/102] Creates SMF\Db\Schema and descendents Signed-off-by: Jon Stovell --- .gitignore | 1 + Sources/Db/Schema/Column.php | 202 ++ Sources/Db/Schema/Index.php | 134 ++ Sources/Db/Schema/Table.php | 126 ++ Sources/Db/Schema/v3_0/AdminInfoFiles.php | 141 ++ Sources/Db/Schema/v3_0/ApprovalQueue.php | 74 + Sources/Db/Schema/v3_0/Attachments.php | 191 ++ Sources/Db/Schema/v3_0/BackgroundTasks.php | 95 + Sources/Db/Schema/v3_0/BanGroups.php | 128 ++ Sources/Db/Schema/v3_0/BanItems.php | 127 ++ Sources/Db/Schema/v3_0/BoardPermissions.php | 1629 +++++++++++++++++ .../Db/Schema/v3_0/BoardPermissionsView.php | 98 + Sources/Db/Schema/v3_0/Boards.php | 235 +++ Sources/Db/Schema/v3_0/Calendar.php | 148 ++ Sources/Db/Schema/v3_0/CalendarHolidays.php | 625 +++++++ Sources/Db/Schema/v3_0/Categories.php | 101 + Sources/Db/Schema/v3_0/CustomFields.php | 279 +++ Sources/Db/Schema/v3_0/GroupModerators.php | 76 + Sources/Db/Schema/v3_0/LogActions.php | 165 ++ Sources/Db/Schema/v3_0/LogActivity.php | 103 ++ Sources/Db/Schema/v3_0/LogBanned.php | 101 + Sources/Db/Schema/v3_0/LogBoards.php | 83 + Sources/Db/Schema/v3_0/LogComments.php | 146 ++ Sources/Db/Schema/v3_0/LogDigest.php | 88 + Sources/Db/Schema/v3_0/LogErrors.php | 151 ++ Sources/Db/Schema/v3_0/LogFloodcontrol.php | 95 + Sources/Db/Schema/v3_0/LogMarkRead.php | 83 + Sources/Db/Schema/v3_0/LogMemberNotices.php | 81 + Sources/Db/Schema/v3_0/LogNotify.php | 97 + Sources/Db/Schema/v3_0/LogOnline.php | 125 ++ Sources/Db/Schema/v3_0/LogPolls.php | 86 + Sources/Db/Schema/v3_0/LogReported.php | 176 ++ .../Db/Schema/v3_0/LogReportedComments.php | 122 ++ Sources/Db/Schema/v3_0/LogScheduledTasks.php | 86 + Sources/Db/Schema/v3_0/LogSearchMessages.php | 76 + Sources/Db/Schema/v3_0/LogSearchResults.php | 97 + Sources/Db/Schema/v3_0/LogSearchSubjects.php | 82 + Sources/Db/Schema/v3_0/LogSearchTopics.php | 76 + Sources/Db/Schema/v3_0/LogSpiderHits.php | 102 ++ Sources/Db/Schema/v3_0/LogSpiderStats.php | 88 + Sources/Db/Schema/v3_0/LogSubscribed.php | 160 ++ Sources/Db/Schema/v3_0/LogTopics.php | 95 + Sources/Db/Schema/v3_0/MailQueue.php | 130 ++ Sources/Db/Schema/v3_0/MemberLogins.php | 102 ++ Sources/Db/Schema/v3_0/Membergroups.php | 211 +++ Sources/Db/Schema/v3_0/Members.php | 461 +++++ Sources/Db/Schema/v3_0/Mentions.php | 104 ++ Sources/Db/Schema/v3_0/MessageIcons.php | 169 ++ Sources/Db/Schema/v3_0/Messages.php | 265 +++ Sources/Db/Schema/v3_0/ModeratorGroups.php | 76 + Sources/Db/Schema/v3_0/Moderators.php | 76 + Sources/Db/Schema/v3_0/PackageServers.php | 105 ++ Sources/Db/Schema/v3_0/PermissionProfiles.php | 92 + Sources/Db/Schema/v3_0/Permissions.php | 286 +++ Sources/Db/Schema/v3_0/PersonalMessages.php | 135 ++ Sources/Db/Schema/v3_0/PmLabeledMessages.php | 76 + Sources/Db/Schema/v3_0/PmLabels.php | 83 + Sources/Db/Schema/v3_0/PmRecipients.php | 119 ++ Sources/Db/Schema/v3_0/PmRules.php | 118 ++ Sources/Db/Schema/v3_0/PollChoices.php | 90 + Sources/Db/Schema/v3_0/Polls.php | 145 ++ Sources/Db/Schema/v3_0/Qanda.php | 94 + Sources/Db/Schema/v3_0/ScheduledTasks.php | 243 +++ Sources/Db/Schema/v3_0/Sessions.php | 82 + Sources/Db/Schema/v3_0/Settings.php | 891 +++++++++ Sources/Db/Schema/v3_0/SmileyFiles.php | 84 + Sources/Db/Schema/v3_0/Smileys.php | 104 ++ Sources/Db/Schema/v3_0/Spiders.php | 191 ++ Sources/Db/Schema/v3_0/Subscriptions.php | 143 ++ Sources/Db/Schema/v3_0/Themes.php | 149 ++ Sources/Db/Schema/v3_0/Topics.php | 242 +++ Sources/Db/Schema/v3_0/UserAlerts.php | 142 ++ Sources/Db/Schema/v3_0/UserAlertsPrefs.php | 228 +++ Sources/Db/Schema/v3_0/UserDrafts.php | 163 ++ Sources/Db/Schema/v3_0/UserLikes.php | 103 ++ Sources/Db/Schema/v3_0/index.php | 9 + other/install_3-0_MySQL.sql | 10 +- 77 files changed, 12693 insertions(+), 2 deletions(-) create mode 100644 Sources/Db/Schema/Column.php create mode 100644 Sources/Db/Schema/Index.php create mode 100644 Sources/Db/Schema/Table.php create mode 100644 Sources/Db/Schema/v3_0/AdminInfoFiles.php create mode 100644 Sources/Db/Schema/v3_0/ApprovalQueue.php create mode 100644 Sources/Db/Schema/v3_0/Attachments.php create mode 100644 Sources/Db/Schema/v3_0/BackgroundTasks.php create mode 100644 Sources/Db/Schema/v3_0/BanGroups.php create mode 100644 Sources/Db/Schema/v3_0/BanItems.php create mode 100644 Sources/Db/Schema/v3_0/BoardPermissions.php create mode 100644 Sources/Db/Schema/v3_0/BoardPermissionsView.php create mode 100644 Sources/Db/Schema/v3_0/Boards.php create mode 100644 Sources/Db/Schema/v3_0/Calendar.php create mode 100644 Sources/Db/Schema/v3_0/CalendarHolidays.php create mode 100644 Sources/Db/Schema/v3_0/Categories.php create mode 100644 Sources/Db/Schema/v3_0/CustomFields.php create mode 100644 Sources/Db/Schema/v3_0/GroupModerators.php create mode 100644 Sources/Db/Schema/v3_0/LogActions.php create mode 100644 Sources/Db/Schema/v3_0/LogActivity.php create mode 100644 Sources/Db/Schema/v3_0/LogBanned.php create mode 100644 Sources/Db/Schema/v3_0/LogBoards.php create mode 100644 Sources/Db/Schema/v3_0/LogComments.php create mode 100644 Sources/Db/Schema/v3_0/LogDigest.php create mode 100644 Sources/Db/Schema/v3_0/LogErrors.php create mode 100644 Sources/Db/Schema/v3_0/LogFloodcontrol.php create mode 100644 Sources/Db/Schema/v3_0/LogMarkRead.php create mode 100644 Sources/Db/Schema/v3_0/LogMemberNotices.php create mode 100644 Sources/Db/Schema/v3_0/LogNotify.php create mode 100644 Sources/Db/Schema/v3_0/LogOnline.php create mode 100644 Sources/Db/Schema/v3_0/LogPolls.php create mode 100644 Sources/Db/Schema/v3_0/LogReported.php create mode 100644 Sources/Db/Schema/v3_0/LogReportedComments.php create mode 100644 Sources/Db/Schema/v3_0/LogScheduledTasks.php create mode 100644 Sources/Db/Schema/v3_0/LogSearchMessages.php create mode 100644 Sources/Db/Schema/v3_0/LogSearchResults.php create mode 100644 Sources/Db/Schema/v3_0/LogSearchSubjects.php create mode 100644 Sources/Db/Schema/v3_0/LogSearchTopics.php create mode 100644 Sources/Db/Schema/v3_0/LogSpiderHits.php create mode 100644 Sources/Db/Schema/v3_0/LogSpiderStats.php create mode 100644 Sources/Db/Schema/v3_0/LogSubscribed.php create mode 100644 Sources/Db/Schema/v3_0/LogTopics.php create mode 100644 Sources/Db/Schema/v3_0/MailQueue.php create mode 100644 Sources/Db/Schema/v3_0/MemberLogins.php create mode 100644 Sources/Db/Schema/v3_0/Membergroups.php create mode 100644 Sources/Db/Schema/v3_0/Members.php create mode 100644 Sources/Db/Schema/v3_0/Mentions.php create mode 100644 Sources/Db/Schema/v3_0/MessageIcons.php create mode 100644 Sources/Db/Schema/v3_0/Messages.php create mode 100644 Sources/Db/Schema/v3_0/ModeratorGroups.php create mode 100644 Sources/Db/Schema/v3_0/Moderators.php create mode 100644 Sources/Db/Schema/v3_0/PackageServers.php create mode 100644 Sources/Db/Schema/v3_0/PermissionProfiles.php create mode 100644 Sources/Db/Schema/v3_0/Permissions.php create mode 100644 Sources/Db/Schema/v3_0/PersonalMessages.php create mode 100644 Sources/Db/Schema/v3_0/PmLabeledMessages.php create mode 100644 Sources/Db/Schema/v3_0/PmLabels.php create mode 100644 Sources/Db/Schema/v3_0/PmRecipients.php create mode 100644 Sources/Db/Schema/v3_0/PmRules.php create mode 100644 Sources/Db/Schema/v3_0/PollChoices.php create mode 100644 Sources/Db/Schema/v3_0/Polls.php create mode 100644 Sources/Db/Schema/v3_0/Qanda.php create mode 100644 Sources/Db/Schema/v3_0/ScheduledTasks.php create mode 100644 Sources/Db/Schema/v3_0/Sessions.php create mode 100644 Sources/Db/Schema/v3_0/Settings.php create mode 100644 Sources/Db/Schema/v3_0/SmileyFiles.php create mode 100644 Sources/Db/Schema/v3_0/Smileys.php create mode 100644 Sources/Db/Schema/v3_0/Spiders.php create mode 100644 Sources/Db/Schema/v3_0/Subscriptions.php create mode 100644 Sources/Db/Schema/v3_0/Themes.php create mode 100644 Sources/Db/Schema/v3_0/Topics.php create mode 100644 Sources/Db/Schema/v3_0/UserAlerts.php create mode 100644 Sources/Db/Schema/v3_0/UserAlertsPrefs.php create mode 100644 Sources/Db/Schema/v3_0/UserDrafts.php create mode 100644 Sources/Db/Schema/v3_0/UserLikes.php create mode 100644 Sources/Db/Schema/v3_0/index.php diff --git a/.gitignore b/.gitignore index a7a975ea6f..ce93b1900c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !/Languages/en_US/ /Languages/en_US/agreement.txt Settings.php +!Sources/Db/Schema/*/Settings.php Settings_bak.php Settings_org.php db_last_error.php diff --git a/Sources/Db/Schema/Column.php b/Sources/Db/Schema/Column.php new file mode 100644 index 0000000000..45f0887cd4 --- /dev/null +++ b/Sources/Db/Schema/Column.php @@ -0,0 +1,202 @@ +name = strtolower($name); + $this->type = strtolower($type); + + if (isset($default)) { + $this->default = $default === 'NULL' ? null : $default; + } + + foreach (['auto', 'size', 'unsigned', 'not_null'] as $var) { + if (isset($var)) { + $this->{$var} = ${$var}; + } + } + + if (isset($charset)) { + $this->charset = strtolower($charset); + } + } + + /** + * Adds this column to the specified table. + * + * @see SMF\Db\DatabaseApi::add_column + * + * @param string $table_name The name of the table to add the column to. + * @param string $if_exists What to do if the column exists. + * If 'update', column is updated. + * @return bool Whether or not the operation was successful. + */ + public function add(string $table_name, string $if_exists = 'update'): bool + { + return Db::$db->add_column( + $table_name, + get_object_vars($this), + [], + $if_exists, + ); + } + + /** + * Updates the column in the database to match the definition given by this + * object's properties. + * + * @see SMF\Db\DatabaseApi::change_column + * + * @param string $table_name Name of the table that contains this column. + * @return bool Whether or not the operation was successful. + */ + public function alter(string $table_name): bool + { + return Db::$db->change_column( + $table_name, + $this->name, + get_object_vars($this), + ); + } + + /** + * Drops this column from the specified table. + * + * @see SMF\Db\DatabaseApi::remove_column + * + * @param string $table_name The name of the table to drop the column from. + * @return bool Whether or not the operation was successful. + */ + public function drop(string $table_name): bool + { + return Db::$db->remove_column( + $table_name, + $this->name, + ); + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/Index.php b/Sources/Db/Schema/Index.php new file mode 100644 index 0000000000..aec6f81d07 --- /dev/null +++ b/Sources/Db/Schema/Index.php @@ -0,0 +1,134 @@ +columns = array_map('strtolower', $columns); + + $this->type = isset($type) ? strtolower((string) $type) : null; + + if (($this->type ?? null) !== 'primary') { + $this->name = $name ?? 'idx_' . trim(implode('_', preg_replace(['/\s*/', '/\(\d+\)/'], ['', ''], $this->columns))); + } + } + + /** + * Adds this index to the specified table. + * + * @see SMF\Db\DatabaseApi::add_index + * + * @param string $table_name The name of the table to add the index to. + * @param string $if_exists What to do if the index exists. + * If 'update', index is updated. + * @return bool Whether or not the operation was successful. + */ + public function add(string $table_name, string $if_exists = 'update'): bool + { + return Db::$db->add_index( + $table_name, + get_object_vars($this), + [], + $if_exists, + ); + } + + /** + * Updates the index in the database to match the definition given by this + * object's properties. + * + * @param string $table_name Name of the table that contains this index. + * @return bool Whether or not the operation was successful. + */ + public function alter(string $table_name): bool + { + // This method is really just a convenient way to replace an existing index. + $this->drop($table_name); + + return $this->add($table_name); + } + + /** + * Drops this column from the specified table. + * + * @see SMF\Db\DatabaseApi::remove_column + * + * @param string $table_name The name of the table to drop the column from. + * @return bool Whether or not the operation was successful. + */ + public function drop(string $table_name): bool + { + return Db::$db->remove_index( + $table_name, + $this->name, + ); + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/Table.php b/Sources/Db/Schema/Table.php new file mode 100644 index 0000000000..8e1510e5c7 --- /dev/null +++ b/Sources/Db/Schema/Table.php @@ -0,0 +1,126 @@ +create_table( + $this->name, + array_map('get_object_vars', $this->columns), + array_map('get_object_vars', $this->indices), + $parameters, + $if_exists, + ); + } + + /** + * Drop the table from the database. + * + * @see SMF\Db\DatabaseApi::drop_table + * + * @return bool Whether or not the operation was successful. + */ + public function drop(): bool + { + return Db::$db->drop_table($this->name); + } + + /** + * Get the table's current structure as it exists in the database. + * + * @see SMF\Db\DatabaseApi::table_structure + * + * @return array An array of table structure info: the name, the column + * info from SMF\Db\DatabaseApi::list_columns() and index info from + * SMF\Db\DatabaseApi::list_indexes(). + */ + public function getStructure(): array + { + return Db::$db->table_structure($this->name); + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/AdminInfoFiles.php b/Sources/Db/Schema/v3_0/AdminInfoFiles.php new file mode 100644 index 0000000000..94cd2f104b --- /dev/null +++ b/Sources/Db/Schema/v3_0/AdminInfoFiles.php @@ -0,0 +1,141 @@ + 1, + 'filename' => 'current-version.js', + 'path' => '/smf/', + 'parameters' => 'version=%3$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 2, + 'filename' => 'detailed-version.js', + 'path' => '/smf/', + 'parameters' => 'language=%1$s&version=%3$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 3, + 'filename' => 'latest-news.js', + 'path' => '/smf/', + 'parameters' => 'language=%1$s&format=%2$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 4, + 'filename' => 'latest-versions.txt', + 'path' => '/smf/', + 'parameters' => 'version=%3$s', + 'data' => '', + 'filetype' => 'text/plain', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'admin_info_files'; + + $this->columns = [ + new Column( + name: 'id_file', + type: 'tinyint', + unsigned: true, + auto: true, + ), + new Column( + name: 'filename', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'path', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'parameters', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'data', + type: 'text', + not_null: true, + ), + new Column( + name: 'filetype', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_file', + ], + ), + new Index( + name: 'idx_filename', + columns: [ + 'filename(30)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/ApprovalQueue.php b/Sources/Db/Schema/v3_0/ApprovalQueue.php new file mode 100644 index 0000000000..7cbc20fa2c --- /dev/null +++ b/Sources/Db/Schema/v3_0/ApprovalQueue.php @@ -0,0 +1,74 @@ +name = 'approval_queue'; + + $this->columns = [ + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_attach', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_event', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Attachments.php b/Sources/Db/Schema/v3_0/Attachments.php new file mode 100644 index 0000000000..3560af0f9b --- /dev/null +++ b/Sources/Db/Schema/v3_0/Attachments.php @@ -0,0 +1,191 @@ +name = 'attachments'; + + $this->columns = [ + new Column( + name: 'id_attach', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_thumb', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_folder', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'attachment_type', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'filename', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'file_hash', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'fileext', + type: 'varchar', + size: 8, + not_null: true, + default: '', + ), + new Column( + name: 'size', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'downloads', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'width', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'height', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'mime_type', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_attach', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_attach', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_attachment_type', + columns: [ + 'attachment_type', + ], + ), + new Index( + name: 'idx_id_thumb', + columns: [ + 'id_thumb', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/BackgroundTasks.php b/Sources/Db/Schema/v3_0/BackgroundTasks.php new file mode 100644 index 0000000000..ffb45eeabe --- /dev/null +++ b/Sources/Db/Schema/v3_0/BackgroundTasks.php @@ -0,0 +1,95 @@ +name = 'background_tasks'; + + $this->columns = [ + new Column( + name: 'id_task', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'task_file', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'task_class', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'task_data', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'claimed_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_task', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/BanGroups.php b/Sources/Db/Schema/v3_0/BanGroups.php new file mode 100644 index 0000000000..e4df98deca --- /dev/null +++ b/Sources/Db/Schema/v3_0/BanGroups.php @@ -0,0 +1,128 @@ +name = 'ban_groups'; + + $this->columns = [ + new Column( + name: 'id_ban_group', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'ban_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'expire_time', + type: 'int', + unsigned: true, + ), + new Column( + name: 'cannot_access', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_register', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_post', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_login', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'reason', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'notes', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/BanItems.php b/Sources/Db/Schema/v3_0/BanItems.php new file mode 100644 index 0000000000..51daa7d959 --- /dev/null +++ b/Sources/Db/Schema/v3_0/BanItems.php @@ -0,0 +1,127 @@ +name = 'ban_items'; + + $this->columns = [ + new Column( + name: 'id_ban', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_ban_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip_low', + type: 'inet', + size: 16, + ), + new Column( + name: 'ip_high', + type: 'inet', + size: 16, + ), + new Column( + name: 'hostname', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'email_address', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hits', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban', + ], + ), + new Index( + name: 'idx_id_ban_group', + columns: [ + 'id_ban_group', + ], + ), + new Index( + name: 'idx_id_ban_ip', + columns: [ + 'ip_low', + 'ip_high', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/BoardPermissions.php b/Sources/Db/Schema/v3_0/BoardPermissions.php new file mode 100644 index 0000000000..c5d80de2c1 --- /dev/null +++ b/Sources/Db/Schema/v3_0/BoardPermissions.php @@ -0,0 +1,1629 @@ + -1, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_add_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_edit_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'board_permissions'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + default: 0, + ), + new Column( + name: 'id_profile', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'permission', + type: 'varchar', + size: 30, + default: '', + ), + new Column( + name: 'add_deny', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_profile', + 'permission', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/BoardPermissionsView.php b/Sources/Db/Schema/v3_0/BoardPermissionsView.php new file mode 100644 index 0000000000..80c615b108 --- /dev/null +++ b/Sources/Db/Schema/v3_0/BoardPermissionsView.php @@ -0,0 +1,98 @@ + -1, + 'id_board' => 1, + 'deny' => 0, + ], + [ + 'id_group' => 0, + 'id_board' => 1, + 'deny' => 0, + ], + [ + 'id_group' => 2, + 'id_board' => 1, + 'deny' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'board_permissions_view'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + ), + new Column( + name: 'deny', + type: 'smallint', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_board', + 'deny', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Boards.php b/Sources/Db/Schema/v3_0/Boards.php new file mode 100644 index 0000000000..a62878d3aa --- /dev/null +++ b/Sources/Db/Schema/v3_0/Boards.php @@ -0,0 +1,235 @@ + 1, + 'id_cat' => 1, + 'board_order' => 1, + 'id_last_msg' => 1, + 'id_msg_updated' => 1, + 'name' => '{$default_board_name}', + 'description' => '{$default_board_description}', + 'num_topics' => 1, + 'num_posts' => 1, + 'member_groups' => '-1,0,2', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'boards'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_cat', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'child_level', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_parent', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'board_order', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_last_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg_updated', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '-1,0', + ), + new Column( + name: 'id_profile', + type: 'smallint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'num_topics', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_posts', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'count_posts', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'override_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_posts', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_topics', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'redirect', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'deny_member_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + ], + ), + new Index( + name: 'idx_categories', + type: 'unique', + columns: [ + 'id_cat', + 'id_board', + ], + ), + new Index( + name: 'idx_id_parent', + columns: [ + 'id_parent', + ], + ), + new Index( + name: 'idx_id_msg_updated', + columns: [ + 'id_msg_updated', + ], + ), + new Index( + name: 'idx_member_groups', + columns: [ + 'member_groups(48)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Calendar.php b/Sources/Db/Schema/v3_0/Calendar.php new file mode 100644 index 0000000000..eb25e1f19f --- /dev/null +++ b/Sources/Db/Schema/v3_0/Calendar.php @@ -0,0 +1,148 @@ +name = 'calendar'; + + $this->columns = [ + new Column( + name: 'id_event', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'start_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'end_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'start_time', + type: 'time', + ), + new Column( + name: 'end_time', + type: 'time', + ), + new Column( + name: 'timezone', + type: 'varchar', + size: 80, + ), + new Column( + name: 'location', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_event', + ], + ), + new Index( + name: 'idx_start_date', + columns: [ + 'start_date', + ], + ), + new Index( + name: 'idx_end_date', + columns: [ + 'end_date', + ], + ), + new Index( + name: 'idx_topic', + columns: [ + 'id_topic', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/CalendarHolidays.php b/Sources/Db/Schema/v3_0/CalendarHolidays.php new file mode 100644 index 0000000000..a335707280 --- /dev/null +++ b/Sources/Db/Schema/v3_0/CalendarHolidays.php @@ -0,0 +1,625 @@ + 'New Year\'s', + 'event_date' => '1004-01-01', + ], + [ + 'title' => 'Christmas', + 'event_date' => '1004-12-25', + ], + [ + 'title' => 'Valentine\'s Day', + 'event_date' => '1004-02-14', + ], + [ + 'title' => 'St. Patrick\'s Day', + 'event_date' => '1004-03-17', + ], + [ + 'title' => 'April Fools', + 'event_date' => '1004-04-01', + ], + [ + 'title' => 'Earth Day', + 'event_date' => '1004-04-22', + ], + [ + 'title' => 'United Nations Day', + 'event_date' => '1004-10-24', + ], + [ + 'title' => 'Halloween', + 'event_date' => '1004-10-31', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2010-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2011-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2012-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2013-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2014-05-11', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2015-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2016-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2017-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2018-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2019-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2020-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2021-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2022-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2023-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2024-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2025-05-11', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2026-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2027-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2028-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2029-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2030-05-12', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2010-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2011-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2012-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2013-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2014-06-15', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2015-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2016-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2017-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2018-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2019-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2020-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2021-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2022-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2023-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2024-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2025-06-15', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2026-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2027-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2028-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2029-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2030-06-16', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2010-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2011-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2012-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2013-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2014-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2015-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2016-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2017-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2018-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2019-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2020-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2021-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2022-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2023-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2024-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2025-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2026-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2027-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2028-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2029-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2030-06-21', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2010-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2011-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2012-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2013-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2014-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2015-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2016-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2017-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2018-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2019-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2020-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2021-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2022-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2023-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2024-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2025-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2026-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2027-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2028-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2029-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2030-03-20', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2010-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2011-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2012-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2013-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2014-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2015-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2016-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2017-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2018-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2019-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2020-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2021-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2022-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2023-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2024-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2025-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2026-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2027-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2028-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2029-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2030-12-21', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2010-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2011-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2012-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2013-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2014-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2015-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2016-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2017-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2018-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2019-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2020-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2021-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2022-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2023-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2024-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2025-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2026-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2027-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2028-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2029-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2030-09-22', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'calendar_holidays'; + + $this->columns = [ + new Column( + name: 'id_holiday', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'event_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_holiday', + ], + ), + new Index( + name: 'idx_event_date', + columns: [ + 'event_date', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Categories.php b/Sources/Db/Schema/v3_0/Categories.php new file mode 100644 index 0000000000..519d63d723 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Categories.php @@ -0,0 +1,101 @@ + 1, + 'cat_order' => 0, + 'name' => '{$default_category_name}', + 'description' => '', + 'can_collapse' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'categories'; + + $this->columns = [ + new Column( + name: 'id_cat', + type: 'tinyint', + unsigned: true, + auto: true, + ), + new Column( + name: 'cat_order', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'can_collapse', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_cat', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/CustomFields.php b/Sources/Db/Schema/v3_0/CustomFields.php new file mode 100644 index 0000000000..46f9537178 --- /dev/null +++ b/Sources/Db/Schema/v3_0/CustomFields.php @@ -0,0 +1,279 @@ + 'cust_icq', + 'field_name' => '{icq}', + 'field_desc' => '{icq_desc}', + 'field_type' => 'text', + 'field_length' => 12, + 'field_options' => '', + 'field_order' => 1, + 'mask' => 'regex~[1-9][0-9]{4,9}~i', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => 'ICQ - {INPUT}', + 'placement' => 1, + ], + [ + 'col_name' => 'cust_skype', + 'field_name' => '{skype}', + 'field_desc' => '{skype_desc}', + 'field_type' => 'text', + 'field_length' => 32, + 'field_options' => '', + 'field_order' => 2, + 'mask' => 'nohtml', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => '{INPUT} ', + 'placement' => 1, + ], + [ + 'col_name' => 'cust_loca', + 'field_name' => '{location}', + 'field_desc' => '{location_desc}', + 'field_type' => 'text', + 'field_length' => 50, + 'field_options' => '', + 'field_order' => 4, + 'mask' => 'nohtml', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => '', + 'placement' => 0, + ], + [ + 'col_name' => 'cust_gender', + 'field_name' => '{gender}', + 'field_desc' => '{gender_desc}', + 'field_type' => 'radio', + 'field_length' => 255, + 'field_options' => '{gender_0},{gender_1},{gender_2}', + 'field_order' => 5, + 'mask' => 'nohtml', + 'show_reg' => 1, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '{gender_0}', + 'enclose' => '', + 'placement' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'custom_fields'; + + $this->columns = [ + new Column( + name: 'id_field', + type: 'smallint', + auto: true, + ), + new Column( + name: 'col_name', + type: 'varchar', + size: 12, + not_null: true, + default: '', + ), + new Column( + name: 'field_name', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'field_desc', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'field_type', + type: 'varchar', + size: 8, + not_null: true, + default: 'text', + ), + new Column( + name: 'field_length', + type: 'smallint', + not_null: true, + default: 255, + ), + new Column( + name: 'field_options', + type: 'text', + not_null: true, + ), + new Column( + name: 'field_order', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'mask', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'show_reg', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_display', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_mlist', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_profile', + type: 'varchar', + size: 20, + not_null: true, + default: 'forumprofile', + ), + new Column( + name: 'private', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'active', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'bbc', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'can_search', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'default_value', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'enclose', + type: 'text', + not_null: true, + ), + new Column( + name: 'placement', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_field', + ], + ), + new Index( + name: 'idx_col_name', + type: 'unique', + columns: [ + 'col_name', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/GroupModerators.php b/Sources/Db/Schema/v3_0/GroupModerators.php new file mode 100644 index 0000000000..1d588e6518 --- /dev/null +++ b/Sources/Db/Schema/v3_0/GroupModerators.php @@ -0,0 +1,76 @@ +name = 'group_moderators'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogActions.php b/Sources/Db/Schema/v3_0/LogActions.php new file mode 100644 index 0000000000..022eab30b0 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogActions.php @@ -0,0 +1,165 @@ +name = 'log_actions'; + + $this->columns = [ + new Column( + name: 'id_action', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_log', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'action', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'extra', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_action', + ], + ), + new Index( + name: 'idx_id_log', + columns: [ + 'id_log', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_id_board', + columns: [ + 'id_board', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_id_topic_id_log', + columns: [ + 'id_topic', + 'id_log', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogActivity.php b/Sources/Db/Schema/v3_0/LogActivity.php new file mode 100644 index 0000000000..5868bfa16b --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogActivity.php @@ -0,0 +1,103 @@ +name = 'log_activity'; + + $this->columns = [ + new Column( + name: 'date', + type: 'date', + not_null: true, + ), + new Column( + name: 'hits', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'topics', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'posts', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'registers', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'most_on', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'date', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogBanned.php b/Sources/Db/Schema/v3_0/LogBanned.php new file mode 100644 index 0000000000..7a321eb4d8 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogBanned.php @@ -0,0 +1,101 @@ +name = 'log_banned'; + + $this->columns = [ + new Column( + name: 'id_ban_log', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'email', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban_log', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogBoards.php b/Sources/Db/Schema/v3_0/LogBoards.php new file mode 100644 index 0000000000..aadcd47cd0 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogBoards.php @@ -0,0 +1,83 @@ +name = 'log_boards'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogComments.php b/Sources/Db/Schema/v3_0/LogComments.php new file mode 100644 index 0000000000..7e8bfb9a99 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogComments.php @@ -0,0 +1,146 @@ +name = 'log_comments'; + + $this->columns = [ + new Column( + name: 'id_comment', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'comment_type', + type: 'varchar', + size: 8, + not_null: true, + default: 'warning', + ), + new Column( + name: 'id_recipient', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'recipient_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'id_notice', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'counter', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_comment', + ], + ), + new Index( + name: 'idx_id_recipient', + columns: [ + 'id_recipient', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_comment_type', + columns: [ + 'comment_type(8)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogDigest.php b/Sources/Db/Schema/v3_0/LogDigest.php new file mode 100644 index 0000000000..98c50e1e31 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogDigest.php @@ -0,0 +1,88 @@ +name = 'log_digest'; + + $this->columns = [ + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'note_type', + type: 'varchar', + size: 10, + not_null: true, + default: 'post', + ), + new Column( + name: 'daily', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'exclude', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogErrors.php b/Sources/Db/Schema/v3_0/LogErrors.php new file mode 100644 index 0000000000..1aeb3ae50d --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogErrors.php @@ -0,0 +1,151 @@ +name = 'log_errors'; + + $this->columns = [ + new Column( + name: 'id_error', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'url', + type: 'text', + not_null: true, + ), + new Column( + name: 'message', + type: 'text', + not_null: true, + ), + new Column( + name: 'session', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'error_type', + type: 'char', + size: 15, + not_null: true, + default: 'general', + ), + new Column( + name: 'file', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'line', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'backtrace', + type: 'varchar', + size: 10000, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_error', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_ip', + columns: [ + 'ip', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogFloodcontrol.php b/Sources/Db/Schema/v3_0/LogFloodcontrol.php new file mode 100644 index 0000000000..e5c3e7c805 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogFloodcontrol.php @@ -0,0 +1,95 @@ +name = 'log_floodcontrol'; + + $this->columns = [ + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'log_type', + type: 'varchar', + size: 30, + default: 'post', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'ip', + 'log_type', + ], + ), + new Index( + type: 'primary', + columns: [ + 'id_request', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + 'id_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogMarkRead.php b/Sources/Db/Schema/v3_0/LogMarkRead.php new file mode 100644 index 0000000000..0f4c9b8db5 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogMarkRead.php @@ -0,0 +1,83 @@ +name = 'log_mark_read'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogMemberNotices.php b/Sources/Db/Schema/v3_0/LogMemberNotices.php new file mode 100644 index 0000000000..4417da825c --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogMemberNotices.php @@ -0,0 +1,81 @@ +name = 'log_member_notices'; + + $this->columns = [ + new Column( + name: 'id_notice', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_notice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogNotify.php b/Sources/Db/Schema/v3_0/LogNotify.php new file mode 100644 index 0000000000..e807add2bd --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogNotify.php @@ -0,0 +1,97 @@ +name = 'log_notify'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'sent', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_topic', + 'id_board', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogOnline.php b/Sources/Db/Schema/v3_0/LogOnline.php new file mode 100644 index 0000000000..c4f5ef496e --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogOnline.php @@ -0,0 +1,125 @@ +name = 'log_online'; + + $this->columns = [ + new Column( + name: 'session', + type: 'varchar', + size: 128, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'url', + type: 'varchar', + size: 2048, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'session', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + type: 'primary', + columns: [ + 'id_install', + ], + ), + new Index( + name: 'idx_filename', + columns: [ + 'filename(15)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogPolls.php b/Sources/Db/Schema/v3_0/LogPolls.php new file mode 100644 index 0000000000..ea02292dc3 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogPolls.php @@ -0,0 +1,86 @@ +name = 'log_polls'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_choice', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + name: 'idx_id_poll', + columns: [ + 'id_poll', + 'id_member', + 'id_choice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogReported.php b/Sources/Db/Schema/v3_0/LogReported.php new file mode 100644 index 0000000000..3ef2e475fd --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogReported.php @@ -0,0 +1,176 @@ +name = 'log_reported'; + + $this->columns = [ + new Column( + name: 'id_report', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'membername', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'time_started', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_updated', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'num_reports', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'closed', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'ignore_all', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_report', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + new Index( + name: 'idx_closed', + columns: [ + 'closed', + ], + ), + new Index( + name: 'idx_time_started', + columns: [ + 'time_started', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogReportedComments.php b/Sources/Db/Schema/v3_0/LogReportedComments.php new file mode 100644 index 0000000000..12d900d4fc --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogReportedComments.php @@ -0,0 +1,122 @@ +name = 'log_reported_comments'; + + $this->columns = [ + new Column( + name: 'id_comment', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_report', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + not_null: true, + ), + new Column( + name: 'membername', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'member_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'comment', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'time_sent', + type: 'int', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_comment', + ], + ), + new Index( + name: 'idx_id_report', + columns: [ + 'id_report', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_time_sent', + columns: [ + 'time_sent', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogScheduledTasks.php b/Sources/Db/Schema/v3_0/LogScheduledTasks.php new file mode 100644 index 0000000000..3018b14dd8 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogScheduledTasks.php @@ -0,0 +1,86 @@ +name = 'log_scheduled_tasks'; + + $this->columns = [ + new Column( + name: 'id_log', + type: 'mediumint', + auto: true, + ), + new Column( + name: 'id_task', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'time_run', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_taken', + type: 'float', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_log', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSearchMessages.php b/Sources/Db/Schema/v3_0/LogSearchMessages.php new file mode 100644 index 0000000000..03ed956ac3 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSearchMessages.php @@ -0,0 +1,76 @@ +name = 'log_search_messages'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSearchResults.php b/Sources/Db/Schema/v3_0/LogSearchResults.php new file mode 100644 index 0000000000..7a89114e07 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSearchResults.php @@ -0,0 +1,97 @@ +name = 'log_search_results'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'relevance', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_matches', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSearchSubjects.php b/Sources/Db/Schema/v3_0/LogSearchSubjects.php new file mode 100644 index 0000000000..a3381b82b7 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSearchSubjects.php @@ -0,0 +1,82 @@ +name = 'log_search_subjects'; + + $this->columns = [ + new Column( + name: 'word', + type: 'varchar', + size: 20, + default: '', + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'word', + 'id_topic', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSearchTopics.php b/Sources/Db/Schema/v3_0/LogSearchTopics.php new file mode 100644 index 0000000000..1f1bf0a162 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSearchTopics.php @@ -0,0 +1,76 @@ +name = 'log_search_topics'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSpiderHits.php b/Sources/Db/Schema/v3_0/LogSpiderHits.php new file mode 100644 index 0000000000..560a21b595 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSpiderHits.php @@ -0,0 +1,102 @@ +name = 'log_spider_hits'; + + $this->columns = [ + new Column( + name: 'id_hit', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'url', + type: 'varchar', + size: 1024, + not_null: true, + default: '', + ), + new Column( + name: 'processed', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_hit', + ], + ), + new Index( + name: 'idx_processed', + columns: [ + 'processed', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSpiderStats.php b/Sources/Db/Schema/v3_0/LogSpiderStats.php new file mode 100644 index 0000000000..078062365b --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSpiderStats.php @@ -0,0 +1,88 @@ +name = 'log_spider_stats'; + + $this->columns = [ + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'page_hits', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'last_seen', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'stat_date', + type: 'date', + default: '1004-01-01', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'stat_date', + 'id_spider', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogSubscribed.php b/Sources/Db/Schema/v3_0/LogSubscribed.php new file mode 100644 index 0000000000..d6780c41a7 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogSubscribed.php @@ -0,0 +1,160 @@ +name = 'log_subscribed'; + + $this->columns = [ + new Column( + name: 'id_sublog', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_subscribe', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'old_id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'start_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'end_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'status', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'payments_pending', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'pending_details', + type: 'text', + not_null: true, + ), + new Column( + name: 'reminder_sent', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'vendor_ref', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_sublog', + ], + ), + new Index( + name: 'idx_end_time', + columns: [ + 'end_time', + ], + ), + new Index( + name: 'idx_reminder_sent', + columns: [ + 'reminder_sent', + ], + ), + new Index( + name: 'idx_payments_pending', + columns: [ + 'payments_pending', + ], + ), + new Index( + name: 'idx_status', + columns: [ + 'status', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/LogTopics.php b/Sources/Db/Schema/v3_0/LogTopics.php new file mode 100644 index 0000000000..054681aae8 --- /dev/null +++ b/Sources/Db/Schema/v3_0/LogTopics.php @@ -0,0 +1,95 @@ +name = 'log_topics'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unwatched', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_topic', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/MailQueue.php b/Sources/Db/Schema/v3_0/MailQueue.php new file mode 100644 index 0000000000..322a3ddf9c --- /dev/null +++ b/Sources/Db/Schema/v3_0/MailQueue.php @@ -0,0 +1,130 @@ +name = 'mail_queue'; + + $this->columns = [ + new Column( + name: 'id_mail', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'time_sent', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'recipient', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'headers', + type: 'text', + not_null: true, + ), + new Column( + name: 'send_html', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'priority', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'private', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_mail', + ], + ), + new Index( + name: 'idx_time_sent', + columns: [ + 'time_sent', + ], + ), + new Index( + name: 'idx_mail_priority', + columns: [ + 'priority', + 'id_mail', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/MemberLogins.php b/Sources/Db/Schema/v3_0/MemberLogins.php new file mode 100644 index 0000000000..b0f5d30588 --- /dev/null +++ b/Sources/Db/Schema/v3_0/MemberLogins.php @@ -0,0 +1,102 @@ +name = 'member_logins'; + + $this->columns = [ + new Column( + name: 'id_login', + type: 'int', + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'ip2', + type: 'inet', + size: 16, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_login', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_time', + columns: [ + 'time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Membergroups.php b/Sources/Db/Schema/v3_0/Membergroups.php new file mode 100644 index 0000000000..7841a99f6f --- /dev/null +++ b/Sources/Db/Schema/v3_0/Membergroups.php @@ -0,0 +1,211 @@ + 1, + 'group_name' => '{$default_administrator_group}', + 'description' => '', + 'online_color' => '#FF0000', + 'min_posts' => -1, + 'icons' => '5#iconadmin.png', + 'group_type' => 1, + ], + [ + 'id_group' => 2, + 'group_name' => '{$default_global_moderator_group}', + 'description' => '', + 'online_color' => '#0000FF', + 'min_posts' => -1, + 'icons' => '5#icongmod.png', + 'group_type' => 0, + ], + [ + 'id_group' => 3, + 'group_name' => '{$default_moderator_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => -1, + 'icons' => '5#iconmod.png', + 'group_type' => 0, + ], + [ + 'id_group' => 4, + 'group_name' => '{$default_newbie_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 0, + 'icons' => '1#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 5, + 'group_name' => '{$default_junior_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 50, + 'icons' => '2#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 6, + 'group_name' => '{$default_full_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 100, + 'icons' => '3#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 7, + 'group_name' => '{$default_senior_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 250, + 'icons' => '4#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 8, + 'group_name' => '{$default_hero_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 500, + 'icons' => '5#icon.png', + 'group_type' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'membergroups'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'group_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'online_color', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'min_posts', + type: 'mediumint', + not_null: true, + default: -1, + ), + new Column( + name: 'max_messages', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'icons', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'group_type', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'hidden', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_parent', + type: 'smallint', + not_null: true, + default: -2, + ), + new Column( + name: 'tfa_required', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + ], + ), + new Index( + name: 'idx_min_posts', + columns: [ + 'min_posts', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Members.php b/Sources/Db/Schema/v3_0/Members.php new file mode 100644 index 0000000000..0f66f5663a --- /dev/null +++ b/Sources/Db/Schema/v3_0/Members.php @@ -0,0 +1,461 @@ +name = 'members'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'date_registered', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'posts', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'lngfile', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'last_login', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'real_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'instant_messages', + type: 'smallint', + not_null: true, + ), + new Column( + name: 'unread_messages', + type: 'smallint', + not_null: true, + ), + new Column( + name: 'new_pm', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'alerts', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'buddy_list', + type: 'text', + not_null: true, + ), + new Column( + name: 'pm_ignore_list', + type: 'text', + ), + new Column( + name: 'pm_prefs', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'mod_prefs', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'passwd', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + new Column( + name: 'email_address', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'personal_text', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'birthdate', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'website_title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'website_url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'show_online', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'time_format', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'signature', + type: 'text', + not_null: true, + ), + new Column( + name: 'time_offset', + type: 'float', + not_null: true, + default: 0, + ), + new Column( + name: 'avatar', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'usertitle', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'member_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'member_ip2', + type: 'inet', + size: 16, + ), + new Column( + name: 'secret_question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'secret_answer', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_activated', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'validation_code', + type: 'varchar', + size: 10, + not_null: true, + default: '', + ), + new Column( + name: 'id_msg_last_visit', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'additional_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'smiley_set', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + new Column( + name: 'id_post_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'total_time_logged_in', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'password_salt', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'ignore_boards', + type: 'text', + not_null: true, + ), + new Column( + name: 'warning', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'passwd_flood', + type: 'varchar', + size: 12, + not_null: true, + default: '', + ), + new Column( + name: 'pm_receive_from', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'timezone', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'tfa_secret', + type: 'varchar', + size: 24, + not_null: true, + default: '', + ), + new Column( + name: 'tfa_backup', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_member_name', + columns: [ + 'member_name', + ], + ), + new Index( + name: 'idx_real_name', + columns: [ + 'real_name', + ], + ), + new Index( + name: 'idx_email_address', + columns: [ + 'email_address', + ], + ), + new Index( + name: 'idx_date_registered', + columns: [ + 'date_registered', + ], + ), + new Index( + name: 'idx_id_group', + columns: [ + 'id_group', + ], + ), + new Index( + name: 'idx_birthdate', + columns: [ + 'birthdate', + ], + ), + new Index( + name: 'idx_posts', + columns: [ + 'posts', + ], + ), + new Index( + name: 'idx_last_login', + columns: [ + 'last_login', + ], + ), + new Index( + name: 'idx_lngfile', + columns: [ + 'lngfile(30)', + ], + ), + new Index( + name: 'idx_id_post_group', + columns: [ + 'id_post_group', + ], + ), + new Index( + name: 'idx_warning', + columns: [ + 'warning', + ], + ), + new Index( + name: 'idx_total_time_logged_in', + columns: [ + 'total_time_logged_in', + ], + ), + new Index( + name: 'idx_id_theme', + columns: [ + 'id_theme', + ], + ), + new Index( + name: 'idx_active_real_name', + columns: [ + 'is_activated', + 'real_name', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Mentions.php b/Sources/Db/Schema/v3_0/Mentions.php new file mode 100644 index 0000000000..915314c78d --- /dev/null +++ b/Sources/Db/Schema/v3_0/Mentions.php @@ -0,0 +1,104 @@ +name = 'mentions'; + + $this->columns = [ + new Column( + name: 'content_id', + type: 'int', + default: 0, + ), + new Column( + name: 'content_type', + type: 'varchar', + size: 10, + default: '', + ), + new Column( + name: 'id_mentioned', + type: 'int', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + ), + new Column( + name: 'time', + type: 'int', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'content_id', + 'content_type', + 'id_mentioned', + ], + ), + new Index( + name: 'content', + columns: [ + 'content_id', + 'content_type', + ], + ), + new Index( + name: 'mentionee', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/MessageIcons.php b/Sources/Db/Schema/v3_0/MessageIcons.php new file mode 100644 index 0000000000..f4b814a2b1 --- /dev/null +++ b/Sources/Db/Schema/v3_0/MessageIcons.php @@ -0,0 +1,169 @@ + 'xx', + 'title' => 'Standard', + 'icon_order' => '0', + ], + [ + 'filename' => 'thumbup', + 'title' => 'Thumb Up', + 'icon_order' => '1', + ], + [ + 'filename' => 'thumbdown', + 'title' => 'Thumb Down', + 'icon_order' => '2', + ], + [ + 'filename' => 'exclamation', + 'title' => 'Exclamation point', + 'icon_order' => '3', + ], + [ + 'filename' => 'question', + 'title' => 'Question mark', + 'icon_order' => '4', + ], + [ + 'filename' => 'lamp', + 'title' => 'Lamp', + 'icon_order' => '5', + ], + [ + 'filename' => 'smiley', + 'title' => 'Smiley', + 'icon_order' => '6', + ], + [ + 'filename' => 'angry', + 'title' => 'Angry', + 'icon_order' => '7', + ], + [ + 'filename' => 'cheesy', + 'title' => 'Cheesy', + 'icon_order' => '8', + ], + [ + 'filename' => 'grin', + 'title' => 'Grin', + 'icon_order' => '9', + ], + [ + 'filename' => 'sad', + 'title' => 'Sad', + 'icon_order' => '10', + ], + [ + 'filename' => 'wink', + 'title' => 'Wink', + 'icon_order' => '11', + ], + [ + 'filename' => 'poll', + 'title' => 'Poll', + 'icon_order' => '12', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'message_icons'; + + $this->columns = [ + new Column( + name: 'id_icon', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'title', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'filename', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'icon_order', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_icon', + ], + ), + new Index( + name: 'idx_id_board', + columns: [ + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Messages.php b/Sources/Db/Schema/v3_0/Messages.php new file mode 100644 index 0000000000..19805d94f9 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Messages.php @@ -0,0 +1,265 @@ + 1, + 'id_msg_modified' => 1, + 'id_topic' => 1, + 'id_board' => 1, + 'poster_time' => '{$current_time}', + 'subject' => '{$default_topic_subject}', + 'poster_name' => 'Simple Machines', + 'poster_email' => 'info@simplemachines.org', + 'modified_name' => '', + 'body' => '{$default_topic_message}', + 'icon' => 'xx', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'messages'; + + $this->columns = [ + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'poster_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg_modified', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_email', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'smileys_enabled', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'modified_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'modified_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'modified_reason', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + new Column( + name: 'icon', + type: 'varchar', + size: 16, + not_null: true, + default: 'xx', + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'likes', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_id_board', + type: 'unique', + columns: [ + 'id_board', + 'id_msg', + 'approved', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_msg', + ], + ), + new Index( + name: 'idx_ip_index', + columns: [ + 'poster_ip', + 'id_topic', + ], + ), + new Index( + name: 'idx_participation', + columns: [ + 'id_member', + 'id_topic', + ], + ), + new Index( + name: 'idx_show_posts', + columns: [ + 'id_member', + 'id_board', + ], + ), + new Index( + name: 'idx_id_member_msg', + columns: [ + 'id_member', + 'approved', + 'id_msg', + ], + ), + new Index( + name: 'idx_current_topic', + columns: [ + 'id_topic', + 'id_msg', + 'id_member', + 'approved', + ], + ), + new Index( + name: 'idx_related_ip', + columns: [ + 'id_member', + 'poster_ip', + 'id_msg', + ], + ), + new Index( + name: 'idx_likes', + columns: [ + 'likes', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/ModeratorGroups.php b/Sources/Db/Schema/v3_0/ModeratorGroups.php new file mode 100644 index 0000000000..d2df784704 --- /dev/null +++ b/Sources/Db/Schema/v3_0/ModeratorGroups.php @@ -0,0 +1,76 @@ +name = 'moderator_groups'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + 'id_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Moderators.php b/Sources/Db/Schema/v3_0/Moderators.php new file mode 100644 index 0000000000..0f2e924af3 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Moderators.php @@ -0,0 +1,76 @@ +name = 'moderators'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PackageServers.php b/Sources/Db/Schema/v3_0/PackageServers.php new file mode 100644 index 0000000000..76e0c8106a --- /dev/null +++ b/Sources/Db/Schema/v3_0/PackageServers.php @@ -0,0 +1,105 @@ + 'Simple Machines Third-party Mod Site', + 'url' => 'https://custom.simplemachines.org/packages/mods', + 'validation_url' => 'https://custom.simplemachines.org/api.php?action=validate;version=v1;smf_version={SMF_VERSION}', + ], + [ + 'name' => 'Simple Machines Downloads Site', + 'url' => 'https://download.simplemachines.org/browse.php?api=v1;smf_version={SMF_VERSION}', + 'validation_url' => 'https://download.simplemachines.org/validate.php?api=v1;smf_version={SMF_VERSION}', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'package_servers'; + + $this->columns = [ + new Column( + name: 'id_server', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'validation_url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'extra', + type: 'text', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_server', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PermissionProfiles.php b/Sources/Db/Schema/v3_0/PermissionProfiles.php new file mode 100644 index 0000000000..38bd3eaf77 --- /dev/null +++ b/Sources/Db/Schema/v3_0/PermissionProfiles.php @@ -0,0 +1,92 @@ + 1, + 'profile_name' => 'default', + ], + [ + 'id_profile' => 2, + 'profile_name' => 'no_polls', + ], + [ + 'id_profile' => 3, + 'profile_name' => 'reply_only', + ], + [ + 'id_profile' => 4, + 'profile_name' => 'read_only', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'permission_profiles'; + + $this->columns = [ + new Column( + name: 'id_profile', + type: 'smallint', + auto: true, + ), + new Column( + name: 'profile_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_profile', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Permissions.php b/Sources/Db/Schema/v3_0/Permissions.php new file mode 100644 index 0000000000..f183fda6fc --- /dev/null +++ b/Sources/Db/Schema/v3_0/Permissions.php @@ -0,0 +1,286 @@ + -1, + 'permission' => 'search_posts', + ], + [ + 'id_group' => -1, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => -1, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 0, + 'permission' => 'view_mlist', + ], + [ + 'id_group' => 0, + 'permission' => 'search_posts', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_view', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_read', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_send', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_draft', + ], + [ + 'id_group' => 0, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => 0, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 0, + 'permission' => 'who_view', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_identity_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_password_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_blurb_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_displayed_name_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_signature_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_website_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_forum_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_extra_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_remove_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_server_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_upload_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_remote_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'send_email_to_members', + ], + [ + 'id_group' => 2, + 'permission' => 'view_mlist', + ], + [ + 'id_group' => 2, + 'permission' => 'search_posts', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_view', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_read', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_send', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_draft', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => 2, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 2, + 'permission' => 'who_view', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_identity_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_password_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_blurb_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_displayed_name_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_signature_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_website_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_forum_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_extra_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_remove_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_server_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_upload_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_remote_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'send_email_to_members', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_title_own', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_post', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_edit_any', + ], + [ + 'id_group' => 2, + 'permission' => 'access_mod_center', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'permissions'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + default: 0, + ), + new Column( + name: 'permission', + type: 'varchar', + size: 30, + default: '', + ), + new Column( + name: 'add_deny', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'permission', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PersonalMessages.php b/Sources/Db/Schema/v3_0/PersonalMessages.php new file mode 100644 index 0000000000..3ee0feb9cf --- /dev/null +++ b/Sources/Db/Schema/v3_0/PersonalMessages.php @@ -0,0 +1,135 @@ +name = 'personal_messages'; + + $this->columns = [ + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_pm_head', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_from', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'deleted_by_sender', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'from_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'msgtime', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_pm', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member_from', + 'deleted_by_sender', + ], + ), + new Index( + name: 'idx_msgtime', + columns: [ + 'msgtime', + ], + ), + new Index( + name: 'idx_id_pm_head', + columns: [ + 'id_pm_head', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PmLabeledMessages.php b/Sources/Db/Schema/v3_0/PmLabeledMessages.php new file mode 100644 index 0000000000..a8e7a51be3 --- /dev/null +++ b/Sources/Db/Schema/v3_0/PmLabeledMessages.php @@ -0,0 +1,76 @@ +name = 'pm_labeled_messages'; + + $this->columns = [ + new Column( + name: 'id_label', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_label', + 'id_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PmLabels.php b/Sources/Db/Schema/v3_0/PmLabels.php new file mode 100644 index 0000000000..c8d6da261b --- /dev/null +++ b/Sources/Db/Schema/v3_0/PmLabels.php @@ -0,0 +1,83 @@ +name = 'pm_labels'; + + $this->columns = [ + new Column( + name: 'id_label', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'name', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_label', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PmRecipients.php b/Sources/Db/Schema/v3_0/PmRecipients.php new file mode 100644 index 0000000000..63f456f85a --- /dev/null +++ b/Sources/Db/Schema/v3_0/PmRecipients.php @@ -0,0 +1,119 @@ +name = 'pm_recipients'; + + $this->columns = [ + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'bcc', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_read', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_new', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'deleted', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'in_inbox', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_pm', + 'id_member', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'deleted', + 'id_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PmRules.php b/Sources/Db/Schema/v3_0/PmRules.php new file mode 100644 index 0000000000..1833399b49 --- /dev/null +++ b/Sources/Db/Schema/v3_0/PmRules.php @@ -0,0 +1,118 @@ +name = 'pm_rules'; + + $this->columns = [ + new Column( + name: 'id_rule', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'rule_name', + type: 'varchar', + size: 60, + not_null: true, + ), + new Column( + name: 'criteria', + type: 'text', + not_null: true, + ), + new Column( + name: 'actions', + type: 'text', + not_null: true, + ), + new Column( + name: 'delete_pm', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_or', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_rule', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_delete_pm', + columns: [ + 'delete_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/PollChoices.php b/Sources/Db/Schema/v3_0/PollChoices.php new file mode 100644 index 0000000000..681a21d0ae --- /dev/null +++ b/Sources/Db/Schema/v3_0/PollChoices.php @@ -0,0 +1,90 @@ +name = 'poll_choices'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_choice', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'label', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'votes', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_poll', + 'id_choice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Polls.php b/Sources/Db/Schema/v3_0/Polls.php new file mode 100644 index 0000000000..4547d338c3 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Polls.php @@ -0,0 +1,145 @@ +name = 'polls'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'voting_locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'max_votes', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'expire_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hide_results', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'change_vote', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'guest_vote', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_guest_voters', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'reset_poll', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'poster_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_poll', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Qanda.php b/Sources/Db/Schema/v3_0/Qanda.php new file mode 100644 index 0000000000..22d89cb9ce --- /dev/null +++ b/Sources/Db/Schema/v3_0/Qanda.php @@ -0,0 +1,94 @@ +name = 'qanda'; + + $this->columns = [ + new Column( + name: 'id_question', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'lngfile', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'answers', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_question', + ], + ), + new Index( + name: 'idx_lngfile', + columns: [ + 'lngfile', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/ScheduledTasks.php b/Sources/Db/Schema/v3_0/ScheduledTasks.php new file mode 100644 index 0000000000..a57c56b258 --- /dev/null +++ b/Sources/Db/Schema/v3_0/ScheduledTasks.php @@ -0,0 +1,243 @@ + 3, + 'next_time' => 0, + 'time_offset' => 60, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'daily_maintenance', + 'callable' => '', + ], + [ + 'id_task' => 5, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'daily_digest', + 'callable' => '', + ], + [ + 'id_task' => 6, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 0, + 'task' => 'weekly_digest', + 'callable' => '', + ], + [ + 'id_task' => 7, + 'next_time' => 0, + 'time_offset' => '{$sched_task_offset}', + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'fetchSMfiles', + 'callable' => '', + ], + [ + 'id_task' => 8, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 1, + 'task' => 'birthdayemails', + 'callable' => '', + ], + [ + 'id_task' => 9, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 0, + 'task' => 'weekly_maintenance', + 'callable' => '', + ], + [ + 'id_task' => 10, + 'next_time' => 0, + 'time_offset' => 120, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 1, + 'task' => 'paid_subscriptions', + 'callable' => '', + ], + [ + 'id_task' => 11, + 'next_time' => 0, + 'time_offset' => 120, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_temp_attachments', + 'callable' => '', + ], + [ + 'id_task' => 12, + 'next_time' => 0, + 'time_offset' => 180, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_topic_redirect', + 'callable' => '', + ], + [ + 'id_task' => 13, + 'next_time' => 0, + 'time_offset' => 240, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_old_drafts', + 'callable' => '', + ], + [ + 'id_task' => 14, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 1, + 'task' => 'prune_log_topics', + 'callable' => '', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'scheduled_tasks'; + + $this->columns = [ + new Column( + name: 'id_task', + type: 'smallint', + auto: true, + ), + new Column( + name: 'next_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_offset', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_regularity', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'time_unit', + type: 'varchar', + size: 1, + not_null: true, + default: 'h', + ), + new Column( + name: 'disabled', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'task', + type: 'varchar', + size: 24, + not_null: true, + default: '', + ), + new Column( + name: 'callable', + type: 'varchar', + size: 60, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_task', + ], + ), + new Index( + name: 'idx_next_time', + columns: [ + 'next_time', + ], + ), + new Index( + name: 'idx_disabled', + columns: [ + 'disabled', + ], + ), + new Index( + name: 'idx_task', + type: 'unique', + columns: [ + 'task', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Sessions.php b/Sources/Db/Schema/v3_0/Sessions.php new file mode 100644 index 0000000000..9ad547e79e --- /dev/null +++ b/Sources/Db/Schema/v3_0/Sessions.php @@ -0,0 +1,82 @@ +name = 'sessions'; + + $this->columns = [ + new Column( + name: 'session_id', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'last_update', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'data', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'session_id', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Settings.php b/Sources/Db/Schema/v3_0/Settings.php new file mode 100644 index 0000000000..1e31089162 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Settings.php @@ -0,0 +1,891 @@ + 'additional_options_collapsable', + 'value' => '1', + ], + [ + 'variable' => 'adminlog_enabled', + 'value' => '1', + ], + [ + 'variable' => 'alerts_auto_purge', + 'value' => '30', + ], + [ + 'variable' => 'allow_editDisplayName', + 'value' => '1', + ], + [ + 'variable' => 'allow_expire_redirect', + 'value' => '1', + ], + [ + 'variable' => 'allow_guestAccess', + 'value' => '1', + ], + [ + 'variable' => 'allow_hideOnline', + 'value' => '1', + ], + [ + 'variable' => 'attachmentCheckExtensions', + 'value' => '0', + ], + [ + 'variable' => 'attachmentDirFileLimit', + 'value' => '1000', + ], + [ + 'variable' => 'attachmentDirSizeLimit', + 'value' => '10240', + ], + [ + 'variable' => 'attachmentEnable', + 'value' => '1', + ], + [ + 'variable' => 'attachmentExtensions', + 'value' => 'doc,gif,jpg,mpg,pdf,png,txt,zip', + ], + [ + 'variable' => 'attachmentNumPerPostLimit', + 'value' => '4', + ], + [ + 'variable' => 'attachmentPostLimit', + 'value' => '192', + ], + [ + 'variable' => 'attachmentShowImages', + 'value' => '1', + ], + [ + 'variable' => 'attachmentSizeLimit', + 'value' => '128', + ], + [ + 'variable' => 'attachmentThumbHeight', + 'value' => '150', + ], + [ + 'variable' => 'attachmentThumbWidth', + 'value' => '150', + ], + [ + 'variable' => 'attachmentThumbnails', + 'value' => '1', + ], + [ + 'variable' => 'attachmentUploadDir', + 'value' => '{$attachdir}', + ], + [ + 'variable' => 'attachment_image_paranoid', + 'value' => '0', + ], + [ + 'variable' => 'attachment_image_reencode', + 'value' => '1', + ], + [ + 'variable' => 'attachment_thumb_png', + 'value' => '1', + ], + [ + 'variable' => 'attachments_21_done', + 'value' => '1', + ], + [ + 'variable' => 'autoFixDatabase', + 'value' => '1', + ], + [ + 'variable' => 'autoLinkUrls', + 'value' => '1', + ], + [ + 'variable' => 'avatar_action_too_large', + 'value' => 'option_css_resize', + ], + [ + 'variable' => 'avatar_directory', + 'value' => '{$boarddir}/avatars', + ], + [ + 'variable' => 'avatar_download_png', + 'value' => '1', + ], + [ + 'variable' => 'avatar_max_height_external', + 'value' => '65', + ], + [ + 'variable' => 'avatar_max_height_upload', + 'value' => '65', + ], + [ + 'variable' => 'avatar_max_width_external', + 'value' => '65', + ], + [ + 'variable' => 'avatar_max_width_upload', + 'value' => '65', + ], + [ + 'variable' => 'avatar_paranoid', + 'value' => '0', + ], + [ + 'variable' => 'avatar_reencode', + 'value' => '1', + ], + [ + 'variable' => 'avatar_resize_upload', + 'value' => '1', + ], + [ + 'variable' => 'avatar_url', + 'value' => '{$boardurl}/avatars', + ], + [ + 'variable' => 'banLastUpdated', + 'value' => '0', + ], + [ + 'variable' => 'birthday_email', + 'value' => 'happy_birthday', + ], + [ + 'variable' => 'boardindex_max_depth', + 'value' => '5', + ], + [ + 'variable' => 'cal_days_for_index', + 'value' => '7', + ], + [ + 'variable' => 'cal_daysaslink', + 'value' => '0', + ], + [ + 'variable' => 'cal_defaultboard', + 'value' => '', + ], + [ + 'variable' => 'cal_disable_prev_next', + 'value' => '0', + ], + [ + 'variable' => 'cal_display_type', + 'value' => '0', + ], + [ + 'variable' => 'cal_enabled', + 'value' => '0', + ], + [ + 'variable' => 'cal_maxspan', + 'value' => '0', + ], + [ + 'variable' => 'cal_maxyear', + 'value' => '2030', + ], + [ + 'variable' => 'cal_minyear', + 'value' => '2008', + ], + [ + 'variable' => 'cal_prev_next_links', + 'value' => '1', + ], + [ + 'variable' => 'cal_short_days', + 'value' => '0', + ], + [ + 'variable' => 'cal_short_months', + 'value' => '0', + ], + [ + 'variable' => 'cal_showInTopic', + 'value' => '1', + ], + [ + 'variable' => 'cal_showbdays', + 'value' => '1', + ], + [ + 'variable' => 'cal_showevents', + 'value' => '1', + ], + [ + 'variable' => 'cal_showholidays', + 'value' => '1', + ], + [ + 'variable' => 'cal_week_links', + 'value' => '2', + ], + [ + 'variable' => 'censorIgnoreCase', + 'value' => '1', + ], + [ + 'variable' => 'censor_proper', + 'value' => '', + ], + [ + 'variable' => 'censor_vulgar', + 'value' => '', + ], + [ + 'variable' => 'compactTopicPagesContiguous', + 'value' => '5', + ], + [ + 'variable' => 'compactTopicPagesEnable', + 'value' => '1', + ], + [ + 'variable' => 'cookieTime', + 'value' => '3153600', + ], + [ + 'variable' => 'currentAttachmentUploadDir', + 'value' => 1, + ], + [ + 'variable' => 'custom_avatar_dir', + 'value' => '{$boarddir}/custom_avatar', + ], + [ + 'variable' => 'custom_avatar_url', + 'value' => '{$boardurl}/custom_avatar', + ], + [ + 'variable' => 'databaseSession_enable', + 'value' => '{$databaseSession_enable}', + ], + [ + 'variable' => 'databaseSession_lifetime', + 'value' => '2880', + ], + [ + 'variable' => 'databaseSession_loose', + 'value' => '1', + ], + [ + 'variable' => 'defaultMaxListItems', + 'value' => '15', + ], + [ + 'variable' => 'defaultMaxMembers', + 'value' => '30', + ], + [ + 'variable' => 'defaultMaxMessages', + 'value' => '15', + ], + [ + 'variable' => 'defaultMaxTopics', + 'value' => '20', + ], + [ + 'variable' => 'default_personal_text', + 'value' => '', + ], + [ + 'variable' => 'displayFields', + 'value' => '[{"col_name":"cust_icq","title":"ICQ","type":"text","order":"1","bbc":"0","placement":"1","enclose":"\\"ICQ<\\/a>","mlist":"0"},{"col_name":"cust_skype","title":"Skype","type":"text","order":"2","bbc":"0","placement":"1","enclose":"\\"{INPUT}\\"<\\/a> ","mlist":"0"},{"col_name":"cust_loca","title":"Location","type":"text","order":"4","bbc":"0","placement":"0","enclose":"","mlist":"0"},{"col_name":"cust_gender","title":"Gender","type":"radio","order":"5","bbc":"0","placement":"1","enclose":"<\\/span>","mlist":"0","options":["None","Male","Female"]}]', + ], + [ + 'variable' => 'dont_repeat_buddylists', + 'value' => '1', + ], + [ + 'variable' => 'dont_repeat_smileys_20', + 'value' => '1', + ], + [ + 'variable' => 'dont_repeat_theme_core', + 'value' => '1', + ], + [ + 'variable' => 'drafts_autosave_enabled', + 'value' => '1', + ], + [ + 'variable' => 'drafts_keep_days', + 'value' => '7', + ], + [ + 'variable' => 'drafts_pm_enabled', + 'value' => '1', + ], + [ + 'variable' => 'drafts_post_enabled', + 'value' => '1', + ], + [ + 'variable' => 'drafts_show_saved_enabled', + 'value' => '1', + ], + [ + 'variable' => 'edit_disable_time', + 'value' => '0', + ], + [ + 'variable' => 'edit_wait_time', + 'value' => '90', + ], + [ + 'variable' => 'enableAllMessages', + 'value' => '0', + ], + [ + 'variable' => 'enableBBC', + 'value' => '1', + ], + [ + 'variable' => 'enableCompressedOutput', + 'value' => '{$enableCompressedOutput}', + ], + [ + 'variable' => 'enableErrorLogging', + 'value' => '1', + ], + [ + 'variable' => 'enableParticipation', + 'value' => '1', + ], + [ + 'variable' => 'enablePostHTML', + 'value' => '0', + ], + [ + 'variable' => 'enablePreviousNext', + 'value' => '1', + ], + [ + 'variable' => 'enableThemes', + 'value' => '1', + ], + [ + 'variable' => 'enable_ajax_alerts', + 'value' => '1', + ], + [ + 'variable' => 'enable_buddylist', + 'value' => '1', + ], + [ + 'variable' => 'export_dir', + 'value' => '{$boarddir}/exports', + ], + [ + 'variable' => 'export_expiry', + 'value' => '7', + ], + [ + 'variable' => 'export_min_diskspace_pct', + 'value' => '5', + ], + [ + 'variable' => 'export_rate', + 'value' => '250', + ], + [ + 'variable' => 'failed_login_threshold', + 'value' => '3', + ], + [ + 'variable' => 'gravatarAllowExtraEmail', + 'value' => '1', + ], + [ + 'variable' => 'gravatarEnabled', + 'value' => '1', + ], + [ + 'variable' => 'gravatarMaxRating', + 'value' => 'PG', + ], + [ + 'variable' => 'gravatarOverride', + 'value' => '0', + ], + [ + 'variable' => 'httponlyCookies', + 'value' => '1', + ], + [ + 'variable' => 'json_done', + 'value' => '1', + ], + [ + 'variable' => 'knownThemes', + 'value' => '1', + ], + [ + 'variable' => 'lastActive', + 'value' => '15', + ], + [ + 'variable' => 'last_mod_report_action', + 'value' => '0', + ], + [ + 'variable' => 'loginHistoryDays', + 'value' => '30', + ], + [ + 'variable' => 'mail_limit', + 'value' => '5', + ], + [ + 'variable' => 'mail_next_send', + 'value' => '0', + ], + [ + 'variable' => 'mail_quantity', + 'value' => '5', + ], + [ + 'variable' => 'mail_recent', + 'value' => '0000000000|0', + ], + [ + 'variable' => 'mail_type', + 'value' => '0', + ], + [ + 'variable' => 'mark_read_beyond', + 'value' => '90', + ], + [ + 'variable' => 'mark_read_delete_beyond', + 'value' => '365', + ], + [ + 'variable' => 'mark_read_max_users', + 'value' => '500', + ], + [ + 'variable' => 'maxMsgID', + 'value' => '1', + ], + [ + 'variable' => 'max_image_height', + 'value' => '0', + ], + [ + 'variable' => 'max_image_width', + 'value' => '0', + ], + [ + 'variable' => 'max_messageLength', + 'value' => '20000', + ], + [ + 'variable' => 'minimize_files', + 'value' => '1', + ], + [ + 'variable' => 'modlog_enabled', + 'value' => '1', + ], + [ + 'variable' => 'mostDate', + 'value' => '{$current_time}', + ], + [ + 'variable' => 'mostOnline', + 'value' => '1', + ], + [ + 'variable' => 'mostOnlineToday', + 'value' => '1', + ], + [ + 'variable' => 'news', + 'value' => '{$default_news}', + ], + [ + 'variable' => 'next_task_time', + 'value' => '1', + ], + [ + 'variable' => 'number_format', + 'value' => '1234.00', + ], + [ + 'variable' => 'oldTopicDays', + 'value' => '120', + ], + [ + 'variable' => 'onlineEnable', + 'value' => '0', + ], + [ + 'variable' => 'package_make_backups', + 'value' => '1', + ], + [ + 'variable' => 'permission_enable_deny', + 'value' => '0', + ], + [ + 'variable' => 'permission_enable_postgroups', + 'value' => '0', + ], + [ + 'variable' => 'pm_spam_settings', + 'value' => '10,5,20', + ], + [ + 'variable' => 'pollMode', + 'value' => '1', + ], + [ + 'variable' => 'pruningOptions', + 'value' => '30,180,180,180,30,0', + ], + [ + 'variable' => 'recycle_board', + 'value' => '0', + ], + [ + 'variable' => 'recycle_enable', + 'value' => '0', + ], + [ + 'variable' => 'reg_verification', + 'value' => '1', + ], + [ + 'variable' => 'registration_method', + 'value' => '{$registration_method}', + ], + [ + 'variable' => 'requireAgreement', + 'value' => '1', + ], + [ + 'variable' => 'requirePolicyAgreement', + 'value' => '0', + ], + [ + 'variable' => 'reserveCase', + 'value' => '1', + ], + [ + 'variable' => 'reserveName', + 'value' => '1', + ], + [ + 'variable' => 'reserveNames', + 'value' => '{$default_reserved_names}', + ], + [ + 'variable' => 'reserveUser', + 'value' => '1', + ], + [ + 'variable' => 'reserveWord', + 'value' => '0', + ], + [ + 'variable' => 'samesiteCookies', + 'value' => 'lax', + ], + [ + 'variable' => 'search_cache_size', + 'value' => '50', + ], + [ + 'variable' => 'search_floodcontrol_time', + 'value' => '5', + ], + [ + 'variable' => 'search_max_results', + 'value' => '1200', + ], + [ + 'variable' => 'search_results_per_page', + 'value' => '30', + ], + [ + 'variable' => 'search_weight_age', + 'value' => '25', + ], + [ + 'variable' => 'search_weight_first_message', + 'value' => '10', + ], + [ + 'variable' => 'search_weight_frequency', + 'value' => '30', + ], + [ + 'variable' => 'search_weight_length', + 'value' => '20', + ], + [ + 'variable' => 'search_weight_subject', + 'value' => '15', + ], + [ + 'variable' => 'securityDisable_moderate', + 'value' => '1', + ], + [ + 'variable' => 'send_validation_onChange', + 'value' => '0', + ], + [ + 'variable' => 'send_welcomeEmail', + 'value' => '1', + ], + [ + 'variable' => 'settings_updated', + 'value' => '0', + ], + [ + 'variable' => 'show_blurb', + 'value' => '1', + ], + [ + 'variable' => 'show_modify', + 'value' => '1', + ], + [ + 'variable' => 'show_profile_buttons', + 'value' => '1', + ], + [ + 'variable' => 'show_user_images', + 'value' => '1', + ], + [ + 'variable' => 'signature_settings', + 'value' => '1,300,0,0,0,0,0,0:', + ], + [ + 'variable' => 'smfVersion', + 'value' => '{$smf_version}', + ], + [ + 'variable' => 'smiley_sets_default', + 'value' => 'fugue', + ], + [ + 'variable' => 'smiley_sets_known', + 'value' => 'fugue,alienine', + ], + [ + 'variable' => 'smiley_sets_names', + 'value' => '{$default_fugue_smileyset_name}\n{$default_alienine_smileyset_name}', + ], + [ + 'variable' => 'smileys_dir', + 'value' => '{$boarddir}/Smileys', + ], + [ + 'variable' => 'smileys_url', + 'value' => '{$boardurl}/Smileys', + ], + [ + 'variable' => 'smtp_host', + 'value' => '', + ], + [ + 'variable' => 'smtp_password', + 'value' => '', + ], + [ + 'variable' => 'smtp_port', + 'value' => '25', + ], + [ + 'variable' => 'smtp_username', + 'value' => '', + ], + [ + 'variable' => 'spamWaitTime', + 'value' => '5', + ], + [ + 'variable' => 'tfa_mode', + 'value' => '1', + ], + [ + 'variable' => 'theme_allow', + 'value' => '1', + ], + [ + 'variable' => 'theme_default', + 'value' => '1', + ], + [ + 'variable' => 'theme_guests', + 'value' => '1', + ], + [ + 'variable' => 'timeLoadPageEnable', + 'value' => '0', + ], + [ + 'variable' => 'time_format', + 'value' => '{$default_time_format}', + ], + [ + 'variable' => 'titlesEnable', + 'value' => '1', + ], + [ + 'variable' => 'todayMod', + 'value' => '1', + ], + [ + 'variable' => 'topicSummaryPosts', + 'value' => '15', + ], + [ + 'variable' => 'topic_move_any', + 'value' => '0', + ], + [ + 'variable' => 'totalMembers', + 'value' => '0', + ], + [ + 'variable' => 'totalMessages', + 'value' => '1', + ], + [ + 'variable' => 'totalTopics', + 'value' => '1', + ], + [ + 'variable' => 'trackStats', + 'value' => '1', + ], + [ + 'variable' => 'unapprovedMembers', + 'value' => '0', + ], + [ + 'variable' => 'use_subdirectories_for_attachments', + 'value' => '1', + ], + [ + 'variable' => 'userLanguage', + 'value' => '1', + ], + [ + 'variable' => 'visual_verification_type', + 'value' => '3', + ], + [ + 'variable' => 'warning_moderate', + 'value' => '35', + ], + [ + 'variable' => 'warning_mute', + 'value' => '60', + ], + [ + 'variable' => 'warning_settings', + 'value' => '1,20,0', + ], + [ + 'variable' => 'warning_watch', + 'value' => '10', + ], + [ + 'variable' => 'who_enabled', + 'value' => '1', + ], + [ + 'variable' => 'xmlnews_enable', + 'value' => '1', + ], + [ + 'variable' => 'xmlnews_maxlen', + 'value' => '255', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'settings'; + + $this->columns = [ + new Column( + name: 'variable', + type: 'varchar', + size: 255, + default: '', + ), + new Column( + name: 'value', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'variable(30)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/SmileyFiles.php b/Sources/Db/Schema/v3_0/SmileyFiles.php new file mode 100644 index 0000000000..bd6fb06609 --- /dev/null +++ b/Sources/Db/Schema/v3_0/SmileyFiles.php @@ -0,0 +1,84 @@ +name = 'smiley_files'; + + $this->columns = [ + new Column( + name: 'id_smiley', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'smiley_set', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + new Column( + name: 'filename', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_smiley', + 'smiley_set', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Smileys.php b/Sources/Db/Schema/v3_0/Smileys.php new file mode 100644 index 0000000000..a9e6b31b11 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Smileys.php @@ -0,0 +1,104 @@ +name = 'smileys'; + + $this->columns = [ + new Column( + name: 'id_smiley', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'code', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'smiley_row', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'smiley_order', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hidden', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_smiley', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Spiders.php b/Sources/Db/Schema/v3_0/Spiders.php new file mode 100644 index 0000000000..d87dcdbf6c --- /dev/null +++ b/Sources/Db/Schema/v3_0/Spiders.php @@ -0,0 +1,191 @@ + 'Google', + 'user_agent' => 'googlebot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo!', + 'user_agent' => 'slurp', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing', + 'user_agent' => 'bingbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Mobile)', + 'user_agent' => 'Googlebot-Mobile', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Image)', + 'user_agent' => 'Googlebot-Image', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (AdSense)', + 'user_agent' => 'Mediapartners-Google', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Adwords)', + 'user_agent' => 'AdsBot-Google', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo! (Mobile)', + 'user_agent' => 'YahooSeeker/M1A1-R2D2', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo! (Image)', + 'user_agent' => 'Yahoo-MMCrawler', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Preview)', + 'user_agent' => 'BingPreview', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Ads)', + 'user_agent' => 'adidxbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (MSNBot)', + 'user_agent' => 'msnbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Media)', + 'user_agent' => 'msnbot-media', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Cuil', + 'user_agent' => 'twiceler', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Ask', + 'user_agent' => 'Teoma', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Baidu', + 'user_agent' => 'Baiduspider', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Gigablast', + 'user_agent' => 'Gigabot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'InternetArchive', + 'user_agent' => 'ia_archiver-web.archive.org', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Alexa', + 'user_agent' => 'ia_archiver', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Omgili', + 'user_agent' => 'omgilibot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'EntireWeb', + 'user_agent' => 'Speedy Spider', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yandex', + 'user_agent' => 'yandex', + 'ip_info' => '', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'spiders'; + + $this->columns = [ + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'spider_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'user_agent', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'ip_info', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Subscriptions.php b/Sources/Db/Schema/v3_0/Subscriptions.php new file mode 100644 index 0000000000..555825fe87 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Subscriptions.php @@ -0,0 +1,143 @@ +name = 'subscriptions'; + + $this->columns = [ + new Column( + name: 'id_subscribe', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 60, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'cost', + type: 'text', + not_null: true, + ), + new Column( + name: 'length', + type: 'varchar', + size: 6, + not_null: true, + default: '', + ), + new Column( + name: 'id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'add_groups', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'active', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'repeatable', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'allow_partial', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'reminder', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'email_complete', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_subscribe', + ], + ), + new Index( + name: 'idx_active', + columns: [ + 'active', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Themes.php b/Sources/Db/Schema/v3_0/Themes.php new file mode 100644 index 0000000000..77ece018f7 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Themes.php @@ -0,0 +1,149 @@ + 1, + 'variable' => 'name', + 'value' => '{$default_theme_name}', + ], + [ + 'id_theme' => 1, + 'variable' => 'theme_url', + 'value' => '{$boardurl}/Themes/default', + ], + [ + 'id_theme' => 1, + 'variable' => 'images_url', + 'value' => '{$boardurl}/Themes/default/images', + ], + [ + 'id_theme' => 1, + 'variable' => 'theme_dir', + 'value' => '{$boarddir}/Themes/default', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_latest_member', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_newsfader', + 'value' => '0', + ], + [ + 'id_theme' => 1, + 'variable' => 'number_recent_posts', + 'value' => '0', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_stats_index', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'newsfader_time', + 'value' => '3000', + ], + [ + 'id_theme' => 1, + 'variable' => 'use_image_buttons', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'enable_news', + 'value' => '1', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'themes'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + default: 0, + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + default: 1, + ), + new Column( + name: 'variable', + type: 'varchar', + size: 255, + default: '', + ), + new Column( + name: 'value', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_theme', + 'id_member', + 'variable(30)', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/Topics.php b/Sources/Db/Schema/v3_0/Topics.php new file mode 100644 index 0000000000..e3c8218cb0 --- /dev/null +++ b/Sources/Db/Schema/v3_0/Topics.php @@ -0,0 +1,242 @@ + 1, + 'id_board' => 1, + 'id_first_msg' => 1, + 'id_last_msg' => 1, + 'id_member_started' => 0, + 'id_member_updated' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'topics'; + + $this->columns = [ + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'is_sticky', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_first_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_last_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_started', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_updated', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_previous_board', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_previous_topic', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'num_replies', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_views', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'redirect_expires', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_redirect_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_posts', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_topic', + ], + ), + new Index( + name: 'idx_last_message', + type: 'unique', + columns: [ + 'id_last_msg', + 'id_board', + ], + ), + new Index( + name: 'idx_first_message', + type: 'unique', + columns: [ + 'id_first_msg', + 'id_board', + ], + ), + new Index( + name: 'idx_poll', + type: 'unique', + columns: [ + 'id_poll', + 'id_topic', + ], + ), + new Index( + name: 'idx_is_sticky', + columns: [ + 'is_sticky', + ], + ), + new Index( + name: 'idx_approved', + columns: [ + 'approved', + ], + ), + new Index( + name: 'idx_member_started', + columns: [ + 'id_member_started', + 'id_board', + ], + ), + new Index( + name: 'idx_last_message_sticky', + columns: [ + 'id_board', + 'is_sticky', + 'id_last_msg', + ], + ), + new Index( + name: 'idx_board_news', + columns: [ + 'id_board', + 'id_first_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/UserAlerts.php b/Sources/Db/Schema/v3_0/UserAlerts.php new file mode 100644 index 0000000000..b2bfceed43 --- /dev/null +++ b/Sources/Db/Schema/v3_0/UserAlerts.php @@ -0,0 +1,142 @@ +name = 'user_alerts'; + + $this->columns = [ + new Column( + name: 'id_alert', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'alert_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_started', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'content_type', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'content_id', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'content_action', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'is_read', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'extra', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_alert', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_alert_time', + columns: [ + 'alert_time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/UserAlertsPrefs.php b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php new file mode 100644 index 0000000000..8695260224 --- /dev/null +++ b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php @@ -0,0 +1,228 @@ + 0, + 'alert_pref' => 'alert_timeout', + 'alert_value' => 10, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'announcements', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'birthday', + 'alert_value' => 2, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'board_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'buddy_request', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'groupr_approved', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'groupr_rejected', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_group_request', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_register', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_report', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_report_reply', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_auto_notify', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_like', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_mention', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_notify_pref', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_notify_type', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_quote', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_receive_body', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_report', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_report_reply', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_new', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_reply', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'request_group', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'topic_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_attachment', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_reply', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_post', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'warn_any', + 'alert_value' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'user_alerts_prefs'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'alert_pref', + type: 'varchar', + size: 32, + default: '', + ), + new Column( + name: 'alert_value', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'alert_pref', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/UserDrafts.php b/Sources/Db/Schema/v3_0/UserDrafts.php new file mode 100644 index 0000000000..d92ee23f25 --- /dev/null +++ b/Sources/Db/Schema/v3_0/UserDrafts.php @@ -0,0 +1,163 @@ +name = 'user_drafts'; + + $this->columns = [ + new Column( + name: 'id_draft', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_reply', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'type', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'poster_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'smileys_enabled', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'icon', + type: 'varchar', + size: 16, + not_null: true, + default: 'xx', + ), + new Column( + name: 'locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'is_sticky', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'to_list', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_draft', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_draft', + 'type', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/UserLikes.php b/Sources/Db/Schema/v3_0/UserLikes.php new file mode 100644 index 0000000000..1257485ffd --- /dev/null +++ b/Sources/Db/Schema/v3_0/UserLikes.php @@ -0,0 +1,103 @@ +name = 'user_likes'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'content_type', + type: 'char', + size: 6, + default: '', + ), + new Column( + name: 'content_id', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'like_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'content_id', + 'content_type', + 'id_member', + ], + ), + new Index( + name: 'content', + columns: [ + 'content_id', + 'content_type', + ], + ), + new Index( + name: 'liker', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/Sources/Db/Schema/v3_0/index.php b/Sources/Db/Schema/v3_0/index.php new file mode 100644 index 0000000000..976d292448 --- /dev/null +++ b/Sources/Db/Schema/v3_0/index.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/other/install_3-0_MySQL.sql b/other/install_3-0_MySQL.sql index fca8f7057e..e5641ba27e 100644 --- a/other/install_3-0_MySQL.sql +++ b/other/install_3-0_MySQL.sql @@ -1563,7 +1563,9 @@ VALUES (1, 1, 1, 1, 1, '{$default_board_name}', '{$default_board_description}', INSERT INTO {$db_prefix}board_permissions_view (id_group, id_board, deny) -VALUES (-1,1,0), (0,1,0), (2,1,0); +VALUES (-1, 1, 0), + (0, 1, 0), + (2, 1, 0); # -------------------------------------------------------- # @@ -1785,6 +1787,7 @@ VALUES ('Independence Day', '1004-07-04'), # INSERT INTO {$db_prefix}categories + (id_cat, cat_order, name, description, can_collapse) VALUES (1, 0, '{$default_category_name}', '', 1); # -------------------------------------------------------- @@ -1864,7 +1867,10 @@ VALUES ('Simple Machines Third-party Mod Site', 'https://custom.simplemachines.o INSERT INTO {$db_prefix}permission_profiles (id_profile, profile_name) -VALUES (1, 'default'), (2, 'no_polls'), (3, 'reply_only'), (4, 'read_only'); +VALUES (1, 'default'), + (2, 'no_polls'), + (3, 'reply_only'), + (4, 'read_only'); # -------------------------------------------------------- # From b21fbb1d453f817ab106349244ea742c93bbb317 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Thu, 8 Feb 2024 12:56:58 -0700 Subject: [PATCH 002/102] Adds database schema definition for SMF 2.1 to ./other/Schema Signed-off-by: Jon Stovell --- other/Schema/v2_1/AdminInfoFiles.php | 141 ++ other/Schema/v2_1/ApprovalQueue.php | 74 + other/Schema/v2_1/Attachments.php | 191 +++ other/Schema/v2_1/BackgroundTasks.php | 95 ++ other/Schema/v2_1/BanGroups.php | 128 ++ other/Schema/v2_1/BanItems.php | 127 ++ other/Schema/v2_1/BoardPermissions.php | 1629 ++++++++++++++++++++ other/Schema/v2_1/BoardPermissionsView.php | 98 ++ other/Schema/v2_1/Boards.php | 235 +++ other/Schema/v2_1/Calendar.php | 148 ++ other/Schema/v2_1/CalendarHolidays.php | 625 ++++++++ other/Schema/v2_1/Categories.php | 101 ++ other/Schema/v2_1/CustomFields.php | 279 ++++ other/Schema/v2_1/GroupModerators.php | 76 + other/Schema/v2_1/LogActions.php | 165 ++ other/Schema/v2_1/LogActivity.php | 103 ++ other/Schema/v2_1/LogBanned.php | 101 ++ other/Schema/v2_1/LogBoards.php | 83 + other/Schema/v2_1/LogComments.php | 146 ++ other/Schema/v2_1/LogDigest.php | 88 ++ other/Schema/v2_1/LogErrors.php | 151 ++ other/Schema/v2_1/LogFloodcontrol.php | 95 ++ other/Schema/v2_1/LogMarkRead.php | 83 + other/Schema/v2_1/LogMemberNotices.php | 81 + other/Schema/v2_1/LogNotify.php | 97 ++ other/Schema/v2_1/LogOnline.php | 125 ++ other/Schema/v2_1/LogPolls.php | 86 ++ other/Schema/v2_1/LogReported.php | 176 +++ other/Schema/v2_1/LogReportedComments.php | 122 ++ other/Schema/v2_1/LogScheduledTasks.php | 86 ++ other/Schema/v2_1/LogSearchMessages.php | 76 + other/Schema/v2_1/LogSearchResults.php | 97 ++ other/Schema/v2_1/LogSearchSubjects.php | 82 + other/Schema/v2_1/LogSearchTopics.php | 76 + other/Schema/v2_1/LogSpiderHits.php | 102 ++ other/Schema/v2_1/LogSpiderStats.php | 88 ++ other/Schema/v2_1/LogSubscribed.php | 160 ++ other/Schema/v2_1/LogTopics.php | 95 ++ other/Schema/v2_1/MailQueue.php | 130 ++ other/Schema/v2_1/MemberLogins.php | 102 ++ other/Schema/v2_1/Membergroups.php | 211 +++ other/Schema/v2_1/Members.php | 461 ++++++ other/Schema/v2_1/Mentions.php | 104 ++ other/Schema/v2_1/MessageIcons.php | 169 ++ other/Schema/v2_1/Messages.php | 265 ++++ other/Schema/v2_1/ModeratorGroups.php | 76 + other/Schema/v2_1/Moderators.php | 76 + other/Schema/v2_1/PackageServers.php | 105 ++ other/Schema/v2_1/PermissionProfiles.php | 92 ++ other/Schema/v2_1/Permissions.php | 286 ++++ other/Schema/v2_1/PersonalMessages.php | 135 ++ other/Schema/v2_1/PmLabeledMessages.php | 76 + other/Schema/v2_1/PmLabels.php | 83 + other/Schema/v2_1/PmRecipients.php | 119 ++ other/Schema/v2_1/PmRules.php | 118 ++ other/Schema/v2_1/PollChoices.php | 90 ++ other/Schema/v2_1/Polls.php | 145 ++ other/Schema/v2_1/Qanda.php | 94 ++ other/Schema/v2_1/ScheduledTasks.php | 243 +++ other/Schema/v2_1/Sessions.php | 82 + other/Schema/v2_1/SmileyFiles.php | 84 + other/Schema/v2_1/Smileys.php | 104 ++ other/Schema/v2_1/Spiders.php | 191 +++ other/Schema/v2_1/Subscriptions.php | 143 ++ other/Schema/v2_1/Themes.php | 149 ++ other/Schema/v2_1/Topics.php | 242 +++ other/Schema/v2_1/UserAlerts.php | 142 ++ other/Schema/v2_1/UserAlertsPrefs.php | 228 +++ other/Schema/v2_1/UserDrafts.php | 163 ++ other/Schema/v2_1/UserLikes.php | 103 ++ other/Schema/v2_1/index.php | 9 + 71 files changed, 11331 insertions(+) create mode 100644 other/Schema/v2_1/AdminInfoFiles.php create mode 100644 other/Schema/v2_1/ApprovalQueue.php create mode 100644 other/Schema/v2_1/Attachments.php create mode 100644 other/Schema/v2_1/BackgroundTasks.php create mode 100644 other/Schema/v2_1/BanGroups.php create mode 100644 other/Schema/v2_1/BanItems.php create mode 100644 other/Schema/v2_1/BoardPermissions.php create mode 100644 other/Schema/v2_1/BoardPermissionsView.php create mode 100644 other/Schema/v2_1/Boards.php create mode 100644 other/Schema/v2_1/Calendar.php create mode 100644 other/Schema/v2_1/CalendarHolidays.php create mode 100644 other/Schema/v2_1/Categories.php create mode 100644 other/Schema/v2_1/CustomFields.php create mode 100644 other/Schema/v2_1/GroupModerators.php create mode 100644 other/Schema/v2_1/LogActions.php create mode 100644 other/Schema/v2_1/LogActivity.php create mode 100644 other/Schema/v2_1/LogBanned.php create mode 100644 other/Schema/v2_1/LogBoards.php create mode 100644 other/Schema/v2_1/LogComments.php create mode 100644 other/Schema/v2_1/LogDigest.php create mode 100644 other/Schema/v2_1/LogErrors.php create mode 100644 other/Schema/v2_1/LogFloodcontrol.php create mode 100644 other/Schema/v2_1/LogMarkRead.php create mode 100644 other/Schema/v2_1/LogMemberNotices.php create mode 100644 other/Schema/v2_1/LogNotify.php create mode 100644 other/Schema/v2_1/LogOnline.php create mode 100644 other/Schema/v2_1/LogPolls.php create mode 100644 other/Schema/v2_1/LogReported.php create mode 100644 other/Schema/v2_1/LogReportedComments.php create mode 100644 other/Schema/v2_1/LogScheduledTasks.php create mode 100644 other/Schema/v2_1/LogSearchMessages.php create mode 100644 other/Schema/v2_1/LogSearchResults.php create mode 100644 other/Schema/v2_1/LogSearchSubjects.php create mode 100644 other/Schema/v2_1/LogSearchTopics.php create mode 100644 other/Schema/v2_1/LogSpiderHits.php create mode 100644 other/Schema/v2_1/LogSpiderStats.php create mode 100644 other/Schema/v2_1/LogSubscribed.php create mode 100644 other/Schema/v2_1/LogTopics.php create mode 100644 other/Schema/v2_1/MailQueue.php create mode 100644 other/Schema/v2_1/MemberLogins.php create mode 100644 other/Schema/v2_1/Membergroups.php create mode 100644 other/Schema/v2_1/Members.php create mode 100644 other/Schema/v2_1/Mentions.php create mode 100644 other/Schema/v2_1/MessageIcons.php create mode 100644 other/Schema/v2_1/Messages.php create mode 100644 other/Schema/v2_1/ModeratorGroups.php create mode 100644 other/Schema/v2_1/Moderators.php create mode 100644 other/Schema/v2_1/PackageServers.php create mode 100644 other/Schema/v2_1/PermissionProfiles.php create mode 100644 other/Schema/v2_1/Permissions.php create mode 100644 other/Schema/v2_1/PersonalMessages.php create mode 100644 other/Schema/v2_1/PmLabeledMessages.php create mode 100644 other/Schema/v2_1/PmLabels.php create mode 100644 other/Schema/v2_1/PmRecipients.php create mode 100644 other/Schema/v2_1/PmRules.php create mode 100644 other/Schema/v2_1/PollChoices.php create mode 100644 other/Schema/v2_1/Polls.php create mode 100644 other/Schema/v2_1/Qanda.php create mode 100644 other/Schema/v2_1/ScheduledTasks.php create mode 100644 other/Schema/v2_1/Sessions.php create mode 100644 other/Schema/v2_1/SmileyFiles.php create mode 100644 other/Schema/v2_1/Smileys.php create mode 100644 other/Schema/v2_1/Spiders.php create mode 100644 other/Schema/v2_1/Subscriptions.php create mode 100644 other/Schema/v2_1/Themes.php create mode 100644 other/Schema/v2_1/Topics.php create mode 100644 other/Schema/v2_1/UserAlerts.php create mode 100644 other/Schema/v2_1/UserAlertsPrefs.php create mode 100644 other/Schema/v2_1/UserDrafts.php create mode 100644 other/Schema/v2_1/UserLikes.php create mode 100644 other/Schema/v2_1/index.php diff --git a/other/Schema/v2_1/AdminInfoFiles.php b/other/Schema/v2_1/AdminInfoFiles.php new file mode 100644 index 0000000000..94cd2f104b --- /dev/null +++ b/other/Schema/v2_1/AdminInfoFiles.php @@ -0,0 +1,141 @@ + 1, + 'filename' => 'current-version.js', + 'path' => '/smf/', + 'parameters' => 'version=%3$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 2, + 'filename' => 'detailed-version.js', + 'path' => '/smf/', + 'parameters' => 'language=%1$s&version=%3$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 3, + 'filename' => 'latest-news.js', + 'path' => '/smf/', + 'parameters' => 'language=%1$s&format=%2$s', + 'data' => '', + 'filetype' => 'text/javascript', + ], + [ + 'id_file' => 4, + 'filename' => 'latest-versions.txt', + 'path' => '/smf/', + 'parameters' => 'version=%3$s', + 'data' => '', + 'filetype' => 'text/plain', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'admin_info_files'; + + $this->columns = [ + new Column( + name: 'id_file', + type: 'tinyint', + unsigned: true, + auto: true, + ), + new Column( + name: 'filename', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'path', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'parameters', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'data', + type: 'text', + not_null: true, + ), + new Column( + name: 'filetype', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_file', + ], + ), + new Index( + name: 'idx_filename', + columns: [ + 'filename(30)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/ApprovalQueue.php b/other/Schema/v2_1/ApprovalQueue.php new file mode 100644 index 0000000000..7cbc20fa2c --- /dev/null +++ b/other/Schema/v2_1/ApprovalQueue.php @@ -0,0 +1,74 @@ +name = 'approval_queue'; + + $this->columns = [ + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_attach', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_event', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Attachments.php b/other/Schema/v2_1/Attachments.php new file mode 100644 index 0000000000..3560af0f9b --- /dev/null +++ b/other/Schema/v2_1/Attachments.php @@ -0,0 +1,191 @@ +name = 'attachments'; + + $this->columns = [ + new Column( + name: 'id_attach', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_thumb', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_folder', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'attachment_type', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'filename', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'file_hash', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'fileext', + type: 'varchar', + size: 8, + not_null: true, + default: '', + ), + new Column( + name: 'size', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'downloads', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'width', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'height', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'mime_type', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_attach', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_attach', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_attachment_type', + columns: [ + 'attachment_type', + ], + ), + new Index( + name: 'idx_id_thumb', + columns: [ + 'id_thumb', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/BackgroundTasks.php b/other/Schema/v2_1/BackgroundTasks.php new file mode 100644 index 0000000000..ffb45eeabe --- /dev/null +++ b/other/Schema/v2_1/BackgroundTasks.php @@ -0,0 +1,95 @@ +name = 'background_tasks'; + + $this->columns = [ + new Column( + name: 'id_task', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'task_file', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'task_class', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'task_data', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'claimed_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_task', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/BanGroups.php b/other/Schema/v2_1/BanGroups.php new file mode 100644 index 0000000000..e4df98deca --- /dev/null +++ b/other/Schema/v2_1/BanGroups.php @@ -0,0 +1,128 @@ +name = 'ban_groups'; + + $this->columns = [ + new Column( + name: 'id_ban_group', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'ban_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'expire_time', + type: 'int', + unsigned: true, + ), + new Column( + name: 'cannot_access', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_register', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_post', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'cannot_login', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'reason', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'notes', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/BanItems.php b/other/Schema/v2_1/BanItems.php new file mode 100644 index 0000000000..51daa7d959 --- /dev/null +++ b/other/Schema/v2_1/BanItems.php @@ -0,0 +1,127 @@ +name = 'ban_items'; + + $this->columns = [ + new Column( + name: 'id_ban', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_ban_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip_low', + type: 'inet', + size: 16, + ), + new Column( + name: 'ip_high', + type: 'inet', + size: 16, + ), + new Column( + name: 'hostname', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'email_address', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hits', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban', + ], + ), + new Index( + name: 'idx_id_ban_group', + columns: [ + 'id_ban_group', + ], + ), + new Index( + name: 'idx_id_ban_ip', + columns: [ + 'ip_low', + 'ip_high', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/BoardPermissions.php b/other/Schema/v2_1/BoardPermissions.php new file mode 100644 index 0000000000..c5d80de2c1 --- /dev/null +++ b/other/Schema/v2_1/BoardPermissions.php @@ -0,0 +1,1629 @@ + -1, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_add_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_edit_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 1, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 2, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'remove_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 3, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => -1, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 0, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_new', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'move_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'split_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 2, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'moderate_board', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_new', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_draft', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_reply_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_reply_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_topics', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_replies_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_unapproved_attachments', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_post', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_add_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_view', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_vote', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'poll_edit_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'report_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'lock_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'delete_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'modify_own', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'make_sticky', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'lock_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'remove_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'move_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'merge_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'split_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'delete_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'modify_any', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'approve_posts', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'post_attachment', + ], + [ + 'id_group' => 3, + 'id_profile' => 4, + 'permission' => 'view_attachments', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'board_permissions'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + default: 0, + ), + new Column( + name: 'id_profile', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'permission', + type: 'varchar', + size: 30, + default: '', + ), + new Column( + name: 'add_deny', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_profile', + 'permission', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/BoardPermissionsView.php b/other/Schema/v2_1/BoardPermissionsView.php new file mode 100644 index 0000000000..80c615b108 --- /dev/null +++ b/other/Schema/v2_1/BoardPermissionsView.php @@ -0,0 +1,98 @@ + -1, + 'id_board' => 1, + 'deny' => 0, + ], + [ + 'id_group' => 0, + 'id_board' => 1, + 'deny' => 0, + ], + [ + 'id_group' => 2, + 'id_board' => 1, + 'deny' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'board_permissions_view'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + ), + new Column( + name: 'deny', + type: 'smallint', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_board', + 'deny', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Boards.php b/other/Schema/v2_1/Boards.php new file mode 100644 index 0000000000..a62878d3aa --- /dev/null +++ b/other/Schema/v2_1/Boards.php @@ -0,0 +1,235 @@ + 1, + 'id_cat' => 1, + 'board_order' => 1, + 'id_last_msg' => 1, + 'id_msg_updated' => 1, + 'name' => '{$default_board_name}', + 'description' => '{$default_board_description}', + 'num_topics' => 1, + 'num_posts' => 1, + 'member_groups' => '-1,0,2', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'boards'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_cat', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'child_level', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_parent', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'board_order', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_last_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg_updated', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '-1,0', + ), + new Column( + name: 'id_profile', + type: 'smallint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'num_topics', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_posts', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'count_posts', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'override_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_posts', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_topics', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'redirect', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'deny_member_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + ], + ), + new Index( + name: 'idx_categories', + type: 'unique', + columns: [ + 'id_cat', + 'id_board', + ], + ), + new Index( + name: 'idx_id_parent', + columns: [ + 'id_parent', + ], + ), + new Index( + name: 'idx_id_msg_updated', + columns: [ + 'id_msg_updated', + ], + ), + new Index( + name: 'idx_member_groups', + columns: [ + 'member_groups(48)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Calendar.php b/other/Schema/v2_1/Calendar.php new file mode 100644 index 0000000000..eb25e1f19f --- /dev/null +++ b/other/Schema/v2_1/Calendar.php @@ -0,0 +1,148 @@ +name = 'calendar'; + + $this->columns = [ + new Column( + name: 'id_event', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'start_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'end_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'start_time', + type: 'time', + ), + new Column( + name: 'end_time', + type: 'time', + ), + new Column( + name: 'timezone', + type: 'varchar', + size: 80, + ), + new Column( + name: 'location', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_event', + ], + ), + new Index( + name: 'idx_start_date', + columns: [ + 'start_date', + ], + ), + new Index( + name: 'idx_end_date', + columns: [ + 'end_date', + ], + ), + new Index( + name: 'idx_topic', + columns: [ + 'id_topic', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/CalendarHolidays.php b/other/Schema/v2_1/CalendarHolidays.php new file mode 100644 index 0000000000..a335707280 --- /dev/null +++ b/other/Schema/v2_1/CalendarHolidays.php @@ -0,0 +1,625 @@ + 'New Year\'s', + 'event_date' => '1004-01-01', + ], + [ + 'title' => 'Christmas', + 'event_date' => '1004-12-25', + ], + [ + 'title' => 'Valentine\'s Day', + 'event_date' => '1004-02-14', + ], + [ + 'title' => 'St. Patrick\'s Day', + 'event_date' => '1004-03-17', + ], + [ + 'title' => 'April Fools', + 'event_date' => '1004-04-01', + ], + [ + 'title' => 'Earth Day', + 'event_date' => '1004-04-22', + ], + [ + 'title' => 'United Nations Day', + 'event_date' => '1004-10-24', + ], + [ + 'title' => 'Halloween', + 'event_date' => '1004-10-31', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2010-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2011-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2012-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2013-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2014-05-11', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2015-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2016-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2017-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2018-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2019-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2020-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2021-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2022-05-08', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2023-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2024-05-12', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2025-05-11', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2026-05-10', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2027-05-09', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2028-05-14', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2029-05-13', + ], + [ + 'title' => 'Mother\'s Day', + 'event_date' => '2030-05-12', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2010-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2011-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2012-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2013-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2014-06-15', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2015-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2016-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2017-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2018-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2019-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2020-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2021-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2022-06-19', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2023-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2024-06-16', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2025-06-15', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2026-06-21', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2027-06-20', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2028-06-18', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2029-06-17', + ], + [ + 'title' => 'Father\'s Day', + 'event_date' => '2030-06-16', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2010-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2011-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2012-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2013-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2014-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2015-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2016-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2017-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2018-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2019-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2020-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2021-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2022-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2023-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2024-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2025-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2026-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2027-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2028-06-20', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2029-06-21', + ], + [ + 'title' => 'Summer Solstice', + 'event_date' => '2030-06-21', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2010-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2011-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2012-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2013-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2014-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2015-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2016-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2017-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2018-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2019-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2020-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2021-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2022-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2023-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2024-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2025-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2026-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2027-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2028-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2029-03-20', + ], + [ + 'title' => 'Vernal Equinox', + 'event_date' => '2030-03-20', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2010-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2011-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2012-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2013-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2014-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2015-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2016-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2017-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2018-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2019-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2020-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2021-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2022-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2023-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2024-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2025-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2026-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2027-12-22', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2028-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2029-12-21', + ], + [ + 'title' => 'Winter Solstice', + 'event_date' => '2030-12-21', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2010-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2011-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2012-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2013-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2014-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2015-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2016-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2017-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2018-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2019-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2020-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2021-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2022-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2023-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2024-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2025-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2026-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2027-09-23', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2028-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2029-09-22', + ], + [ + 'title' => 'Autumnal Equinox', + 'event_date' => '2030-09-22', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'calendar_holidays'; + + $this->columns = [ + new Column( + name: 'id_holiday', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'event_date', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_holiday', + ], + ), + new Index( + name: 'idx_event_date', + columns: [ + 'event_date', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Categories.php b/other/Schema/v2_1/Categories.php new file mode 100644 index 0000000000..519d63d723 --- /dev/null +++ b/other/Schema/v2_1/Categories.php @@ -0,0 +1,101 @@ + 1, + 'cat_order' => 0, + 'name' => '{$default_category_name}', + 'description' => '', + 'can_collapse' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'categories'; + + $this->columns = [ + new Column( + name: 'id_cat', + type: 'tinyint', + unsigned: true, + auto: true, + ), + new Column( + name: 'cat_order', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'can_collapse', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_cat', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/CustomFields.php b/other/Schema/v2_1/CustomFields.php new file mode 100644 index 0000000000..46f9537178 --- /dev/null +++ b/other/Schema/v2_1/CustomFields.php @@ -0,0 +1,279 @@ + 'cust_icq', + 'field_name' => '{icq}', + 'field_desc' => '{icq_desc}', + 'field_type' => 'text', + 'field_length' => 12, + 'field_options' => '', + 'field_order' => 1, + 'mask' => 'regex~[1-9][0-9]{4,9}~i', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => 'ICQ - {INPUT}', + 'placement' => 1, + ], + [ + 'col_name' => 'cust_skype', + 'field_name' => '{skype}', + 'field_desc' => '{skype_desc}', + 'field_type' => 'text', + 'field_length' => 32, + 'field_options' => '', + 'field_order' => 2, + 'mask' => 'nohtml', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => '{INPUT} ', + 'placement' => 1, + ], + [ + 'col_name' => 'cust_loca', + 'field_name' => '{location}', + 'field_desc' => '{location_desc}', + 'field_type' => 'text', + 'field_length' => 50, + 'field_options' => '', + 'field_order' => 4, + 'mask' => 'nohtml', + 'show_reg' => 0, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '', + 'enclose' => '', + 'placement' => 0, + ], + [ + 'col_name' => 'cust_gender', + 'field_name' => '{gender}', + 'field_desc' => '{gender_desc}', + 'field_type' => 'radio', + 'field_length' => 255, + 'field_options' => '{gender_0},{gender_1},{gender_2}', + 'field_order' => 5, + 'mask' => 'nohtml', + 'show_reg' => 1, + 'show_display' => 1, + 'show_mlist' => 0, + 'show_profile' => 'forumprofile', + 'private' => 0, + 'active' => 1, + 'bbc' => 0, + 'can_search' => 0, + 'default_value' => '{gender_0}', + 'enclose' => '', + 'placement' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'custom_fields'; + + $this->columns = [ + new Column( + name: 'id_field', + type: 'smallint', + auto: true, + ), + new Column( + name: 'col_name', + type: 'varchar', + size: 12, + not_null: true, + default: '', + ), + new Column( + name: 'field_name', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'field_desc', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'field_type', + type: 'varchar', + size: 8, + not_null: true, + default: 'text', + ), + new Column( + name: 'field_length', + type: 'smallint', + not_null: true, + default: 255, + ), + new Column( + name: 'field_options', + type: 'text', + not_null: true, + ), + new Column( + name: 'field_order', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'mask', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'show_reg', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_display', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_mlist', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'show_profile', + type: 'varchar', + size: 20, + not_null: true, + default: 'forumprofile', + ), + new Column( + name: 'private', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'active', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'bbc', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'can_search', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'default_value', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'enclose', + type: 'text', + not_null: true, + ), + new Column( + name: 'placement', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_field', + ], + ), + new Index( + name: 'idx_col_name', + type: 'unique', + columns: [ + 'col_name', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/GroupModerators.php b/other/Schema/v2_1/GroupModerators.php new file mode 100644 index 0000000000..1d588e6518 --- /dev/null +++ b/other/Schema/v2_1/GroupModerators.php @@ -0,0 +1,76 @@ +name = 'group_moderators'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogActions.php b/other/Schema/v2_1/LogActions.php new file mode 100644 index 0000000000..022eab30b0 --- /dev/null +++ b/other/Schema/v2_1/LogActions.php @@ -0,0 +1,165 @@ +name = 'log_actions'; + + $this->columns = [ + new Column( + name: 'id_action', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_log', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'action', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'extra', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_action', + ], + ), + new Index( + name: 'idx_id_log', + columns: [ + 'id_log', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_id_board', + columns: [ + 'id_board', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_id_topic_id_log', + columns: [ + 'id_topic', + 'id_log', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogActivity.php b/other/Schema/v2_1/LogActivity.php new file mode 100644 index 0000000000..5868bfa16b --- /dev/null +++ b/other/Schema/v2_1/LogActivity.php @@ -0,0 +1,103 @@ +name = 'log_activity'; + + $this->columns = [ + new Column( + name: 'date', + type: 'date', + not_null: true, + ), + new Column( + name: 'hits', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'topics', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'posts', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'registers', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'most_on', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'date', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogBanned.php b/other/Schema/v2_1/LogBanned.php new file mode 100644 index 0000000000..7a321eb4d8 --- /dev/null +++ b/other/Schema/v2_1/LogBanned.php @@ -0,0 +1,101 @@ +name = 'log_banned'; + + $this->columns = [ + new Column( + name: 'id_ban_log', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'email', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_ban_log', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogBoards.php b/other/Schema/v2_1/LogBoards.php new file mode 100644 index 0000000000..aadcd47cd0 --- /dev/null +++ b/other/Schema/v2_1/LogBoards.php @@ -0,0 +1,83 @@ +name = 'log_boards'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogComments.php b/other/Schema/v2_1/LogComments.php new file mode 100644 index 0000000000..7e8bfb9a99 --- /dev/null +++ b/other/Schema/v2_1/LogComments.php @@ -0,0 +1,146 @@ +name = 'log_comments'; + + $this->columns = [ + new Column( + name: 'id_comment', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'comment_type', + type: 'varchar', + size: 8, + not_null: true, + default: 'warning', + ), + new Column( + name: 'id_recipient', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'recipient_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'id_notice', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'counter', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_comment', + ], + ), + new Index( + name: 'idx_id_recipient', + columns: [ + 'id_recipient', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_comment_type', + columns: [ + 'comment_type(8)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogDigest.php b/other/Schema/v2_1/LogDigest.php new file mode 100644 index 0000000000..98c50e1e31 --- /dev/null +++ b/other/Schema/v2_1/LogDigest.php @@ -0,0 +1,88 @@ +name = 'log_digest'; + + $this->columns = [ + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'note_type', + type: 'varchar', + size: 10, + not_null: true, + default: 'post', + ), + new Column( + name: 'daily', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'exclude', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogErrors.php b/other/Schema/v2_1/LogErrors.php new file mode 100644 index 0000000000..1aeb3ae50d --- /dev/null +++ b/other/Schema/v2_1/LogErrors.php @@ -0,0 +1,151 @@ +name = 'log_errors'; + + $this->columns = [ + new Column( + name: 'id_error', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'url', + type: 'text', + not_null: true, + ), + new Column( + name: 'message', + type: 'text', + not_null: true, + ), + new Column( + name: 'session', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'error_type', + type: 'char', + size: 15, + not_null: true, + default: 'general', + ), + new Column( + name: 'file', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'line', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'backtrace', + type: 'varchar', + size: 10000, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_error', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_ip', + columns: [ + 'ip', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogFloodcontrol.php b/other/Schema/v2_1/LogFloodcontrol.php new file mode 100644 index 0000000000..e5c3e7c805 --- /dev/null +++ b/other/Schema/v2_1/LogFloodcontrol.php @@ -0,0 +1,95 @@ +name = 'log_floodcontrol'; + + $this->columns = [ + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'log_type', + type: 'varchar', + size: 30, + default: 'post', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'ip', + 'log_type', + ], + ), + new Index( + type: 'primary', + columns: [ + 'id_request', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + 'id_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogMarkRead.php b/other/Schema/v2_1/LogMarkRead.php new file mode 100644 index 0000000000..0f4c9b8db5 --- /dev/null +++ b/other/Schema/v2_1/LogMarkRead.php @@ -0,0 +1,83 @@ +name = 'log_mark_read'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogMemberNotices.php b/other/Schema/v2_1/LogMemberNotices.php new file mode 100644 index 0000000000..4417da825c --- /dev/null +++ b/other/Schema/v2_1/LogMemberNotices.php @@ -0,0 +1,81 @@ +name = 'log_member_notices'; + + $this->columns = [ + new Column( + name: 'id_notice', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_notice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogNotify.php b/other/Schema/v2_1/LogNotify.php new file mode 100644 index 0000000000..e807add2bd --- /dev/null +++ b/other/Schema/v2_1/LogNotify.php @@ -0,0 +1,97 @@ +name = 'log_notify'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'sent', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_topic', + 'id_board', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogOnline.php b/other/Schema/v2_1/LogOnline.php new file mode 100644 index 0000000000..c4f5ef496e --- /dev/null +++ b/other/Schema/v2_1/LogOnline.php @@ -0,0 +1,125 @@ +name = 'log_online'; + + $this->columns = [ + new Column( + name: 'session', + type: 'varchar', + size: 128, + default: '', + ), + new Column( + name: 'log_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'url', + type: 'varchar', + size: 2048, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'session', + ], + ), + new Index( + name: 'idx_log_time', + columns: [ + 'log_time', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + type: 'primary', + columns: [ + 'id_install', + ], + ), + new Index( + name: 'idx_filename', + columns: [ + 'filename(15)', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogPolls.php b/other/Schema/v2_1/LogPolls.php new file mode 100644 index 0000000000..ea02292dc3 --- /dev/null +++ b/other/Schema/v2_1/LogPolls.php @@ -0,0 +1,86 @@ +name = 'log_polls'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_choice', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + name: 'idx_id_poll', + columns: [ + 'id_poll', + 'id_member', + 'id_choice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogReported.php b/other/Schema/v2_1/LogReported.php new file mode 100644 index 0000000000..3ef2e475fd --- /dev/null +++ b/other/Schema/v2_1/LogReported.php @@ -0,0 +1,176 @@ +name = 'log_reported'; + + $this->columns = [ + new Column( + name: 'id_report', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'membername', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'time_started', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_updated', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'num_reports', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'closed', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'ignore_all', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_report', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + new Index( + name: 'idx_closed', + columns: [ + 'closed', + ], + ), + new Index( + name: 'idx_time_started', + columns: [ + 'time_started', + ], + ), + new Index( + name: 'idx_id_msg', + columns: [ + 'id_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogReportedComments.php b/other/Schema/v2_1/LogReportedComments.php new file mode 100644 index 0000000000..12d900d4fc --- /dev/null +++ b/other/Schema/v2_1/LogReportedComments.php @@ -0,0 +1,122 @@ +name = 'log_reported_comments'; + + $this->columns = [ + new Column( + name: 'id_comment', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_report', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + not_null: true, + ), + new Column( + name: 'membername', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'member_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'comment', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'time_sent', + type: 'int', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_comment', + ], + ), + new Index( + name: 'idx_id_report', + columns: [ + 'id_report', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_time_sent', + columns: [ + 'time_sent', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogScheduledTasks.php b/other/Schema/v2_1/LogScheduledTasks.php new file mode 100644 index 0000000000..3018b14dd8 --- /dev/null +++ b/other/Schema/v2_1/LogScheduledTasks.php @@ -0,0 +1,86 @@ +name = 'log_scheduled_tasks'; + + $this->columns = [ + new Column( + name: 'id_log', + type: 'mediumint', + auto: true, + ), + new Column( + name: 'id_task', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'time_run', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_taken', + type: 'float', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_log', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSearchMessages.php b/other/Schema/v2_1/LogSearchMessages.php new file mode 100644 index 0000000000..03ed956ac3 --- /dev/null +++ b/other/Schema/v2_1/LogSearchMessages.php @@ -0,0 +1,76 @@ +name = 'log_search_messages'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSearchResults.php b/other/Schema/v2_1/LogSearchResults.php new file mode 100644 index 0000000000..7a89114e07 --- /dev/null +++ b/other/Schema/v2_1/LogSearchResults.php @@ -0,0 +1,97 @@ +name = 'log_search_results'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'relevance', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_matches', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSearchSubjects.php b/other/Schema/v2_1/LogSearchSubjects.php new file mode 100644 index 0000000000..a3381b82b7 --- /dev/null +++ b/other/Schema/v2_1/LogSearchSubjects.php @@ -0,0 +1,82 @@ +name = 'log_search_subjects'; + + $this->columns = [ + new Column( + name: 'word', + type: 'varchar', + size: 20, + default: '', + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'word', + 'id_topic', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSearchTopics.php b/other/Schema/v2_1/LogSearchTopics.php new file mode 100644 index 0000000000..1f1bf0a162 --- /dev/null +++ b/other/Schema/v2_1/LogSearchTopics.php @@ -0,0 +1,76 @@ +name = 'log_search_topics'; + + $this->columns = [ + new Column( + name: 'id_search', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_search', + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSpiderHits.php b/other/Schema/v2_1/LogSpiderHits.php new file mode 100644 index 0000000000..560a21b595 --- /dev/null +++ b/other/Schema/v2_1/LogSpiderHits.php @@ -0,0 +1,102 @@ +name = 'log_spider_hits'; + + $this->columns = [ + new Column( + name: 'id_hit', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'log_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'url', + type: 'varchar', + size: 1024, + not_null: true, + default: '', + ), + new Column( + name: 'processed', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_hit', + ], + ), + new Index( + name: 'idx_processed', + columns: [ + 'processed', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSpiderStats.php b/other/Schema/v2_1/LogSpiderStats.php new file mode 100644 index 0000000000..078062365b --- /dev/null +++ b/other/Schema/v2_1/LogSpiderStats.php @@ -0,0 +1,88 @@ +name = 'log_spider_stats'; + + $this->columns = [ + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'page_hits', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'last_seen', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'stat_date', + type: 'date', + default: '1004-01-01', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'stat_date', + 'id_spider', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogSubscribed.php b/other/Schema/v2_1/LogSubscribed.php new file mode 100644 index 0000000000..d6780c41a7 --- /dev/null +++ b/other/Schema/v2_1/LogSubscribed.php @@ -0,0 +1,160 @@ +name = 'log_subscribed'; + + $this->columns = [ + new Column( + name: 'id_sublog', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_subscribe', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'old_id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'start_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'end_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'status', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'payments_pending', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'pending_details', + type: 'text', + not_null: true, + ), + new Column( + name: 'reminder_sent', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'vendor_ref', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_sublog', + ], + ), + new Index( + name: 'idx_end_time', + columns: [ + 'end_time', + ], + ), + new Index( + name: 'idx_reminder_sent', + columns: [ + 'reminder_sent', + ], + ), + new Index( + name: 'idx_payments_pending', + columns: [ + 'payments_pending', + ], + ), + new Index( + name: 'idx_status', + columns: [ + 'status', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/LogTopics.php b/other/Schema/v2_1/LogTopics.php new file mode 100644 index 0000000000..054681aae8 --- /dev/null +++ b/other/Schema/v2_1/LogTopics.php @@ -0,0 +1,95 @@ +name = 'log_topics'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unwatched', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'id_topic', + ], + ), + new Index( + name: 'idx_id_topic', + columns: [ + 'id_topic', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/MailQueue.php b/other/Schema/v2_1/MailQueue.php new file mode 100644 index 0000000000..322a3ddf9c --- /dev/null +++ b/other/Schema/v2_1/MailQueue.php @@ -0,0 +1,130 @@ +name = 'mail_queue'; + + $this->columns = [ + new Column( + name: 'id_mail', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'time_sent', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'recipient', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'headers', + type: 'text', + not_null: true, + ), + new Column( + name: 'send_html', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'priority', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'private', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_mail', + ], + ), + new Index( + name: 'idx_time_sent', + columns: [ + 'time_sent', + ], + ), + new Index( + name: 'idx_mail_priority', + columns: [ + 'priority', + 'id_mail', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/MemberLogins.php b/other/Schema/v2_1/MemberLogins.php new file mode 100644 index 0000000000..b0f5d30588 --- /dev/null +++ b/other/Schema/v2_1/MemberLogins.php @@ -0,0 +1,102 @@ +name = 'member_logins'; + + $this->columns = [ + new Column( + name: 'id_login', + type: 'int', + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'ip2', + type: 'inet', + size: 16, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_login', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_time', + columns: [ + 'time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Membergroups.php b/other/Schema/v2_1/Membergroups.php new file mode 100644 index 0000000000..7841a99f6f --- /dev/null +++ b/other/Schema/v2_1/Membergroups.php @@ -0,0 +1,211 @@ + 1, + 'group_name' => '{$default_administrator_group}', + 'description' => '', + 'online_color' => '#FF0000', + 'min_posts' => -1, + 'icons' => '5#iconadmin.png', + 'group_type' => 1, + ], + [ + 'id_group' => 2, + 'group_name' => '{$default_global_moderator_group}', + 'description' => '', + 'online_color' => '#0000FF', + 'min_posts' => -1, + 'icons' => '5#icongmod.png', + 'group_type' => 0, + ], + [ + 'id_group' => 3, + 'group_name' => '{$default_moderator_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => -1, + 'icons' => '5#iconmod.png', + 'group_type' => 0, + ], + [ + 'id_group' => 4, + 'group_name' => '{$default_newbie_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 0, + 'icons' => '1#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 5, + 'group_name' => '{$default_junior_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 50, + 'icons' => '2#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 6, + 'group_name' => '{$default_full_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 100, + 'icons' => '3#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 7, + 'group_name' => '{$default_senior_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 250, + 'icons' => '4#icon.png', + 'group_type' => 0, + ], + [ + 'id_group' => 8, + 'group_name' => '{$default_hero_group}', + 'description' => '', + 'online_color' => '', + 'min_posts' => 500, + 'icons' => '5#icon.png', + 'group_type' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'membergroups'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'group_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'text', + not_null: true, + ), + new Column( + name: 'online_color', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'min_posts', + type: 'mediumint', + not_null: true, + default: -1, + ), + new Column( + name: 'max_messages', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'icons', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'group_type', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'hidden', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_parent', + type: 'smallint', + not_null: true, + default: -2, + ), + new Column( + name: 'tfa_required', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + ], + ), + new Index( + name: 'idx_min_posts', + columns: [ + 'min_posts', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Members.php b/other/Schema/v2_1/Members.php new file mode 100644 index 0000000000..0f66f5663a --- /dev/null +++ b/other/Schema/v2_1/Members.php @@ -0,0 +1,461 @@ +name = 'members'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'date_registered', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'posts', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'lngfile', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'last_login', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'real_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'instant_messages', + type: 'smallint', + not_null: true, + ), + new Column( + name: 'unread_messages', + type: 'smallint', + not_null: true, + ), + new Column( + name: 'new_pm', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'alerts', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'buddy_list', + type: 'text', + not_null: true, + ), + new Column( + name: 'pm_ignore_list', + type: 'text', + ), + new Column( + name: 'pm_prefs', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'mod_prefs', + type: 'varchar', + size: 20, + not_null: true, + default: '', + ), + new Column( + name: 'passwd', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + new Column( + name: 'email_address', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'personal_text', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'birthdate', + type: 'date', + not_null: true, + default: '1004-01-01', + ), + new Column( + name: 'website_title', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'website_url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'show_online', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'time_format', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'signature', + type: 'text', + not_null: true, + ), + new Column( + name: 'time_offset', + type: 'float', + not_null: true, + default: 0, + ), + new Column( + name: 'avatar', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'usertitle', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'member_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'member_ip2', + type: 'inet', + size: 16, + ), + new Column( + name: 'secret_question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'secret_answer', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_activated', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'validation_code', + type: 'varchar', + size: 10, + not_null: true, + default: '', + ), + new Column( + name: 'id_msg_last_visit', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'additional_groups', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'smiley_set', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + new Column( + name: 'id_post_group', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'total_time_logged_in', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'password_salt', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'ignore_boards', + type: 'text', + not_null: true, + ), + new Column( + name: 'warning', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'passwd_flood', + type: 'varchar', + size: 12, + not_null: true, + default: '', + ), + new Column( + name: 'pm_receive_from', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'timezone', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'tfa_secret', + type: 'varchar', + size: 24, + not_null: true, + default: '', + ), + new Column( + name: 'tfa_backup', + type: 'varchar', + size: 64, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_member_name', + columns: [ + 'member_name', + ], + ), + new Index( + name: 'idx_real_name', + columns: [ + 'real_name', + ], + ), + new Index( + name: 'idx_email_address', + columns: [ + 'email_address', + ], + ), + new Index( + name: 'idx_date_registered', + columns: [ + 'date_registered', + ], + ), + new Index( + name: 'idx_id_group', + columns: [ + 'id_group', + ], + ), + new Index( + name: 'idx_birthdate', + columns: [ + 'birthdate', + ], + ), + new Index( + name: 'idx_posts', + columns: [ + 'posts', + ], + ), + new Index( + name: 'idx_last_login', + columns: [ + 'last_login', + ], + ), + new Index( + name: 'idx_lngfile', + columns: [ + 'lngfile(30)', + ], + ), + new Index( + name: 'idx_id_post_group', + columns: [ + 'id_post_group', + ], + ), + new Index( + name: 'idx_warning', + columns: [ + 'warning', + ], + ), + new Index( + name: 'idx_total_time_logged_in', + columns: [ + 'total_time_logged_in', + ], + ), + new Index( + name: 'idx_id_theme', + columns: [ + 'id_theme', + ], + ), + new Index( + name: 'idx_active_real_name', + columns: [ + 'is_activated', + 'real_name', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Mentions.php b/other/Schema/v2_1/Mentions.php new file mode 100644 index 0000000000..915314c78d --- /dev/null +++ b/other/Schema/v2_1/Mentions.php @@ -0,0 +1,104 @@ +name = 'mentions'; + + $this->columns = [ + new Column( + name: 'content_id', + type: 'int', + default: 0, + ), + new Column( + name: 'content_type', + type: 'varchar', + size: 10, + default: '', + ), + new Column( + name: 'id_mentioned', + type: 'int', + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + ), + new Column( + name: 'time', + type: 'int', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'content_id', + 'content_type', + 'id_mentioned', + ], + ), + new Index( + name: 'content', + columns: [ + 'content_id', + 'content_type', + ], + ), + new Index( + name: 'mentionee', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/MessageIcons.php b/other/Schema/v2_1/MessageIcons.php new file mode 100644 index 0000000000..f4b814a2b1 --- /dev/null +++ b/other/Schema/v2_1/MessageIcons.php @@ -0,0 +1,169 @@ + 'xx', + 'title' => 'Standard', + 'icon_order' => '0', + ], + [ + 'filename' => 'thumbup', + 'title' => 'Thumb Up', + 'icon_order' => '1', + ], + [ + 'filename' => 'thumbdown', + 'title' => 'Thumb Down', + 'icon_order' => '2', + ], + [ + 'filename' => 'exclamation', + 'title' => 'Exclamation point', + 'icon_order' => '3', + ], + [ + 'filename' => 'question', + 'title' => 'Question mark', + 'icon_order' => '4', + ], + [ + 'filename' => 'lamp', + 'title' => 'Lamp', + 'icon_order' => '5', + ], + [ + 'filename' => 'smiley', + 'title' => 'Smiley', + 'icon_order' => '6', + ], + [ + 'filename' => 'angry', + 'title' => 'Angry', + 'icon_order' => '7', + ], + [ + 'filename' => 'cheesy', + 'title' => 'Cheesy', + 'icon_order' => '8', + ], + [ + 'filename' => 'grin', + 'title' => 'Grin', + 'icon_order' => '9', + ], + [ + 'filename' => 'sad', + 'title' => 'Sad', + 'icon_order' => '10', + ], + [ + 'filename' => 'wink', + 'title' => 'Wink', + 'icon_order' => '11', + ], + [ + 'filename' => 'poll', + 'title' => 'Poll', + 'icon_order' => '12', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'message_icons'; + + $this->columns = [ + new Column( + name: 'id_icon', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'title', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'filename', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'icon_order', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_icon', + ], + ), + new Index( + name: 'idx_id_board', + columns: [ + 'id_board', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Messages.php b/other/Schema/v2_1/Messages.php new file mode 100644 index 0000000000..19805d94f9 --- /dev/null +++ b/other/Schema/v2_1/Messages.php @@ -0,0 +1,265 @@ + 1, + 'id_msg_modified' => 1, + 'id_topic' => 1, + 'id_board' => 1, + 'poster_time' => '{$current_time}', + 'subject' => '{$default_topic_subject}', + 'poster_name' => 'Simple Machines', + 'poster_email' => 'info@simplemachines.org', + 'modified_name' => '', + 'body' => '{$default_topic_message}', + 'icon' => 'xx', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'messages'; + + $this->columns = [ + new Column( + name: 'id_msg', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'poster_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_msg_modified', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_email', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'poster_ip', + type: 'inet', + size: 16, + ), + new Column( + name: 'smileys_enabled', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'modified_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'modified_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'modified_reason', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + new Column( + name: 'icon', + type: 'varchar', + size: 16, + not_null: true, + default: 'xx', + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'likes', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_msg', + ], + ), + new Index( + name: 'idx_id_board', + type: 'unique', + columns: [ + 'id_board', + 'id_msg', + 'approved', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_msg', + ], + ), + new Index( + name: 'idx_ip_index', + columns: [ + 'poster_ip', + 'id_topic', + ], + ), + new Index( + name: 'idx_participation', + columns: [ + 'id_member', + 'id_topic', + ], + ), + new Index( + name: 'idx_show_posts', + columns: [ + 'id_member', + 'id_board', + ], + ), + new Index( + name: 'idx_id_member_msg', + columns: [ + 'id_member', + 'approved', + 'id_msg', + ], + ), + new Index( + name: 'idx_current_topic', + columns: [ + 'id_topic', + 'id_msg', + 'id_member', + 'approved', + ], + ), + new Index( + name: 'idx_related_ip', + columns: [ + 'id_member', + 'poster_ip', + 'id_msg', + ], + ), + new Index( + name: 'idx_likes', + columns: [ + 'likes', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/ModeratorGroups.php b/other/Schema/v2_1/ModeratorGroups.php new file mode 100644 index 0000000000..d2df784704 --- /dev/null +++ b/other/Schema/v2_1/ModeratorGroups.php @@ -0,0 +1,76 @@ +name = 'moderator_groups'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_group', + type: 'smallint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + 'id_group', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Moderators.php b/other/Schema/v2_1/Moderators.php new file mode 100644 index 0000000000..0f2e924af3 --- /dev/null +++ b/other/Schema/v2_1/Moderators.php @@ -0,0 +1,76 @@ +name = 'moderators'; + + $this->columns = [ + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_board', + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PackageServers.php b/other/Schema/v2_1/PackageServers.php new file mode 100644 index 0000000000..76e0c8106a --- /dev/null +++ b/other/Schema/v2_1/PackageServers.php @@ -0,0 +1,105 @@ + 'Simple Machines Third-party Mod Site', + 'url' => 'https://custom.simplemachines.org/packages/mods', + 'validation_url' => 'https://custom.simplemachines.org/api.php?action=validate;version=v1;smf_version={SMF_VERSION}', + ], + [ + 'name' => 'Simple Machines Downloads Site', + 'url' => 'https://download.simplemachines.org/browse.php?api=v1;smf_version={SMF_VERSION}', + 'validation_url' => 'https://download.simplemachines.org/validate.php?api=v1;smf_version={SMF_VERSION}', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'package_servers'; + + $this->columns = [ + new Column( + name: 'id_server', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'validation_url', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'extra', + type: 'text', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_server', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PermissionProfiles.php b/other/Schema/v2_1/PermissionProfiles.php new file mode 100644 index 0000000000..38bd3eaf77 --- /dev/null +++ b/other/Schema/v2_1/PermissionProfiles.php @@ -0,0 +1,92 @@ + 1, + 'profile_name' => 'default', + ], + [ + 'id_profile' => 2, + 'profile_name' => 'no_polls', + ], + [ + 'id_profile' => 3, + 'profile_name' => 'reply_only', + ], + [ + 'id_profile' => 4, + 'profile_name' => 'read_only', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'permission_profiles'; + + $this->columns = [ + new Column( + name: 'id_profile', + type: 'smallint', + auto: true, + ), + new Column( + name: 'profile_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_profile', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Permissions.php b/other/Schema/v2_1/Permissions.php new file mode 100644 index 0000000000..f183fda6fc --- /dev/null +++ b/other/Schema/v2_1/Permissions.php @@ -0,0 +1,286 @@ + -1, + 'permission' => 'search_posts', + ], + [ + 'id_group' => -1, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => -1, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 0, + 'permission' => 'view_mlist', + ], + [ + 'id_group' => 0, + 'permission' => 'search_posts', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_view', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_read', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_send', + ], + [ + 'id_group' => 0, + 'permission' => 'pm_draft', + ], + [ + 'id_group' => 0, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => 0, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 0, + 'permission' => 'who_view', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_identity_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_password_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_blurb_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_displayed_name_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_signature_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_website_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_forum_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_extra_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_remove_own', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_server_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_upload_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'profile_remote_avatar', + ], + [ + 'id_group' => 0, + 'permission' => 'send_email_to_members', + ], + [ + 'id_group' => 2, + 'permission' => 'view_mlist', + ], + [ + 'id_group' => 2, + 'permission' => 'search_posts', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_view', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_read', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_send', + ], + [ + 'id_group' => 2, + 'permission' => 'pm_draft', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_view', + ], + [ + 'id_group' => 2, + 'permission' => 'view_stats', + ], + [ + 'id_group' => 2, + 'permission' => 'who_view', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_identity_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_password_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_blurb_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_displayed_name_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_signature_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_website_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_forum_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_extra_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_remove_own', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_server_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_upload_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_remote_avatar', + ], + [ + 'id_group' => 2, + 'permission' => 'send_email_to_members', + ], + [ + 'id_group' => 2, + 'permission' => 'profile_title_own', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_post', + ], + [ + 'id_group' => 2, + 'permission' => 'calendar_edit_any', + ], + [ + 'id_group' => 2, + 'permission' => 'access_mod_center', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'permissions'; + + $this->columns = [ + new Column( + name: 'id_group', + type: 'smallint', + default: 0, + ), + new Column( + name: 'permission', + type: 'varchar', + size: 30, + default: '', + ), + new Column( + name: 'add_deny', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_group', + 'permission', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PersonalMessages.php b/other/Schema/v2_1/PersonalMessages.php new file mode 100644 index 0000000000..3ee0feb9cf --- /dev/null +++ b/other/Schema/v2_1/PersonalMessages.php @@ -0,0 +1,135 @@ +name = 'personal_messages'; + + $this->columns = [ + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_pm_head', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_from', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'deleted_by_sender', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'from_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'msgtime', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'body', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_pm', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member_from', + 'deleted_by_sender', + ], + ), + new Index( + name: 'idx_msgtime', + columns: [ + 'msgtime', + ], + ), + new Index( + name: 'idx_id_pm_head', + columns: [ + 'id_pm_head', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PmLabeledMessages.php b/other/Schema/v2_1/PmLabeledMessages.php new file mode 100644 index 0000000000..a8e7a51be3 --- /dev/null +++ b/other/Schema/v2_1/PmLabeledMessages.php @@ -0,0 +1,76 @@ +name = 'pm_labeled_messages'; + + $this->columns = [ + new Column( + name: 'id_label', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_label', + 'id_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PmLabels.php b/other/Schema/v2_1/PmLabels.php new file mode 100644 index 0000000000..c8d6da261b --- /dev/null +++ b/other/Schema/v2_1/PmLabels.php @@ -0,0 +1,83 @@ +name = 'pm_labels'; + + $this->columns = [ + new Column( + name: 'id_label', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'name', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_label', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PmRecipients.php b/other/Schema/v2_1/PmRecipients.php new file mode 100644 index 0000000000..63f456f85a --- /dev/null +++ b/other/Schema/v2_1/PmRecipients.php @@ -0,0 +1,119 @@ +name = 'pm_recipients'; + + $this->columns = [ + new Column( + name: 'id_pm', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'bcc', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_read', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_new', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'deleted', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'in_inbox', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_pm', + 'id_member', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'deleted', + 'id_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PmRules.php b/other/Schema/v2_1/PmRules.php new file mode 100644 index 0000000000..1833399b49 --- /dev/null +++ b/other/Schema/v2_1/PmRules.php @@ -0,0 +1,118 @@ +name = 'pm_rules'; + + $this->columns = [ + new Column( + name: 'id_rule', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'rule_name', + type: 'varchar', + size: 60, + not_null: true, + ), + new Column( + name: 'criteria', + type: 'text', + not_null: true, + ), + new Column( + name: 'actions', + type: 'text', + not_null: true, + ), + new Column( + name: 'delete_pm', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'is_or', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_rule', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_delete_pm', + columns: [ + 'delete_pm', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/PollChoices.php b/other/Schema/v2_1/PollChoices.php new file mode 100644 index 0000000000..681a21d0ae --- /dev/null +++ b/other/Schema/v2_1/PollChoices.php @@ -0,0 +1,90 @@ +name = 'poll_choices'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'id_choice', + type: 'tinyint', + unsigned: true, + default: 0, + ), + new Column( + name: 'label', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'votes', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_poll', + 'id_choice', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Polls.php b/other/Schema/v2_1/Polls.php new file mode 100644 index 0000000000..4547d338c3 --- /dev/null +++ b/other/Schema/v2_1/Polls.php @@ -0,0 +1,145 @@ +name = 'polls'; + + $this->columns = [ + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'voting_locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'max_votes', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 1, + ), + new Column( + name: 'expire_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hide_results', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'change_vote', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'guest_vote', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_guest_voters', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'reset_poll', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'poster_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_poll', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Qanda.php b/other/Schema/v2_1/Qanda.php new file mode 100644 index 0000000000..22d89cb9ce --- /dev/null +++ b/other/Schema/v2_1/Qanda.php @@ -0,0 +1,94 @@ +name = 'qanda'; + + $this->columns = [ + new Column( + name: 'id_question', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'lngfile', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'question', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'answers', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_question', + ], + ), + new Index( + name: 'idx_lngfile', + columns: [ + 'lngfile', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/ScheduledTasks.php b/other/Schema/v2_1/ScheduledTasks.php new file mode 100644 index 0000000000..a57c56b258 --- /dev/null +++ b/other/Schema/v2_1/ScheduledTasks.php @@ -0,0 +1,243 @@ + 3, + 'next_time' => 0, + 'time_offset' => 60, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'daily_maintenance', + 'callable' => '', + ], + [ + 'id_task' => 5, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'daily_digest', + 'callable' => '', + ], + [ + 'id_task' => 6, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 0, + 'task' => 'weekly_digest', + 'callable' => '', + ], + [ + 'id_task' => 7, + 'next_time' => 0, + 'time_offset' => '{$sched_task_offset}', + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'fetchSMfiles', + 'callable' => '', + ], + [ + 'id_task' => 8, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 1, + 'task' => 'birthdayemails', + 'callable' => '', + ], + [ + 'id_task' => 9, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 0, + 'task' => 'weekly_maintenance', + 'callable' => '', + ], + [ + 'id_task' => 10, + 'next_time' => 0, + 'time_offset' => 120, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 1, + 'task' => 'paid_subscriptions', + 'callable' => '', + ], + [ + 'id_task' => 11, + 'next_time' => 0, + 'time_offset' => 120, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_temp_attachments', + 'callable' => '', + ], + [ + 'id_task' => 12, + 'next_time' => 0, + 'time_offset' => 180, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_topic_redirect', + 'callable' => '', + ], + [ + 'id_task' => 13, + 'next_time' => 0, + 'time_offset' => 240, + 'time_regularity' => 1, + 'time_unit' => 'd', + 'disabled' => 0, + 'task' => 'remove_old_drafts', + 'callable' => '', + ], + [ + 'id_task' => 14, + 'next_time' => 0, + 'time_offset' => 0, + 'time_regularity' => 1, + 'time_unit' => 'w', + 'disabled' => 1, + 'task' => 'prune_log_topics', + 'callable' => '', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'scheduled_tasks'; + + $this->columns = [ + new Column( + name: 'id_task', + type: 'smallint', + auto: true, + ), + new Column( + name: 'next_time', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_offset', + type: 'int', + not_null: true, + default: 0, + ), + new Column( + name: 'time_regularity', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'time_unit', + type: 'varchar', + size: 1, + not_null: true, + default: 'h', + ), + new Column( + name: 'disabled', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'task', + type: 'varchar', + size: 24, + not_null: true, + default: '', + ), + new Column( + name: 'callable', + type: 'varchar', + size: 60, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_task', + ], + ), + new Index( + name: 'idx_next_time', + columns: [ + 'next_time', + ], + ), + new Index( + name: 'idx_disabled', + columns: [ + 'disabled', + ], + ), + new Index( + name: 'idx_task', + type: 'unique', + columns: [ + 'task', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Sessions.php b/other/Schema/v2_1/Sessions.php new file mode 100644 index 0000000000..9ad547e79e --- /dev/null +++ b/other/Schema/v2_1/Sessions.php @@ -0,0 +1,82 @@ +name = 'sessions'; + + $this->columns = [ + new Column( + name: 'session_id', + type: 'varchar', + size: 128, + not_null: true, + default: '', + ), + new Column( + name: 'last_update', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'data', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'session_id', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/SmileyFiles.php b/other/Schema/v2_1/SmileyFiles.php new file mode 100644 index 0000000000..bd6fb06609 --- /dev/null +++ b/other/Schema/v2_1/SmileyFiles.php @@ -0,0 +1,84 @@ +name = 'smiley_files'; + + $this->columns = [ + new Column( + name: 'id_smiley', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'smiley_set', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + new Column( + name: 'filename', + type: 'varchar', + size: 48, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_smiley', + 'smiley_set', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Smileys.php b/other/Schema/v2_1/Smileys.php new file mode 100644 index 0000000000..a9e6b31b11 --- /dev/null +++ b/other/Schema/v2_1/Smileys.php @@ -0,0 +1,104 @@ +name = 'smileys'; + + $this->columns = [ + new Column( + name: 'id_smiley', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'code', + type: 'varchar', + size: 30, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'varchar', + size: 80, + not_null: true, + default: '', + ), + new Column( + name: 'smiley_row', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'smiley_order', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'hidden', + type: 'tinyint', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_smiley', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Spiders.php b/other/Schema/v2_1/Spiders.php new file mode 100644 index 0000000000..d87dcdbf6c --- /dev/null +++ b/other/Schema/v2_1/Spiders.php @@ -0,0 +1,191 @@ + 'Google', + 'user_agent' => 'googlebot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo!', + 'user_agent' => 'slurp', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing', + 'user_agent' => 'bingbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Mobile)', + 'user_agent' => 'Googlebot-Mobile', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Image)', + 'user_agent' => 'Googlebot-Image', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (AdSense)', + 'user_agent' => 'Mediapartners-Google', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Google (Adwords)', + 'user_agent' => 'AdsBot-Google', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo! (Mobile)', + 'user_agent' => 'YahooSeeker/M1A1-R2D2', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yahoo! (Image)', + 'user_agent' => 'Yahoo-MMCrawler', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Preview)', + 'user_agent' => 'BingPreview', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Ads)', + 'user_agent' => 'adidxbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (MSNBot)', + 'user_agent' => 'msnbot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Bing (Media)', + 'user_agent' => 'msnbot-media', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Cuil', + 'user_agent' => 'twiceler', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Ask', + 'user_agent' => 'Teoma', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Baidu', + 'user_agent' => 'Baiduspider', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Gigablast', + 'user_agent' => 'Gigabot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'InternetArchive', + 'user_agent' => 'ia_archiver-web.archive.org', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Alexa', + 'user_agent' => 'ia_archiver', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Omgili', + 'user_agent' => 'omgilibot', + 'ip_info' => '', + ], + [ + 'spider_name' => 'EntireWeb', + 'user_agent' => 'Speedy Spider', + 'ip_info' => '', + ], + [ + 'spider_name' => 'Yandex', + 'user_agent' => 'yandex', + 'ip_info' => '', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'spiders'; + + $this->columns = [ + new Column( + name: 'id_spider', + type: 'smallint', + unsigned: true, + auto: true, + ), + new Column( + name: 'spider_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'user_agent', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'ip_info', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Subscriptions.php b/other/Schema/v2_1/Subscriptions.php new file mode 100644 index 0000000000..555825fe87 --- /dev/null +++ b/other/Schema/v2_1/Subscriptions.php @@ -0,0 +1,143 @@ +name = 'subscriptions'; + + $this->columns = [ + new Column( + name: 'id_subscribe', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'name', + type: 'varchar', + size: 60, + not_null: true, + default: '', + ), + new Column( + name: 'description', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'cost', + type: 'text', + not_null: true, + ), + new Column( + name: 'length', + type: 'varchar', + size: 6, + not_null: true, + default: '', + ), + new Column( + name: 'id_group', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'add_groups', + type: 'varchar', + size: 40, + not_null: true, + default: '', + ), + new Column( + name: 'active', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'repeatable', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'allow_partial', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'reminder', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'email_complete', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_subscribe', + ], + ), + new Index( + name: 'idx_active', + columns: [ + 'active', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Themes.php b/other/Schema/v2_1/Themes.php new file mode 100644 index 0000000000..77ece018f7 --- /dev/null +++ b/other/Schema/v2_1/Themes.php @@ -0,0 +1,149 @@ + 1, + 'variable' => 'name', + 'value' => '{$default_theme_name}', + ], + [ + 'id_theme' => 1, + 'variable' => 'theme_url', + 'value' => '{$boardurl}/Themes/default', + ], + [ + 'id_theme' => 1, + 'variable' => 'images_url', + 'value' => '{$boardurl}/Themes/default/images', + ], + [ + 'id_theme' => 1, + 'variable' => 'theme_dir', + 'value' => '{$boarddir}/Themes/default', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_latest_member', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_newsfader', + 'value' => '0', + ], + [ + 'id_theme' => 1, + 'variable' => 'number_recent_posts', + 'value' => '0', + ], + [ + 'id_theme' => 1, + 'variable' => 'show_stats_index', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'newsfader_time', + 'value' => '3000', + ], + [ + 'id_theme' => 1, + 'variable' => 'use_image_buttons', + 'value' => '1', + ], + [ + 'id_theme' => 1, + 'variable' => 'enable_news', + 'value' => '1', + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'themes'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + default: 0, + ), + new Column( + name: 'id_theme', + type: 'tinyint', + unsigned: true, + default: 1, + ), + new Column( + name: 'variable', + type: 'varchar', + size: 255, + default: '', + ), + new Column( + name: 'value', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_theme', + 'id_member', + 'variable(30)', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/Topics.php b/other/Schema/v2_1/Topics.php new file mode 100644 index 0000000000..e3c8218cb0 --- /dev/null +++ b/other/Schema/v2_1/Topics.php @@ -0,0 +1,242 @@ + 1, + 'id_board' => 1, + 'id_first_msg' => 1, + 'id_last_msg' => 1, + 'id_member_started' => 0, + 'id_member_updated' => 0, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'topics'; + + $this->columns = [ + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + auto: true, + ), + new Column( + name: 'is_sticky', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_first_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_last_msg', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_started', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_updated', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_poll', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_previous_board', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'id_previous_topic', + type: 'mediumint', + not_null: true, + default: 0, + ), + new Column( + name: 'num_replies', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'num_views', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'redirect_expires', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_redirect_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'unapproved_posts', + type: 'smallint', + not_null: true, + default: 0, + ), + new Column( + name: 'approved', + type: 'tinyint', + not_null: true, + default: 1, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_topic', + ], + ), + new Index( + name: 'idx_last_message', + type: 'unique', + columns: [ + 'id_last_msg', + 'id_board', + ], + ), + new Index( + name: 'idx_first_message', + type: 'unique', + columns: [ + 'id_first_msg', + 'id_board', + ], + ), + new Index( + name: 'idx_poll', + type: 'unique', + columns: [ + 'id_poll', + 'id_topic', + ], + ), + new Index( + name: 'idx_is_sticky', + columns: [ + 'is_sticky', + ], + ), + new Index( + name: 'idx_approved', + columns: [ + 'approved', + ], + ), + new Index( + name: 'idx_member_started', + columns: [ + 'id_member_started', + 'id_board', + ], + ), + new Index( + name: 'idx_last_message_sticky', + columns: [ + 'id_board', + 'is_sticky', + 'id_last_msg', + ], + ), + new Index( + name: 'idx_board_news', + columns: [ + 'id_board', + 'id_first_msg', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/UserAlerts.php b/other/Schema/v2_1/UserAlerts.php new file mode 100644 index 0000000000..b2bfceed43 --- /dev/null +++ b/other/Schema/v2_1/UserAlerts.php @@ -0,0 +1,142 @@ +name = 'user_alerts'; + + $this->columns = [ + new Column( + name: 'id_alert', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'alert_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member_started', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'member_name', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'content_type', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'content_id', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'content_action', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'is_read', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'extra', + type: 'text', + not_null: true, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_alert', + ], + ), + new Index( + name: 'idx_id_member', + columns: [ + 'id_member', + ], + ), + new Index( + name: 'idx_alert_time', + columns: [ + 'alert_time', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/UserAlertsPrefs.php b/other/Schema/v2_1/UserAlertsPrefs.php new file mode 100644 index 0000000000..8695260224 --- /dev/null +++ b/other/Schema/v2_1/UserAlertsPrefs.php @@ -0,0 +1,228 @@ + 0, + 'alert_pref' => 'alert_timeout', + 'alert_value' => 10, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'announcements', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'birthday', + 'alert_value' => 2, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'board_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'buddy_request', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'groupr_approved', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'groupr_rejected', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_group_request', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_register', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_report', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'member_report_reply', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_auto_notify', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_like', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_mention', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_notify_pref', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_notify_type', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_quote', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_receive_body', + 'alert_value' => 0, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_report', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'msg_report_reply', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_new', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'pm_reply', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'request_group', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'topic_notify', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_attachment', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_reply', + 'alert_value' => 3, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'unapproved_post', + 'alert_value' => 1, + ], + [ + 'id_member' => 0, + 'alert_pref' => 'warn_any', + 'alert_value' => 1, + ], + ]; + + /**************** + * Public methods + ****************/ + + /** + * Constructor. + */ + public function __construct() + { + $this->name = 'user_alerts_prefs'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'alert_pref', + type: 'varchar', + size: 32, + default: '', + ), + new Column( + name: 'alert_value', + type: 'tinyint', + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_member', + 'alert_pref', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/UserDrafts.php b/other/Schema/v2_1/UserDrafts.php new file mode 100644 index 0000000000..d92ee23f25 --- /dev/null +++ b/other/Schema/v2_1/UserDrafts.php @@ -0,0 +1,163 @@ +name = 'user_drafts'; + + $this->columns = [ + new Column( + name: 'id_draft', + type: 'int', + unsigned: true, + auto: true, + ), + new Column( + name: 'id_topic', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_board', + type: 'smallint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_reply', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'type', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'poster_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + not_null: true, + default: 0, + ), + new Column( + name: 'subject', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + new Column( + name: 'smileys_enabled', + type: 'tinyint', + not_null: true, + default: 1, + ), + new Column( + name: 'body', + type: 'mediumtext', + not_null: true, + ), + new Column( + name: 'icon', + type: 'varchar', + size: 16, + not_null: true, + default: 'xx', + ), + new Column( + name: 'locked', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'is_sticky', + type: 'tinyint', + not_null: true, + default: 0, + ), + new Column( + name: 'to_list', + type: 'varchar', + size: 255, + not_null: true, + default: '', + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_draft', + ], + ), + new Index( + name: 'idx_id_member', + type: 'unique', + columns: [ + 'id_member', + 'id_draft', + 'type', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/UserLikes.php b/other/Schema/v2_1/UserLikes.php new file mode 100644 index 0000000000..1257485ffd --- /dev/null +++ b/other/Schema/v2_1/UserLikes.php @@ -0,0 +1,103 @@ +name = 'user_likes'; + + $this->columns = [ + new Column( + name: 'id_member', + type: 'mediumint', + unsigned: true, + default: 0, + ), + new Column( + name: 'content_type', + type: 'char', + size: 6, + default: '', + ), + new Column( + name: 'content_id', + type: 'int', + unsigned: true, + default: 0, + ), + new Column( + name: 'like_time', + type: 'int', + unsigned: true, + not_null: true, + default: 0, + ), + ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'content_id', + 'content_type', + 'id_member', + ], + ), + new Index( + name: 'content', + columns: [ + 'content_id', + 'content_type', + ], + ), + new Index( + name: 'liker', + columns: [ + 'id_member', + ], + ), + ]; + } +} + +?> \ No newline at end of file diff --git a/other/Schema/v2_1/index.php b/other/Schema/v2_1/index.php new file mode 100644 index 0000000000..976d292448 --- /dev/null +++ b/other/Schema/v2_1/index.php @@ -0,0 +1,9 @@ + \ No newline at end of file From 3c6a5b9eccd7d33d7f4e26ecec94eedd61560c4d Mon Sep 17 00:00:00 2001 From: jdarwood007 Date: Thu, 8 Feb 2024 17:34:37 -0800 Subject: [PATCH 003/102] Initial replacement of installer logic --- Sources/Db/APIs/MySQL.php | 20 +- Sources/Db/APIs/PostgreSQL.php | 4 +- Sources/Db/DatabaseApi.php | 5 + Sources/Db/Schema/Table.php | 24 +- Sources/Db/Schema/v3_0/AdminInfoFiles.php | 14 + Sources/Db/Schema/v3_0/ApprovalQueue.php | 7 + Sources/Db/Schema/v3_0/Attachments.php | 7 + Sources/Db/Schema/v3_0/BackgroundTasks.php | 7 + Sources/Db/Schema/v3_0/BanGroups.php | 7 + Sources/Db/Schema/v3_0/BanItems.php | 7 + Sources/Db/Schema/v3_0/BoardPermissions.php | 11 + .../Db/Schema/v3_0/BoardPermissionsView.php | 11 + Sources/Db/Schema/v3_0/Boards.php | 18 + Sources/Db/Schema/v3_0/Calendar.php | 7 + Sources/Db/Schema/v3_0/CalendarHolidays.php | 10 + Sources/Db/Schema/v3_0/Categories.php | 13 + Sources/Db/Schema/v3_0/CustomFields.php | 27 + Sources/Db/Schema/v3_0/GroupModerators.php | 7 + Sources/Db/Schema/v3_0/LogActions.php | 7 + Sources/Db/Schema/v3_0/LogActivity.php | 7 + Sources/Db/Schema/v3_0/LogBanned.php | 7 + Sources/Db/Schema/v3_0/LogBoards.php | 7 + Sources/Db/Schema/v3_0/LogComments.php | 7 + Sources/Db/Schema/v3_0/LogDigest.php | 7 + Sources/Db/Schema/v3_0/LogErrors.php | 7 + Sources/Db/Schema/v3_0/LogFloodcontrol.php | 22 +- Sources/Db/Schema/v3_0/LogMarkRead.php | 7 + Sources/Db/Schema/v3_0/LogMemberNotices.php | 7 + Sources/Db/Schema/v3_0/LogNotify.php | 7 + Sources/Db/Schema/v3_0/LogOnline.php | 19 +- Sources/Db/Schema/v3_0/LogPolls.php | 7 + Sources/Db/Schema/v3_0/LogReported.php | 7 + .../Db/Schema/v3_0/LogReportedComments.php | 7 + Sources/Db/Schema/v3_0/LogScheduledTasks.php | 7 + Sources/Db/Schema/v3_0/LogSearchMessages.php | 7 + Sources/Db/Schema/v3_0/LogSearchResults.php | 7 + Sources/Db/Schema/v3_0/LogSearchSubjects.php | 7 + Sources/Db/Schema/v3_0/LogSearchTopics.php | 7 + Sources/Db/Schema/v3_0/LogSpiderHits.php | 7 + Sources/Db/Schema/v3_0/LogSpiderStats.php | 7 + Sources/Db/Schema/v3_0/LogSubscribed.php | 7 + Sources/Db/Schema/v3_0/LogTopics.php | 7 + Sources/Db/Schema/v3_0/MailQueue.php | 7 + Sources/Db/Schema/v3_0/MemberLogins.php | 7 + Sources/Db/Schema/v3_0/Membergroups.php | 15 + Sources/Db/Schema/v3_0/Members.php | 9 + Sources/Db/Schema/v3_0/Mentions.php | 7 + Sources/Db/Schema/v3_0/MessageIcons.php | 37 +- Sources/Db/Schema/v3_0/Messages.php | 19 + Sources/Db/Schema/v3_0/ModeratorGroups.php | 7 + Sources/Db/Schema/v3_0/Moderators.php | 7 + Sources/Db/Schema/v3_0/PackageServers.php | 11 + Sources/Db/Schema/v3_0/PermissionProfiles.php | 10 + Sources/Db/Schema/v3_0/Permissions.php | 10 + Sources/Db/Schema/v3_0/PersonalMessages.php | 7 + Sources/Db/Schema/v3_0/PmLabeledMessages.php | 7 + Sources/Db/Schema/v3_0/PmLabels.php | 7 + Sources/Db/Schema/v3_0/PmRecipients.php | 7 + Sources/Db/Schema/v3_0/PmRules.php | 7 + Sources/Db/Schema/v3_0/PollChoices.php | 7 + Sources/Db/Schema/v3_0/Polls.php | 7 + Sources/Db/Schema/v3_0/Qanda.php | 7 + Sources/Db/Schema/v3_0/ScheduledTasks.php | 16 + Sources/Db/Schema/v3_0/Sessions.php | 7 + Sources/Db/Schema/v3_0/Settings.php | 10 + Sources/Db/Schema/v3_0/SmileyFiles.php | 7 + Sources/Db/Schema/v3_0/Smileys.php | 7 + Sources/Db/Schema/v3_0/Spiders.php | 21 + Sources/Db/Schema/v3_0/Subscriptions.php | 7 + Sources/Db/Schema/v3_0/Themes.php | 11 + Sources/Db/Schema/v3_0/Topics.php | 14 + Sources/Db/Schema/v3_0/UserAlerts.php | 7 + Sources/Db/Schema/v3_0/UserAlertsPrefs.php | 11 + Sources/Db/Schema/v3_0/UserDrafts.php | 7 + Sources/Db/Schema/v3_0/UserLikes.php | 7 + Sources/ErrorHandler.php | 18 +- Sources/Maintenance.php | 228 ++ Sources/Maintenance/Database/MySQL.php | 114 + Sources/Maintenance/Database/PostgreSQL.php | 136 + Sources/Maintenance/DatabaseInterface.php | 48 + .../Maintenance/Schema/admin_info_files.php | 77 + Sources/Maintenance/SchemaBase.php | 119 + Sources/Maintenance/SchemaColumn.php | 83 + Sources/Maintenance/SchemaIndex.php | 56 + Sources/Maintenance/SchemaIndexColumn.php | 40 + Sources/Maintenance/SchemaInterface.php | 35 + Sources/Maintenance/Step.php | 55 + Sources/Maintenance/Template.php | 176 + Sources/Maintenance/Template/Install.php | 473 +++ Sources/Maintenance/TemplateInterface.php | 21 + Sources/Maintenance/Tools/Install.php | 1568 +++++++++ Sources/Maintenance/ToolsBase.php | 137 + Sources/Maintenance/ToolsInterface.php | 31 + other/install.php | 2573 +-------------- other/install_3-0_MySQL.sql | 2300 ------------- other/install_3-0_PostgreSQL.sql | 2852 ----------------- 96 files changed, 4173 insertions(+), 7702 deletions(-) create mode 100644 Sources/Maintenance.php create mode 100644 Sources/Maintenance/Database/MySQL.php create mode 100644 Sources/Maintenance/Database/PostgreSQL.php create mode 100644 Sources/Maintenance/DatabaseInterface.php create mode 100644 Sources/Maintenance/Schema/admin_info_files.php create mode 100644 Sources/Maintenance/SchemaBase.php create mode 100644 Sources/Maintenance/SchemaColumn.php create mode 100644 Sources/Maintenance/SchemaIndex.php create mode 100644 Sources/Maintenance/SchemaIndexColumn.php create mode 100644 Sources/Maintenance/SchemaInterface.php create mode 100644 Sources/Maintenance/Step.php create mode 100644 Sources/Maintenance/Template.php create mode 100644 Sources/Maintenance/Template/Install.php create mode 100644 Sources/Maintenance/TemplateInterface.php create mode 100644 Sources/Maintenance/Tools/Install.php create mode 100644 Sources/Maintenance/ToolsBase.php create mode 100644 Sources/Maintenance/ToolsInterface.php delete mode 100644 other/install_3-0_MySQL.sql delete mode 100644 other/install_3-0_PostgreSQL.sql diff --git a/Sources/Db/APIs/MySQL.php b/Sources/Db/APIs/MySQL.php index 4be006635e..8db1a0f530 100644 --- a/Sources/Db/APIs/MySQL.php +++ b/Sources/Db/APIs/MySQL.php @@ -1348,12 +1348,10 @@ public function calculate_type(string $type_name, ?int $type_size = null, bool $ if (!$reverse) { $types = [ 'inet' => 'varbinary', - 'uuid' => 'binary', ]; } else { $types = [ 'varbinary' => 'inet', - 'binary' => 'uuid', ]; } @@ -1362,19 +1360,11 @@ public function calculate_type(string $type_name, ?int $type_size = null, bool $ if ($type_name == 'inet' && !$reverse) { $type_size = 16; $type_name = 'varbinary'; - } elseif ($type_name == 'uuid' && !$reverse) { - $type_size = 16; - $type_name = 'binary'; } elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) { $type_name = 'inet'; $type_size = null; - } elseif ($type_name == 'binary' && $reverse && $type_size == 16) { - $type_name = 'uuid'; - $type_size = null; } elseif ($type_name == 'varbinary') { $type_name = 'varbinary'; - } elseif ($type_name == 'binary') { - $type_name = 'binary'; } else { $type_name = $types[$type_name]; } @@ -1521,7 +1511,7 @@ public function create_table(string $table_name, array $columns, array $indexes $short_table_name = str_replace('{db_prefix}', $this->prefix, $table_name); // First - no way do we touch SMF tables. - if (in_array(strtolower($short_table_name), $this->reservedTables)) { + if (!defined('SMF_INSTALLING') && in_array(strtolower($short_table_name), $this->reservedTables)) { return false; } @@ -1631,7 +1621,7 @@ public function create_table(string $table_name, array $columns, array $indexes } // Create the table! - $this->query( + $result = $this->query( '', $table_query, [ @@ -1639,6 +1629,8 @@ public function create_table(string $table_name, array $columns, array $indexes ], ); + return $result; + // Fill the old data if ($old_table_exists) { $same_col = []; @@ -1692,7 +1684,7 @@ public function drop_table(string $table_name, array $parameters = [], string $e $short_table_name = str_replace('{db_prefix}', $this->prefix, $table_name); // God no - dropping one of these = bad. - if (in_array(strtolower($short_table_name), $this->reservedTables)) { + if (!defined('SMF_INSTALLING') && in_array(strtolower($short_table_name), $this->reservedTables)) { return false; } @@ -2378,7 +2370,7 @@ protected function create_query_column(array $column): string // Sort out the size... and stuff... $column['size'] = isset($column['size']) && is_numeric($column['size']) ? $column['size'] : null; - list($type, $size) = $this->calculate_type($column['type'], (int) $column['size']); + list($type, $size) = $this->calculate_type($column['type'], $column['size'] === null ? null : (int) $column['size']); // Allow unsigned integers (mysql only) $unsigned = in_array($type, ['int', 'tinyint', 'smallint', 'mediumint', 'bigint']) && !empty($column['unsigned']) ? 'unsigned ' : ''; diff --git a/Sources/Db/APIs/PostgreSQL.php b/Sources/Db/APIs/PostgreSQL.php index 0026e2379d..385e989ea5 100644 --- a/Sources/Db/APIs/PostgreSQL.php +++ b/Sources/Db/APIs/PostgreSQL.php @@ -1619,7 +1619,7 @@ public function create_table(string $table_name, array $columns, array $indexes $short_table_name = str_replace('{db_prefix}', $this->prefix, $table_name); // First - no way do we touch SMF tables. - if (in_array(strtolower($short_table_name), $this->reservedTables)) { + if (!defined('SMF_INSTALLING') && in_array(strtolower($short_table_name), $this->reservedTables)) { return false; } @@ -1811,7 +1811,7 @@ public function drop_table(string $table_name, array $parameters = [], string $e $short_table_name = str_replace('{db_prefix}', $this->prefix, $table_name); // God no - dropping one of these = bad. - if (in_array(strtolower($table_name), $this->reservedTables)) { + if (!defined('SMF_INSTALLING') && in_array(strtolower($table_name), $this->reservedTables)) { return false; } diff --git a/Sources/Db/DatabaseApi.php b/Sources/Db/DatabaseApi.php index e4a22bf95a..da554247aa 100644 --- a/Sources/Db/DatabaseApi.php +++ b/Sources/Db/DatabaseApi.php @@ -438,6 +438,11 @@ protected function __construct() */ protected function prefixReservedTables(): void { + if (defined('SMF_INSTALLING')) { + $this->reservedTables = []; + return; + } + // Reset $reservedTables to default. $class_vars = get_class_vars(__CLASS__); $this->reservedTables = $class_vars['reservedTables']; diff --git a/Sources/Db/Schema/Table.php b/Sources/Db/Schema/Table.php index 8e1510e5c7..2bbf69810d 100644 --- a/Sources/Db/Schema/Table.php +++ b/Sources/Db/Schema/Table.php @@ -34,18 +34,32 @@ abstract class Table public string $name; /** - * @var string + * @var \SMF\Db\Schema\Column[] * * An array of SMF\Db\Schema\Column objects. */ public array $columns; /** - * @var string + * @var \SMF\Db\Schema\Index[] * * An array of SMF\Db\Schema\Index objects. */ - public array $indices; + public array $indices = []; + + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + + /** + * @var array + * + * Data used to populate the table during install. + */ + public array $initial_data = []; /** * @var string @@ -87,6 +101,10 @@ abstract class Table */ public function create(array $parameters = [], string $if_exists = 'ignore'): bool { + if (!isset($this->columns) || count($this->columns) === 0) { + return false; + } + return Db::$db->create_table( $this->name, array_map('get_object_vars', $this->columns), diff --git a/Sources/Db/Schema/v3_0/AdminInfoFiles.php b/Sources/Db/Schema/v3_0/AdminInfoFiles.php index 94cd2f104b..bfdf868969 100644 --- a/Sources/Db/Schema/v3_0/AdminInfoFiles.php +++ b/Sources/Db/Schema/v3_0/AdminInfoFiles.php @@ -28,6 +28,20 @@ class AdminInfoFiles extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_file' => 'int', + 'filename' => 'string', + 'path' => 'string', + 'parameters' => 'string', + 'data' => 'string', + 'filetype' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/ApprovalQueue.php b/Sources/Db/Schema/v3_0/ApprovalQueue.php index 7cbc20fa2c..000e5ee683 100644 --- a/Sources/Db/Schema/v3_0/ApprovalQueue.php +++ b/Sources/Db/Schema/v3_0/ApprovalQueue.php @@ -27,6 +27,13 @@ class ApprovalQueue extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Attachments.php b/Sources/Db/Schema/v3_0/Attachments.php index 3560af0f9b..36c6fe6170 100644 --- a/Sources/Db/Schema/v3_0/Attachments.php +++ b/Sources/Db/Schema/v3_0/Attachments.php @@ -28,6 +28,13 @@ class Attachments extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/BackgroundTasks.php b/Sources/Db/Schema/v3_0/BackgroundTasks.php index ffb45eeabe..92487cb42d 100644 --- a/Sources/Db/Schema/v3_0/BackgroundTasks.php +++ b/Sources/Db/Schema/v3_0/BackgroundTasks.php @@ -28,6 +28,13 @@ class BackgroundTasks extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/BanGroups.php b/Sources/Db/Schema/v3_0/BanGroups.php index e4df98deca..dec02c2c91 100644 --- a/Sources/Db/Schema/v3_0/BanGroups.php +++ b/Sources/Db/Schema/v3_0/BanGroups.php @@ -28,6 +28,13 @@ class BanGroups extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/BanItems.php b/Sources/Db/Schema/v3_0/BanItems.php index 51daa7d959..000892d335 100644 --- a/Sources/Db/Schema/v3_0/BanItems.php +++ b/Sources/Db/Schema/v3_0/BanItems.php @@ -28,6 +28,13 @@ class BanItems extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/BoardPermissions.php b/Sources/Db/Schema/v3_0/BoardPermissions.php index c5d80de2c1..9e07ccb388 100644 --- a/Sources/Db/Schema/v3_0/BoardPermissions.php +++ b/Sources/Db/Schema/v3_0/BoardPermissions.php @@ -28,6 +28,17 @@ class BoardPermissions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_group' => 'int', + 'id_profile' => 'int', + 'permission' => 'string', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/BoardPermissionsView.php b/Sources/Db/Schema/v3_0/BoardPermissionsView.php index 80c615b108..a4c81f6117 100644 --- a/Sources/Db/Schema/v3_0/BoardPermissionsView.php +++ b/Sources/Db/Schema/v3_0/BoardPermissionsView.php @@ -28,6 +28,17 @@ class BoardPermissionsView extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_group' => 'int', + 'id_board' => 'int', + 'deny' => 'int', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Boards.php b/Sources/Db/Schema/v3_0/Boards.php index a62878d3aa..93610e614f 100644 --- a/Sources/Db/Schema/v3_0/Boards.php +++ b/Sources/Db/Schema/v3_0/Boards.php @@ -28,6 +28,24 @@ class Boards extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_board' => 'int', + 'id_cat' => 'int', + 'board_order' => 'int', + 'id_last_msg' => 'int', + 'id_msg_updated' => 'int', + 'name' => 'string', + 'description' => 'string', + 'num_topics' => 'int', + 'num_posts' => 'int', + 'member_groups' => 'string', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Calendar.php b/Sources/Db/Schema/v3_0/Calendar.php index eb25e1f19f..8513920742 100644 --- a/Sources/Db/Schema/v3_0/Calendar.php +++ b/Sources/Db/Schema/v3_0/Calendar.php @@ -28,6 +28,13 @@ class Calendar extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/CalendarHolidays.php b/Sources/Db/Schema/v3_0/CalendarHolidays.php index a335707280..4eb7d53b63 100644 --- a/Sources/Db/Schema/v3_0/CalendarHolidays.php +++ b/Sources/Db/Schema/v3_0/CalendarHolidays.php @@ -28,6 +28,16 @@ class CalendarHolidays extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'title' => 'string', + 'event_date' => 'date', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Categories.php b/Sources/Db/Schema/v3_0/Categories.php index 519d63d723..ceae6ab93f 100644 --- a/Sources/Db/Schema/v3_0/Categories.php +++ b/Sources/Db/Schema/v3_0/Categories.php @@ -28,6 +28,19 @@ class Categories extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_cat' => 'int', + 'cat_order' => 'int', + 'name' => 'string', + 'description' => 'string', + 'can_collapse' => 'int' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/CustomFields.php b/Sources/Db/Schema/v3_0/CustomFields.php index 46f9537178..8334324df3 100644 --- a/Sources/Db/Schema/v3_0/CustomFields.php +++ b/Sources/Db/Schema/v3_0/CustomFields.php @@ -28,6 +28,33 @@ class CustomFields extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'col_name' => 'string', + 'field_name' => 'string', + 'field_desc' => 'string', + 'field_type' => 'string', + 'field_length' => 'int', + 'field_options' => 'string', + 'field_order' => 'int', + 'mask' => 'string', + 'show_reg' => 'int', + 'show_display' => 'int', + 'show_mlist' => 'int', + 'show_profile' => 'string', + 'private' => 'int', + 'active' => 'int', + 'bbc' => 'int', + 'can_search' => 'int', + 'default_value' => 'string', + 'enclose' => ' string', + 'placement' => 'int', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/GroupModerators.php b/Sources/Db/Schema/v3_0/GroupModerators.php index 1d588e6518..b2c82fb943 100644 --- a/Sources/Db/Schema/v3_0/GroupModerators.php +++ b/Sources/Db/Schema/v3_0/GroupModerators.php @@ -28,6 +28,13 @@ class GroupModerators extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogActions.php b/Sources/Db/Schema/v3_0/LogActions.php index 022eab30b0..b71e31ccfa 100644 --- a/Sources/Db/Schema/v3_0/LogActions.php +++ b/Sources/Db/Schema/v3_0/LogActions.php @@ -28,6 +28,13 @@ class LogActions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogActivity.php b/Sources/Db/Schema/v3_0/LogActivity.php index 5868bfa16b..396e3f4a75 100644 --- a/Sources/Db/Schema/v3_0/LogActivity.php +++ b/Sources/Db/Schema/v3_0/LogActivity.php @@ -28,6 +28,13 @@ class LogActivity extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogBanned.php b/Sources/Db/Schema/v3_0/LogBanned.php index 7a321eb4d8..a325827c91 100644 --- a/Sources/Db/Schema/v3_0/LogBanned.php +++ b/Sources/Db/Schema/v3_0/LogBanned.php @@ -28,6 +28,13 @@ class LogBanned extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogBoards.php b/Sources/Db/Schema/v3_0/LogBoards.php index aadcd47cd0..232dac0421 100644 --- a/Sources/Db/Schema/v3_0/LogBoards.php +++ b/Sources/Db/Schema/v3_0/LogBoards.php @@ -28,6 +28,13 @@ class LogBoards extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogComments.php b/Sources/Db/Schema/v3_0/LogComments.php index 7e8bfb9a99..8f64df1d9f 100644 --- a/Sources/Db/Schema/v3_0/LogComments.php +++ b/Sources/Db/Schema/v3_0/LogComments.php @@ -28,6 +28,13 @@ class LogComments extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogDigest.php b/Sources/Db/Schema/v3_0/LogDigest.php index 98c50e1e31..d326b639db 100644 --- a/Sources/Db/Schema/v3_0/LogDigest.php +++ b/Sources/Db/Schema/v3_0/LogDigest.php @@ -27,6 +27,13 @@ class LogDigest extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogErrors.php b/Sources/Db/Schema/v3_0/LogErrors.php index 1aeb3ae50d..a3437a9c5d 100644 --- a/Sources/Db/Schema/v3_0/LogErrors.php +++ b/Sources/Db/Schema/v3_0/LogErrors.php @@ -28,6 +28,13 @@ class LogErrors extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogFloodcontrol.php b/Sources/Db/Schema/v3_0/LogFloodcontrol.php index e5c3e7c805..75d31b864f 100644 --- a/Sources/Db/Schema/v3_0/LogFloodcontrol.php +++ b/Sources/Db/Schema/v3_0/LogFloodcontrol.php @@ -28,6 +28,13 @@ class LogFloodcontrol extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * @@ -74,20 +81,7 @@ public function __construct() 'ip', 'log_type', ], - ), - new Index( - type: 'primary', - columns: [ - 'id_request', - ], - ), - new Index( - name: 'idx_id_member', - columns: [ - 'id_member', - 'id_group', - ], - ), + ) ]; } } diff --git a/Sources/Db/Schema/v3_0/LogMarkRead.php b/Sources/Db/Schema/v3_0/LogMarkRead.php index 0f4c9b8db5..c1163bd677 100644 --- a/Sources/Db/Schema/v3_0/LogMarkRead.php +++ b/Sources/Db/Schema/v3_0/LogMarkRead.php @@ -28,6 +28,13 @@ class LogMarkRead extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogMemberNotices.php b/Sources/Db/Schema/v3_0/LogMemberNotices.php index 4417da825c..6923e3fa09 100644 --- a/Sources/Db/Schema/v3_0/LogMemberNotices.php +++ b/Sources/Db/Schema/v3_0/LogMemberNotices.php @@ -28,6 +28,13 @@ class LogMemberNotices extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogNotify.php b/Sources/Db/Schema/v3_0/LogNotify.php index e807add2bd..3a673240c8 100644 --- a/Sources/Db/Schema/v3_0/LogNotify.php +++ b/Sources/Db/Schema/v3_0/LogNotify.php @@ -28,6 +28,13 @@ class LogNotify extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogOnline.php b/Sources/Db/Schema/v3_0/LogOnline.php index c4f5ef496e..647ba88c9b 100644 --- a/Sources/Db/Schema/v3_0/LogOnline.php +++ b/Sources/Db/Schema/v3_0/LogOnline.php @@ -28,6 +28,13 @@ class LogOnline extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * @@ -106,18 +113,6 @@ public function __construct() 'id_member', ], ), - new Index( - type: 'primary', - columns: [ - 'id_install', - ], - ), - new Index( - name: 'idx_filename', - columns: [ - 'filename(15)', - ], - ), ]; } } diff --git a/Sources/Db/Schema/v3_0/LogPolls.php b/Sources/Db/Schema/v3_0/LogPolls.php index ea02292dc3..7826262ea4 100644 --- a/Sources/Db/Schema/v3_0/LogPolls.php +++ b/Sources/Db/Schema/v3_0/LogPolls.php @@ -28,6 +28,13 @@ class LogPolls extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogReported.php b/Sources/Db/Schema/v3_0/LogReported.php index 3ef2e475fd..4438c8afe3 100644 --- a/Sources/Db/Schema/v3_0/LogReported.php +++ b/Sources/Db/Schema/v3_0/LogReported.php @@ -28,6 +28,13 @@ class LogReported extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogReportedComments.php b/Sources/Db/Schema/v3_0/LogReportedComments.php index 12d900d4fc..d9020db0dc 100644 --- a/Sources/Db/Schema/v3_0/LogReportedComments.php +++ b/Sources/Db/Schema/v3_0/LogReportedComments.php @@ -28,6 +28,13 @@ class LogReportedComments extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogScheduledTasks.php b/Sources/Db/Schema/v3_0/LogScheduledTasks.php index 3018b14dd8..1ec6e1563e 100644 --- a/Sources/Db/Schema/v3_0/LogScheduledTasks.php +++ b/Sources/Db/Schema/v3_0/LogScheduledTasks.php @@ -28,6 +28,13 @@ class LogScheduledTasks extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSearchMessages.php b/Sources/Db/Schema/v3_0/LogSearchMessages.php index 03ed956ac3..f51e1f7dec 100644 --- a/Sources/Db/Schema/v3_0/LogSearchMessages.php +++ b/Sources/Db/Schema/v3_0/LogSearchMessages.php @@ -28,6 +28,13 @@ class LogSearchMessages extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSearchResults.php b/Sources/Db/Schema/v3_0/LogSearchResults.php index 7a89114e07..b8703c5528 100644 --- a/Sources/Db/Schema/v3_0/LogSearchResults.php +++ b/Sources/Db/Schema/v3_0/LogSearchResults.php @@ -28,6 +28,13 @@ class LogSearchResults extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSearchSubjects.php b/Sources/Db/Schema/v3_0/LogSearchSubjects.php index a3381b82b7..a5013a74e4 100644 --- a/Sources/Db/Schema/v3_0/LogSearchSubjects.php +++ b/Sources/Db/Schema/v3_0/LogSearchSubjects.php @@ -28,6 +28,13 @@ class LogSearchSubjects extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSearchTopics.php b/Sources/Db/Schema/v3_0/LogSearchTopics.php index 1f1bf0a162..7332440290 100644 --- a/Sources/Db/Schema/v3_0/LogSearchTopics.php +++ b/Sources/Db/Schema/v3_0/LogSearchTopics.php @@ -28,6 +28,13 @@ class LogSearchTopics extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSpiderHits.php b/Sources/Db/Schema/v3_0/LogSpiderHits.php index 560a21b595..15f3f97967 100644 --- a/Sources/Db/Schema/v3_0/LogSpiderHits.php +++ b/Sources/Db/Schema/v3_0/LogSpiderHits.php @@ -28,6 +28,13 @@ class LogSpiderHits extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSpiderStats.php b/Sources/Db/Schema/v3_0/LogSpiderStats.php index 078062365b..9222eebd2d 100644 --- a/Sources/Db/Schema/v3_0/LogSpiderStats.php +++ b/Sources/Db/Schema/v3_0/LogSpiderStats.php @@ -28,6 +28,13 @@ class LogSpiderStats extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogSubscribed.php b/Sources/Db/Schema/v3_0/LogSubscribed.php index d6780c41a7..f556d9100e 100644 --- a/Sources/Db/Schema/v3_0/LogSubscribed.php +++ b/Sources/Db/Schema/v3_0/LogSubscribed.php @@ -28,6 +28,13 @@ class LogSubscribed extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/LogTopics.php b/Sources/Db/Schema/v3_0/LogTopics.php index 054681aae8..576eb452c6 100644 --- a/Sources/Db/Schema/v3_0/LogTopics.php +++ b/Sources/Db/Schema/v3_0/LogTopics.php @@ -28,6 +28,13 @@ class LogTopics extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/MailQueue.php b/Sources/Db/Schema/v3_0/MailQueue.php index 322a3ddf9c..64dff08400 100644 --- a/Sources/Db/Schema/v3_0/MailQueue.php +++ b/Sources/Db/Schema/v3_0/MailQueue.php @@ -28,6 +28,13 @@ class MailQueue extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/MemberLogins.php b/Sources/Db/Schema/v3_0/MemberLogins.php index b0f5d30588..9122bcc524 100644 --- a/Sources/Db/Schema/v3_0/MemberLogins.php +++ b/Sources/Db/Schema/v3_0/MemberLogins.php @@ -28,6 +28,13 @@ class MemberLogins extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Membergroups.php b/Sources/Db/Schema/v3_0/Membergroups.php index 7841a99f6f..7037a5288a 100644 --- a/Sources/Db/Schema/v3_0/Membergroups.php +++ b/Sources/Db/Schema/v3_0/Membergroups.php @@ -28,6 +28,21 @@ class Membergroups extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_group' => 'int', + 'group_name' => 'string', + 'description' => 'string', + 'online_color' => 'string', + 'min_posts' => 'int', + 'icons' => 'string', + 'group_type' => 'int', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Members.php b/Sources/Db/Schema/v3_0/Members.php index 0f66f5663a..8fc0635183 100644 --- a/Sources/Db/Schema/v3_0/Members.php +++ b/Sources/Db/Schema/v3_0/Members.php @@ -28,6 +28,13 @@ class Members extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * @@ -106,11 +113,13 @@ public function __construct() name: 'instant_messages', type: 'smallint', not_null: true, + default: 0, ), new Column( name: 'unread_messages', type: 'smallint', not_null: true, + default: 0, ), new Column( name: 'new_pm', diff --git a/Sources/Db/Schema/v3_0/Mentions.php b/Sources/Db/Schema/v3_0/Mentions.php index 915314c78d..edc4dc0cfc 100644 --- a/Sources/Db/Schema/v3_0/Mentions.php +++ b/Sources/Db/Schema/v3_0/Mentions.php @@ -28,6 +28,13 @@ class Mentions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/MessageIcons.php b/Sources/Db/Schema/v3_0/MessageIcons.php index f4b814a2b1..c4c74bd4b5 100644 --- a/Sources/Db/Schema/v3_0/MessageIcons.php +++ b/Sources/Db/Schema/v3_0/MessageIcons.php @@ -28,6 +28,17 @@ class MessageIcons extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'filename' => 'string', + 'title' => 'string', + 'icon_order' => 'int' + ]; + /** * @var array * @@ -37,67 +48,67 @@ class MessageIcons extends Table [ 'filename' => 'xx', 'title' => 'Standard', - 'icon_order' => '0', + 'icon_order' => 0, ], [ 'filename' => 'thumbup', 'title' => 'Thumb Up', - 'icon_order' => '1', + 'icon_order' => 1, ], [ 'filename' => 'thumbdown', 'title' => 'Thumb Down', - 'icon_order' => '2', + 'icon_order' => 2, ], [ 'filename' => 'exclamation', 'title' => 'Exclamation point', - 'icon_order' => '3', + 'icon_order' => 3, ], [ 'filename' => 'question', 'title' => 'Question mark', - 'icon_order' => '4', + 'icon_order' => 4, ], [ 'filename' => 'lamp', 'title' => 'Lamp', - 'icon_order' => '5', + 'icon_order' => 5, ], [ 'filename' => 'smiley', 'title' => 'Smiley', - 'icon_order' => '6', + 'icon_order' => 6, ], [ 'filename' => 'angry', 'title' => 'Angry', - 'icon_order' => '7', + 'icon_order' => 7, ], [ 'filename' => 'cheesy', 'title' => 'Cheesy', - 'icon_order' => '8', + 'icon_order' => 8, ], [ 'filename' => 'grin', 'title' => 'Grin', - 'icon_order' => '9', + 'icon_order' => 9, ], [ 'filename' => 'sad', 'title' => 'Sad', - 'icon_order' => '10', + 'icon_order' => 10, ], [ 'filename' => 'wink', 'title' => 'Wink', - 'icon_order' => '11', + 'icon_order' => 11, ], [ 'filename' => 'poll', 'title' => 'Poll', - 'icon_order' => '12', + 'icon_order' => 12, ], ]; diff --git a/Sources/Db/Schema/v3_0/Messages.php b/Sources/Db/Schema/v3_0/Messages.php index 19805d94f9..374604b41e 100644 --- a/Sources/Db/Schema/v3_0/Messages.php +++ b/Sources/Db/Schema/v3_0/Messages.php @@ -28,6 +28,25 @@ class Messages extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_msg' => 'int', + 'id_msg_modified' => 'int', + 'id_topic' => 'int', + 'id_board' => 'int', + 'poster_time' => 'int', + 'subject' => 'string', + 'poster_name' => 'string', + 'poster_email' => 'string', + 'modified_name' => 'string', + 'body' => 'string', + 'icon' => 'string', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/ModeratorGroups.php b/Sources/Db/Schema/v3_0/ModeratorGroups.php index d2df784704..0373d40eff 100644 --- a/Sources/Db/Schema/v3_0/ModeratorGroups.php +++ b/Sources/Db/Schema/v3_0/ModeratorGroups.php @@ -28,6 +28,13 @@ class ModeratorGroups extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Moderators.php b/Sources/Db/Schema/v3_0/Moderators.php index 0f2e924af3..565c47a684 100644 --- a/Sources/Db/Schema/v3_0/Moderators.php +++ b/Sources/Db/Schema/v3_0/Moderators.php @@ -28,6 +28,13 @@ class Moderators extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PackageServers.php b/Sources/Db/Schema/v3_0/PackageServers.php index 76e0c8106a..c45883365c 100644 --- a/Sources/Db/Schema/v3_0/PackageServers.php +++ b/Sources/Db/Schema/v3_0/PackageServers.php @@ -28,6 +28,17 @@ class PackageServers extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'name' => 'string', + 'url' => 'string', + 'validation_url' => 'string', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PermissionProfiles.php b/Sources/Db/Schema/v3_0/PermissionProfiles.php index 38bd3eaf77..d8a759c625 100644 --- a/Sources/Db/Schema/v3_0/PermissionProfiles.php +++ b/Sources/Db/Schema/v3_0/PermissionProfiles.php @@ -28,6 +28,16 @@ class PermissionProfiles extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_profile' => 'int', + 'profile_name' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Permissions.php b/Sources/Db/Schema/v3_0/Permissions.php index f183fda6fc..8243d044ed 100644 --- a/Sources/Db/Schema/v3_0/Permissions.php +++ b/Sources/Db/Schema/v3_0/Permissions.php @@ -28,6 +28,16 @@ class Permissions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_group' => 'int', + 'permission' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PersonalMessages.php b/Sources/Db/Schema/v3_0/PersonalMessages.php index 3ee0feb9cf..1533d4e16f 100644 --- a/Sources/Db/Schema/v3_0/PersonalMessages.php +++ b/Sources/Db/Schema/v3_0/PersonalMessages.php @@ -28,6 +28,13 @@ class PersonalMessages extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PmLabeledMessages.php b/Sources/Db/Schema/v3_0/PmLabeledMessages.php index a8e7a51be3..d9d7e82f8a 100644 --- a/Sources/Db/Schema/v3_0/PmLabeledMessages.php +++ b/Sources/Db/Schema/v3_0/PmLabeledMessages.php @@ -28,6 +28,13 @@ class PmLabeledMessages extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PmLabels.php b/Sources/Db/Schema/v3_0/PmLabels.php index c8d6da261b..7c8730bd2d 100644 --- a/Sources/Db/Schema/v3_0/PmLabels.php +++ b/Sources/Db/Schema/v3_0/PmLabels.php @@ -28,6 +28,13 @@ class PmLabels extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PmRecipients.php b/Sources/Db/Schema/v3_0/PmRecipients.php index 63f456f85a..5ea28d837d 100644 --- a/Sources/Db/Schema/v3_0/PmRecipients.php +++ b/Sources/Db/Schema/v3_0/PmRecipients.php @@ -28,6 +28,13 @@ class PmRecipients extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PmRules.php b/Sources/Db/Schema/v3_0/PmRules.php index 1833399b49..a8c76e42ec 100644 --- a/Sources/Db/Schema/v3_0/PmRules.php +++ b/Sources/Db/Schema/v3_0/PmRules.php @@ -28,6 +28,13 @@ class PmRules extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/PollChoices.php b/Sources/Db/Schema/v3_0/PollChoices.php index 681a21d0ae..15ae24b454 100644 --- a/Sources/Db/Schema/v3_0/PollChoices.php +++ b/Sources/Db/Schema/v3_0/PollChoices.php @@ -28,6 +28,13 @@ class PollChoices extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Polls.php b/Sources/Db/Schema/v3_0/Polls.php index 4547d338c3..1a46dd673c 100644 --- a/Sources/Db/Schema/v3_0/Polls.php +++ b/Sources/Db/Schema/v3_0/Polls.php @@ -28,6 +28,13 @@ class Polls extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Qanda.php b/Sources/Db/Schema/v3_0/Qanda.php index 22d89cb9ce..ed5b353417 100644 --- a/Sources/Db/Schema/v3_0/Qanda.php +++ b/Sources/Db/Schema/v3_0/Qanda.php @@ -28,6 +28,13 @@ class Qanda extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/ScheduledTasks.php b/Sources/Db/Schema/v3_0/ScheduledTasks.php index a57c56b258..a4814037a4 100644 --- a/Sources/Db/Schema/v3_0/ScheduledTasks.php +++ b/Sources/Db/Schema/v3_0/ScheduledTasks.php @@ -28,6 +28,22 @@ class ScheduledTasks extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_task' => 'int', + 'next_time' => 'int', + 'time_offset' => 'int', + 'time_regularity' => 'int', + 'time_unit' => 'string', + 'disabled' => 'int', + 'task' => 'string', + 'callable' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Sessions.php b/Sources/Db/Schema/v3_0/Sessions.php index 9ad547e79e..2306ca64f6 100644 --- a/Sources/Db/Schema/v3_0/Sessions.php +++ b/Sources/Db/Schema/v3_0/Sessions.php @@ -28,6 +28,13 @@ class Sessions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Settings.php b/Sources/Db/Schema/v3_0/Settings.php index 1e31089162..7114c41acd 100644 --- a/Sources/Db/Schema/v3_0/Settings.php +++ b/Sources/Db/Schema/v3_0/Settings.php @@ -28,6 +28,16 @@ class Settings extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'variable' => 'string', + 'value' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/SmileyFiles.php b/Sources/Db/Schema/v3_0/SmileyFiles.php index bd6fb06609..f83a674c17 100644 --- a/Sources/Db/Schema/v3_0/SmileyFiles.php +++ b/Sources/Db/Schema/v3_0/SmileyFiles.php @@ -28,6 +28,13 @@ class SmileyFiles extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Smileys.php b/Sources/Db/Schema/v3_0/Smileys.php index a9e6b31b11..b4376c6332 100644 --- a/Sources/Db/Schema/v3_0/Smileys.php +++ b/Sources/Db/Schema/v3_0/Smileys.php @@ -28,6 +28,13 @@ class Smileys extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Spiders.php b/Sources/Db/Schema/v3_0/Spiders.php index d87dcdbf6c..633fa1f8de 100644 --- a/Sources/Db/Schema/v3_0/Spiders.php +++ b/Sources/Db/Schema/v3_0/Spiders.php @@ -16,6 +16,7 @@ namespace SMF\Db\Schema\v3_0; use SMF\Db\Schema\Column; +use SMF\Db\Schema\Index; use SMF\Db\Schema\Table; /** @@ -27,6 +28,17 @@ class Spiders extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'spider_name' => 'string', + 'user_agent' => 'string', + 'ip_info' => 'string', + ]; + /** * @var array * @@ -185,6 +197,15 @@ public function __construct() default: '', ), ]; + + $this->indices = [ + new Index( + type: 'primary', + columns: [ + 'id_spider', + ], + ), + ]; } } diff --git a/Sources/Db/Schema/v3_0/Subscriptions.php b/Sources/Db/Schema/v3_0/Subscriptions.php index 555825fe87..97cd18eeb7 100644 --- a/Sources/Db/Schema/v3_0/Subscriptions.php +++ b/Sources/Db/Schema/v3_0/Subscriptions.php @@ -28,6 +28,13 @@ class Subscriptions extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Themes.php b/Sources/Db/Schema/v3_0/Themes.php index 77ece018f7..b1e76bae7e 100644 --- a/Sources/Db/Schema/v3_0/Themes.php +++ b/Sources/Db/Schema/v3_0/Themes.php @@ -28,6 +28,17 @@ class Themes extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_theme' => 'int', + 'variable' => 'string', + 'value' => 'string' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/Topics.php b/Sources/Db/Schema/v3_0/Topics.php index e3c8218cb0..5b919c0ae0 100644 --- a/Sources/Db/Schema/v3_0/Topics.php +++ b/Sources/Db/Schema/v3_0/Topics.php @@ -28,6 +28,20 @@ class Topics extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_topic' => 'int', + 'id_board' => 'int', + 'id_first_msg' => 'int', + 'id_last_msg' => 'int', + 'id_member_started' => 'int', + 'id_member_updated' => 'int', + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/UserAlerts.php b/Sources/Db/Schema/v3_0/UserAlerts.php index b2bfceed43..bc7d52f44c 100644 --- a/Sources/Db/Schema/v3_0/UserAlerts.php +++ b/Sources/Db/Schema/v3_0/UserAlerts.php @@ -28,6 +28,13 @@ class UserAlerts extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/UserAlertsPrefs.php b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php index 8695260224..d316cc6fd3 100644 --- a/Sources/Db/Schema/v3_0/UserAlertsPrefs.php +++ b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php @@ -28,6 +28,17 @@ class UserAlertsPrefs extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = [ + 'id_member' => 'int', + 'alert_pref' => 'string', + 'alert_value' => 'int' + ]; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/UserDrafts.php b/Sources/Db/Schema/v3_0/UserDrafts.php index d92ee23f25..4800a5c798 100644 --- a/Sources/Db/Schema/v3_0/UserDrafts.php +++ b/Sources/Db/Schema/v3_0/UserDrafts.php @@ -28,6 +28,13 @@ class UserDrafts extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/Db/Schema/v3_0/UserLikes.php b/Sources/Db/Schema/v3_0/UserLikes.php index 1257485ffd..4447508cb2 100644 --- a/Sources/Db/Schema/v3_0/UserLikes.php +++ b/Sources/Db/Schema/v3_0/UserLikes.php @@ -28,6 +28,13 @@ class UserLikes extends Table * Public properties *******************/ + /** + * @var array + * + * Initial columns for inserts. + */ + public array $initial_columns = []; + /** * @var array * diff --git a/Sources/ErrorHandler.php b/Sources/ErrorHandler.php index 68f26b5eef..e0cc4f2587 100644 --- a/Sources/ErrorHandler.php +++ b/Sources/ErrorHandler.php @@ -161,6 +161,10 @@ public static function log(string $error_message, string|bool $error_type = 'gen static $tried_hook = false; static $error_call = 0; + if (defined('SMF_INSTALLING')) { + throw new \Exception($error_message); + } + $error_call++; // Collect a backtrace @@ -282,6 +286,10 @@ public static function log(string $error_message, string|bool $error_type = 'gen */ public static function fatal(string $error, string|bool $log = 'general', int $status = 500): void { + if (defined('SMF_INSTALLING')) { + throw new \Exception($error); + } + // Send the appropriate HTTP status header - set this to 0 or false if you don't want to send one at all if (!empty($status)) { Utils::sendHttpStatus($status); @@ -308,7 +316,7 @@ public static function fatal(string $error, string|bool $log = 'general', int $s * * @param string $error The error message. * @param string|false $log The type of error, or false to not log it. - * @param array $sprintf An array of data to be substituted into the specified message. + * @param array $sprintf An array of data to be sprintf()'d into the specified message. * @param int $status The HTTP status code associated with this error. Default: 403. */ public static function fatalLang(string $error, string|bool $log = 'general', array $sprintf = [], int $status = 403): void @@ -332,11 +340,11 @@ public static function fatalLang(string $error, string|bool $log = 'general', ar if (empty(Lang::$txt[$error])) { $error_message = $error; } else { - $error_message = Lang::getTxt($error, $sprintf); + $error_message = empty($sprintf) ? Lang::$txt[$error] : vsprintf(Lang::$txt[$error], $sprintf); } // Send a custom header if we have a custom message. - if (isset($_REQUEST['js']) || isset($_REQUEST['xml']) || isset($_REQUEST['ajax'])) { + if (isset($_REQUEST['js']) || isset($_REQUEST['xml']) || isset($_RQEUEST['ajax'])) { header('X-SMF-errormsg: ' . $error_message); } @@ -356,7 +364,7 @@ public static function fatalLang(string $error, string|bool $log = 'general', ar if (empty(Lang::$txt[$error])) { $error_message = $error; } else { - $error_message = Lang::getTxt($error, $sprintf); + $error_message = empty($sprintf) ? Lang::$txt[$error] : vsprintf(Lang::$txt[$error], $sprintf); } self::log($error_message, $log); @@ -366,7 +374,7 @@ public static function fatalLang(string $error, string|bool $log = 'general', ar if ($reload_lang_file && !empty(Lang::$txt[$error])) { Lang::load('Errors'); - $error_message = Lang::getTxt($error, $sprintf); + $error_message = empty($sprintf) ? Lang::$txt[$error] : vsprintf(Lang::$txt[$error], $sprintf); } self::logOnline($error, $sprintf); diff --git a/Sources/Maintenance.php b/Sources/Maintenance.php new file mode 100644 index 0000000000..0dc0a9ac27 --- /dev/null +++ b/Sources/Maintenance.php @@ -0,0 +1,228 @@ + 'Install', + self::UPGRADE => 'Upgrade', + self::CONVERT => 'Convert', + self::TOOL => 'Tool', + self::SPECIAL => 'Special' + ]; + + public static int $overall_percent = 0; + + public function __construct() + { + Security::frameOptionsHeader('SAMEORIGIN'); + } + + public function execute(int $type): void + { + if (!self::toolIsValid($type)) { + die('Invalid Tool selected'); + } + + /** @var \SMF\Maintenance\ToolsInterface&\SMF\Maintenance\ToolsBase $tool_class */ + $tool_class = '\\SMF\\Maintenance\\Tools\\' . self::$valid_tools[$type]; + require_once Config::$sourcedir . '/Maintenance/Tools/' . self::$valid_tools[$type] . '.php'; + self::$tool = new $tool_class(); + + + /** @var \SMF\Maintenance\TemplateInterface $templ_class */ + $templ_class = '\\SMF\\Maintenance\\Template\\' . self::$valid_tools[$type]; + require_once Config::$sourcedir . '/Maintenance/Template/' . self::$valid_tools[$type] . '.php'; + self::$template = new $templ_class(); + + // This is really quite simple; if ?delete is on the URL, delete the installer... + if (isset($_GET['delete'])) { + self::$tool->deleteTool(); + exit; + } + + /** @var \SMF\Maintenance\Step $step */ + foreach (self::$tool->getSteps() as $num => $step) { + if ($num >= self::getCurrentStep()) { + // The current weight of this step in terms of overall progress. + self::$context['step_weight'] = $step->getProgress(); + + // Make sure we reset the skip button. + self::$context['skip'] = false; + + // Call the step and if it returns false that means pause! + if (method_exists(self::$tool, $step->getFunction()) && self::$tool->{$step->getFunction()}() === false) { + break; + } + + if (method_exists(self::$tool, $step->getFunction())) { + self::setCurrentStep(); + } + + // No warnings pass on. + self::$context['warning'] = ''; + } + self::$overall_percent += (int) $step->getProgress(); + } + + // Last chance to set our template. + if (self::$sub_template === '') { + self::$sub_template = self::$tool->getSteps()[self::getCurrentStep()]->getFunction(); + } + + self::exit(); + } + + public static function getRequiredVersionForPHP(): string + { + return '8.0.1'; + } + + // See if we think they have already installed it? + public static function isInstalled(): bool + { + if (Config::$image_proxy_secret === 'smfisawesome' && Config::$db_passwd === '' && Config::$boardurl === 'http://127.0.0.1/smf') { + return false; + } + return true; + } + + + public static function getSelf(): string + { + return $_SERVER['PHP_SELF']; + } + + public static function getBaseDir(): string + { + return dirname(SMF_SETTINGS_FILE); + } + + public static function getCurrentStep(): int + { + return isset($_GET['step']) ? (int) $_GET['step'] : 0; + } + + public static function getCurrentSubStep(): int + { + return isset($_GET['substep']) ? (int) $_GET['substep'] : 0; + } + + public static function setCurrentSubStep(?int $substep = null): void + { + $_GET['substep'] = $substep ?? (self::getCurrentSubStep() + 1); + } + + public static function getCurrentStart(): int + { + return isset($_GET['start']) ? (int) $_GET['start'] : 0; + } + + public static function setCurrentStart(?int $start = null): void + { + $_GET['start'] = $start ?? (self::getCurrentStart() + 1); + } + + public static function getRequestedLanguage(): string + { + if (isset($_GET['lang_file'])) { + $_SESSION['lang_file'] = strtr((string) $_GET['lang_file'], './\\:', '____'); + return $_SESSION['lang_file']; + } else if (isset($_SESSION['lang_file'])) { + return $_SESSION['lang_file']; + } else { + return 'en_US'; + } + + } + + public static function setSubTemplate(string $tmpl): void + { + if (method_exists(self::$template, $tmpl)) { + self::$sub_template = $tmpl; + } + } + private static function toolIsValid(int $type): bool + { + return isset(self::$valid_tools[$type]); + } + + private static function setCurrentStep(?int $step = null): void + { + $_GET['step'] = $step ?? (self::getCurrentStep() + 1); + } + + private static function exit(bool $fallThrough = false): void + { + // Send character set. + header('content-type: text/html; charset=' . (Lang::$txt['lang_character_set'] ?? 'UTF-8')); + + // We usually dump our templates out. + if (!$fallThrough) { + // The top bit. + Template::header(); + call_user_func([self::$template, 'upper']); + + // Call the template. + if (self::$sub_template !== '') { + self::$context['form_url'] = self::getSelf() . '?step=' . self::getCurrentStep(); + + call_user_func([self::$template, self::$sub_template]); + } + + // Show the footer. + call_user_func([self::$template, 'lower']); + Template::footer(); + } + + // Bang - gone! + die(); + } +} + diff --git a/Sources/Maintenance/Database/MySQL.php b/Sources/Maintenance/Database/MySQL.php new file mode 100644 index 0000000000..17bed88f8e --- /dev/null +++ b/Sources/Maintenance/Database/MySQL.php @@ -0,0 +1,114 @@ +connection, 'SELECT VERSION();'))[0]; + } + + public function isSupported(): bool + { + return function_exists('mysqli_connect'); + } + + public function SkipSelectDatabase(): bool + { + return false; + } + + public function getDefaultUser(): string + { + return ini_get('mysql.default_user') === false ? '' : ini_get('mysql.default_user'); + } + + public function getDefaultPassword(): string + { + return ini_get('mysql.default_password') === false ? '' : ini_get('mysql.default_password'); + } + + public function getDefaultHost(): string + { + return ini_get('mysql.default_host') === false ? '' : ini_get('mysql.default_host'); + } + + public function getDefaultPort(): int + { + return ini_get('mysql.default_port') === false ? 3306 : (int) ini_get('mysql.default_port'); + } + + public function getDefaultName(): string + { + return 'smf_'; + } + + public function checkConfiguration(): bool + { + return true; + } + + public function hasPermissions(): bool + { + // Find database user privileges. + $privs = []; + $get_privs = Db::$db->query('', 'SHOW PRIVILEGES', []); + + while ($row = Db::$db->fetch_assoc($get_privs)) { + if ($row['Privilege'] == 'Alter') { + $privs[] = $row['Privilege']; + } + } + Db::$db->free_result($get_privs); + + // Check for the ALTER privilege. + if (!in_array('Alter', $privs)) { + return false; + } + + return true; + } + + public function validatePrefix(&$value): bool + { + $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); + + return true; + } + + public function utf8Configured(): bool + { + return true; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/Database/PostgreSQL.php b/Sources/Maintenance/Database/PostgreSQL.php new file mode 100644 index 0000000000..f6c9c75ea8 --- /dev/null +++ b/Sources/Maintenance/Database/PostgreSQL.php @@ -0,0 +1,136 @@ +connection, 'SELECT version()'); + list($version) = pg_fetch_row($request); + list($pgl, $version) = explode(' ', $version); + + return $version; + } + + public function isSupported(): bool + { + return function_exists('pg_connect'); + } + + public function SkipSelectDatabase(): bool + { + return true; + } + + public function getDefaultUser(): string + { + return ''; + } + + public function getDefaultPassword(): string + { + return ''; + } + + public function getDefaultHost(): string + { + return ''; + } + + public function getDefaultPort(): int + { + return 5432; + } + + public function getDefaultName(): string + { + return 'smf_'; + } + + public function checkConfiguration(): bool + { + $result = Db::$db->query( + '', + 'show standard_conforming_strings', + [ + 'db_error_skip' => true, + ], + ); + + if ($result !== false) { + $row = Db::$db->fetch_assoc($result); + + if ($row['standard_conforming_strings'] !== 'on') { + throw new \Exception(Lang::$txt['error_pg_scs']); + } + Db::$db->free_result($result); + } + + return true; + } + + + public function hasPermissions(): bool + { + return true; + } + + public function validatePrefix(&$value): bool + { + $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); + + // Is it reserved? + if ($value == 'pg_') { + throw new \Exception(Lang::$txt['error_db_prefix_reserved']); + } + + // Is the prefix numeric? + if (preg_match('~^\d~', $value)) { + throw new \Exception(Lang::$txt['error_db_prefix_numeric']); + } + + return true; + } + + public function utf8Configured(): bool + { + $request = pg_query(Db::$db->connection, 'SHOW SERVER_ENCODING'); + + list($charcode) = pg_fetch_row($request); + + if ($charcode == 'UTF8') { + return true; + } + + throw new \Exception(sprintf(Lang::$txt['error_utf8_version'], $this->getMinimumVersion())); + } + +} \ No newline at end of file diff --git a/Sources/Maintenance/DatabaseInterface.php b/Sources/Maintenance/DatabaseInterface.php new file mode 100644 index 0000000000..0e582e1de0 --- /dev/null +++ b/Sources/Maintenance/DatabaseInterface.php @@ -0,0 +1,48 @@ +name = 'admin_info_files'; + $this->columns = [ + new SchemaColumn( + name: 'id_file', + type: SchemaColumn::TYPE_TINYINT, + unsigned: true, + auto: true + ), + new SchemaColumn( + name: 'filename', + type: SchemaColumn::TYPE_VARCHAR, + size: 255, + null: false, + default: '' + ), + new SchemaColumn( + name: 'path', + type: SchemaColumn::TYPE_VARCHAR, + size: 255, + null: false, + default: '' + ), + new SchemaColumn( + name: 'parameters', + type: SchemaColumn::TYPE_VARCHAR, + size: 255, + null: false, + default: '' + ), + new SchemaColumn( + name: 'data', + type: SchemaColumn::TYPE_TEXT, + null: false, + ), + new SchemaColumn( + name: 'filetype', + type: SchemaColumn::TYPE_VARCHAR, + size: 255, + null: false, + default: '' + ), + ]; + + $this->indexes = [ + new SchemaIndex( + name: 'PRIMARY', + type: SchemaIndex::TYPE_PRIMARY, + columns: [ + new SchemaIndexColumn('id_file') + ] + ) + ]; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaBase.php b/Sources/Maintenance/SchemaBase.php new file mode 100644 index 0000000000..a2649a0fe6 --- /dev/null +++ b/Sources/Maintenance/SchemaBase.php @@ -0,0 +1,119 @@ +name = $name; + $this->columns = $columns; + $this->indexes = $indexes; + } + + public function getName(): string + { + return $this->name; + } + + /** + * + * @return \SMF\Maintenance\SchemaColumn[] + */ + public function getColumns(): array + { + return $this->columns; + } + + /** + * + * @return \SMF\Maintenance\SchemaIndex[] + */ + public function getIndexes(): array + { + return $this->indexes; + } + + public function getDefaultData(): array + { + return []; + } + + final public function getColumnsForCreateTable(): array + { + $columns = []; + + foreach ($this->columns as $col) { + $rt = [ + 'name' => $col->getName(), + 'type' => $col->getType(), + + 'auto' => $col->getAutoIncrement(), + 'null' => $col->getNullable(), + 'unsigned' => $col->getUnsigned(), + ]; + + if ($col->getDefault() !== false) { + $rt['default'] = $col->getDefault(); + } + if ($col->getSize() !== null) { + $rt['size'] = $col->getSize(); + } + + $columns[] = $rt; + } + + return $columns; + } + + final public function getIndexesForCreateTable(): array + { + $indexes = []; + + foreach ($this->indexes as $col) { + $rt = [ + 'name' => $col->getName(), + 'type' => $col->getType(), + 'columns' => [], + ]; + + foreach ($col->getColumns() as $col) { + if ($col->getSize() !== null) { + $rt['columns'][] = [ + 'name' => $col->getName(), + 'size' => $col->getSize() + ]; + } else { + $rt['columns'][] = [ + 'name' => $col->getName(), + ]; + } + } + + $indexes[] = $rt; + } + + return $indexes; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaColumn.php b/Sources/Maintenance/SchemaColumn.php new file mode 100644 index 0000000000..73923144cd --- /dev/null +++ b/Sources/Maintenance/SchemaColumn.php @@ -0,0 +1,83 @@ +name = $name; + $this->type = $type; + $this->size = $size; + $this->unsigned = $unsigned; + $this->null = $null; + $this->default = $default; + $this->auto = $auto; + } + + public function getName(): string + { + return $this->name; + } + public function getType(): ?string + { + return $this->type; + } + public function getSize(): ?int + { + return $this->size; + } + public function getUnsigned(): bool + { + return $this->unsigned; + } + public function getNullable(): bool + { + return $this->null; + } + public function getAutoIncrement(): bool + { + return $this->auto; + } + public function getDefault(): string|int|float|null|false + { + return $this->default; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaIndex.php b/Sources/Maintenance/SchemaIndex.php new file mode 100644 index 0000000000..1e1c68ff7e --- /dev/null +++ b/Sources/Maintenance/SchemaIndex.php @@ -0,0 +1,56 @@ +name = $name; + $this->type = $type; + $this->columns = $columns; + } + + public function getName(): string + { + return $this->name; + } + public function getType(): string + { + return $this->type; + } + /** + * + * @return \SMF\Maintenance\SchemaIndexColumn[] + */ + public function getColumns(): array + { + return $this->columns; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaIndexColumn.php b/Sources/Maintenance/SchemaIndexColumn.php new file mode 100644 index 0000000000..98d75ccdf7 --- /dev/null +++ b/Sources/Maintenance/SchemaIndexColumn.php @@ -0,0 +1,40 @@ +name = $name; + $this->size = $size; + } + + public function getName(): string + { + return $this->name; + } + public function getSize(): ?int + { + return $this->size; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaInterface.php b/Sources/Maintenance/SchemaInterface.php new file mode 100644 index 0000000000..eadc113fa8 --- /dev/null +++ b/Sources/Maintenance/SchemaInterface.php @@ -0,0 +1,35 @@ +id = $id; + $this->name = $name; + $this->title = $title; + $this->function = $function; + $this->progress = $progres; + } + + public function getID(): int + { + return $this->id; + } + public function getName(): string + { + return $this->name; + } + public function getTitle(): ?string + { + return $this->title; + } + public function getFunction(): string + { + return $this->function; + } + public function getProgress(): int + { + return $this->progress; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/Template.php b/Sources/Maintenance/Template.php new file mode 100644 index 0000000000..3dc98f9c09 --- /dev/null +++ b/Sources/Maintenance/Template.php @@ -0,0 +1,176 @@ + + + + + + ', Maintenance::$tool->getPageTitle(), ' + + ', Lang::$txt['lang_rtl'] == '1' ? ' + ' : '', ' + + + + +
+ +
'; + + // Have we got a language drop down - if so do it on the first step only. + if (!empty(Maintenance::$languages) && count(Maintenance::$languages) > 1 && Maintenance::getCurrentStep() == 0) { + echo ' +
+
+
+
+
+ + + +
+
+
+
+
+
'; + } + + echo ' +
+
+
+

', Lang::$txt['upgrade_progress'], '

+
    '; + + if (Maintenance::$tool->hasSteps()) { + foreach (Maintenance::$tool->getSteps() as $num => $step) { + echo ' + ', Lang::$txt['upgrade_step'], ' ', $step->getID(), ': ', $step->getName(), ''; + } + } + + echo ' +
+
+
+
+

' . Lang::$txt['upgrade_overall_progress'], '

+ ', Maintenance::$overall_percent, '% +
+
+
+
+

', Maintenance::$tool->getStepTitle(), '

+
'; + + } + + public static function footer(): void + { + echo ' +
+
+
+
+
+
+ + + '; + + } + + public static function warningsAndErrors(): void + { + // Errors are very serious.. + if (!empty(Maintenance::$fatal_error)) { + echo ' +
+

', Lang::$txt['upgrade_critical_error'], '

+ ', Maintenance::$fatal_error, ' +
'; + } + else if (!empty(Maintenance::$errors)) { + echo ' +
+

', Lang::$txt['upgrade_critical_error'], '

+ ', implode(' + ', Maintenance::$errors), ' +
'; + } + // A warning message? + elseif (!empty(Maintenance::$warnings)) { + echo ' +
+

', Lang::$txt['upgrade_warning'], '

+ ', implode(' + ', Maintenance::$warnings), ' +
'; + } + } + + public static function missingLanguages(): void + { + // Let's not cache this message, eh? + header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); + header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('cache-control: no-cache'); + + echo ' + + + SMF Installer: Error! + + + +

A critical error has occurred.

+ +

This installer was unable to find this tools\'s language file or files. They should be found under:

+ +
', dirname(Maintenance::getSelf()) != '/' ? dirname(Maintenance::getSelf()) : '', '/Languages
+ +

In some cases, FTP clients do not properly upload files with this many folders. Please double check to make sure you have uploaded all the files in the distribution.

+

If that doesn\'t help, please make sure this install.php file is in the same place as the Themes folder.

+

If you continue to get this error message, feel free to look to us for support.

+ +'; + + die; + } +} \ No newline at end of file diff --git a/Sources/Maintenance/Template/Install.php b/Sources/Maintenance/Template/Install.php new file mode 100644 index 0000000000..60a20a2f00 --- /dev/null +++ b/Sources/Maintenance/Template/Install.php @@ -0,0 +1,473 @@ +'; + } + + public static function lower(): void + { + if (!empty(Maintenance::$context['continue']) || !empty(Maintenance::$context['skip'])) { + echo ' +
'; + + if (!empty(Maintenance::$context['continue'])) { + echo ' + '; + } + + if (!empty(Maintenance::$context['skip'])) { + echo ' + '; + } + echo ' +
'; + } + + // Show the closing form tag and other data only if not in the last step + if (count(Maintenance::$tool->getSteps()) - 1 !== (int) Maintenance::getCurrentStep()) { + echo ' + '; + } + } + + public static function Welcome(): void + { + echo ' + + +

', sprintf(Lang::$txt['install_welcome_desc'], SMF_VERSION), '

+ '; + + // Oh no! + if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { + Template::warningsAndErrors(); + } + + // For the latest version stuff. + echo ' + '; + } + + public static function CheckFilesWritable(): void + { + echo ' +

', Lang::$txt['ftp_setup_why_info'], '

+
    +
  • ', implode('
  • +
  • ', Maintenance::$context['failed_files']), '
  • +
'; + + if (isset(Maintenance::$context['systemos'], Maintenance::$context['detected_path']) && Maintenance::$context['systemos'] == 'linux') { + echo ' +
+

', Lang::$txt['chmod_linux_info'], '

+ # chmod a+w ', implode(' ' . Maintenance::$context['detected_path'] . '/', Maintenance::$context['failed_files']), ''; + } + + // This is serious! + if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { + Template::warningsAndErrors(); + return; + } + + echo ' +
+

', Lang::$txt['ftp_setup_info'], '

'; + + if (!empty(Maintenance::$context['ftp_errors'])) { + echo ' +
+ ', Lang::$txt['error_ftp_no_connect'], '

+ ', implode('
', Maintenance::$context['ftp_errors']), '
+
'; + } + + echo ' +
+
+
+ +
+
+
+ + +
+ +
', Lang::$txt['ftp_server_info'], '
+
+
+ +
+
+ +
', Lang::$txt['ftp_username_info'], '
+
+
+ +
+
+ +
', Lang::$txt['ftp_password_info'], '
+
+
+ +
+
+ +
', Maintenance::$context['ftp']['path_msg'], '
+
+
+
+ +
+
+ ', Lang::$txt['error_message_click'], ' ', Lang::$txt['ftp_setup_again']; + } + + public static function DatabaseSettings(): void + { + echo ' +

', Lang::$txt['db_settings_info'], '

'; + + Template::warningsAndErrors(); + + echo ' +
'; + + // More than one database type? + if (count(Maintenance::$context['databases']) > 1) { + echo ' +
+ +
+
+ +
', Lang::$txt['db_settings_type_info'], '
+
'; + } else { + echo ' +
+ +
'; + } + + echo ' +
+ +
+
+ +
', Lang::$txt['db_settings_server_info'], '
+
+
+ +
+
+ +
', Lang::$txt['db_settings_port_info'], '
+
+
+ +
+
+ +
', Lang::$txt['db_settings_username_info'], '
+
+
+ +
+
+ +
', Lang::$txt['db_settings_password_info'], '
+
+
+ +
+
+ +
+ ', Lang::$txt['db_settings_database_info'], ' + ', Lang::$txt['db_settings_database_info_note'], ' +
+
+
+ +
+
+ +
', Lang::$txt['db_settings_prefix_info'], '
+
+
'; + + // Toggles a warning related to db names in PostgreSQL + echo ' + '; + } + + public static function ForumSettings(): void + { + echo ' +

', Lang::$txt['install_settings_info'], '

'; + + Template::warningsAndErrors(); + + echo ' +
+
+ +
+
+ +
', Lang::$txt['install_settings_name_info'], '
+
+
+ +
+
+ +
', Lang::$txt['install_settings_url_info'], '
+
+
+ +
+
+ +
', Lang::$txt['install_settings_reg_mode_info'], '
+
+
', Lang::$txt['install_settings_compress'], ':
+
+ + +
', Lang::$txt['install_settings_compress_info'], '
+
+
', Lang::$txt['install_settings_dbsession'], ':
+
+ + +
', Maintenance::$context['test_dbsession'] ? Lang::$txt['install_settings_dbsession_info1'] : Lang::$txt['install_settings_dbsession_info2'], '
+
+
', Lang::$txt['install_settings_stats'], ':
+
+ + +
', Lang::$txt['install_settings_stats_info'], '
+
+
', Lang::$txt['force_ssl'], ':
+
+ + +
', Lang::$txt['force_ssl_info'], '
+
+
'; + + } + + public static function DatabasePopulation(): void + { + echo ' +

', !empty(Maintenance::$context['was_refresh']) ? Lang::$txt['user_refresh_install_desc'] : Lang::$txt['db_populate_info'], '

'; + + if (!empty(Maintenance::$context['sql_results'])) { + echo ' +
    +
  • ', implode('
  • ', Maintenance::$context['sql_results']), '
  • +
'; + } + + if (!empty(Maintenance::$context['failures'])) { + echo ' +
', Lang::$txt['error_db_queries'], '
+
    '; + + foreach (Maintenance::$context['failures'] as $line => $fail) { + echo ' +
  • ', Lang::$txt['error_db_queries_line'], $line + 1, ': ', nl2br(htmlspecialchars($fail)), '
  • '; + } + + echo ' +
'; + } + + echo ' +

', Lang::$txt['db_populate_info2'], '

'; + + Template::warningsAndErrors(); + + echo ' + '; + } + + public static function AdminAccount(): void + { + echo ' +

', Lang::$txt['user_settings_info'], '

'; + + Template::warningsAndErrors(); + + echo ' +
+
+ +
+
+ +
', Lang::$txt['user_settings_username_info'], '
+
+
+ +
+
+ +
', Lang::$txt['user_settings_password_info'], '
+
+
+ +
+
+ +
', Lang::$txt['user_settings_again_info'], '
+
+
+ +
+
+ +
', Lang::$txt['user_settings_admin_email_info'], '
+
+
+ +
+
+ +
', Lang::$txt['user_settings_server_email_info'], '
+
+
'; + + if (Maintenance::$context['require_db_confirm']) { + echo ' +

', Lang::$txt['user_settings_database'], '

+

', Lang::$txt['user_settings_database_info'], '

+ +
+ +
'; + } + } + + public static function DeleteInstall(): void + { + echo ' +

', Lang::$txt['congratulations_help'], '

'; + + Template::warningsAndErrors(); + + // Install directory still writable? + if (Maintenance::$context['dir_still_writable']) { + echo ' +

', Lang::$txt['still_writable'], '

'; + } + + // Don't show the box if it's like 99% sure it won't work :P. + if (Maintenance::$context['probably_delete_install']) { + echo ' + + '; + } + + echo ' +

', sprintf(Lang::$txt['go_to_your_forum'], Config::$boardurl . '/index.php'), '

+
+ ', Lang::$txt['good_luck']; + } + +} \ No newline at end of file diff --git a/Sources/Maintenance/TemplateInterface.php b/Sources/Maintenance/TemplateInterface.php new file mode 100644 index 0000000000..2850c115e0 --- /dev/null +++ b/Sources/Maintenance/TemplateInterface.php @@ -0,0 +1,21 @@ +detectLanguages(['General', 'Install']); + + if (empty(Maintenance::$languages)) { + if (!Sapi::isCLI()) { + Template::missingLanguages(); + } + + throw new Exception('This installer was unable to find this tools\'s language file or files.'); + } else { + $requested_lang = Maintenance::getRequestedLanguage(); + + // Ensure SMF\Lang knows the path to the language directory. + Lang::addDirs(Config::$languagesdir); + + // And now load the language file. + Lang::load('Install', $requested_lang); + + // Assume that the admin likes that language. + if ($requested_lang !== 'en_US') { + Config::$language = $requested_lang; + } + } + } + + public function getPageTitle(): string + { + return $this->page_title ?? $this->getSteps()[Maintenance::getCurrentStep()]->getTitle() ?? Lang::$txt['smf_installer']; + } + + public function hasSteps(): bool + { + return true; + } + + /** + * + * @return \SMF\Maintenance\Step[] + */ + public function getSteps(): array + { + return [ + 0 => new Step( + id: 1, + name: Lang::$txt['install_step_welcome'], + function: 'Welcome', + progres: 0 + ), + 1 => new Step( + id: 2, + name: Lang::$txt['install_step_writable'], + function: 'CheckFilesWritable', + progres: 10 + ), + 2 => new Step( + id: 3, + name: Lang::$txt['install_step_databaseset'], + title: Lang::$txt['db_settings'], + function: 'DatabaseSettings', + progres: 15 + ), + 3 => new Step( + id: 4, + name: Lang::$txt['install_step_forum'], + title: Lang::$txt['install_settings'], + function: 'ForumSettings', + progres: 40 + ), + 4 => new Step( + id: 5, + name: Lang::$txt['install_step_databasechange'], + title: Lang::$txt['db_populate'], + function: 'DatabasePopulation', + progres: 15 + ), + 5 => new Step( + id: 6, + name: Lang::$txt['install_step_admin'], + title: Lang::$txt['user_settings'], + function: 'AdminAccount', + progres: 20 + ), + 6 => new Step( + id: 7, + name: Lang::$txt['install_step_delete'], + function: 'DeleteInstall', + progres: 0 + ), + ]; + } + + public function getStepTitle(): string + { + return $this->getSteps()[Maintenance::getCurrentStep()]->getName(); + } + + public function Welcome(): bool + { + // Done the submission? + if (isset($_POST['contbutt'])) { + return true; + } + + if (Maintenance::isInstalled()) { + Maintenance::$context['warning'] = Lang::$txt['error_already_installed']; + } + + Maintenance::$context['supported_databases'] = $this->supportedDatabases(); + + // Needs to at least meet our miniumn version. + if ((version_compare(Maintenance::getRequiredVersionForPHP(), PHP_VERSION, '>='))) { + Maintenance::$fatal_error = Lang::$txt['error_php_too_low']; + return false; + } + // Make sure we have a supported database + elseif (empty(Maintenance::$context['supported_databases'])) { + Maintenance::$fatal_error = Lang::$txt['error_db_missing']; + return false; + } + + // How about session support? Some crazy sysadmin remove it? + if (!function_exists('session_start')) { + Maintenance::$errors[] = Lang::$txt['error_session_missing']; + } + + // Make sure they uploaded all the files. + if (!file_exists(Config::$boarddir . '/index.php')) { + Maintenance::$errors[] = Lang::$txt['error_missing_files']; + } + // Very simple check on the session.save_path for Windows. + // @todo Move this down later if they don't use database-driven sessions? + elseif (@ini_get('session.save_path') == '/tmp' && Sapi::isOS(Sapi::OS_WINDOWS)) { + Maintenance::$errors[] = Lang::$txt['error_session_save_path']; + } + + // Mod_security blocks everything that smells funny. Let SMF handle security. + if (!$this->checkAndTryToFixModSecurity() && !isset($_GET['overmodsecurity'])) { + Maintenance::$fatal_error = Lang::$txt['error_mod_security'] . '

' . Lang::$txt['error_message_click'] . ' ' . Lang::$txt['error_message_bad_try_again']; + } + + // Confirm mbstring is loaded... + if (!extension_loaded('mbstring')) { + Maintenance::$errors[] = Lang::$txt['install_no_mbstring']; + } + + // Confirm fileinfo is loaded... + if (!extension_loaded('fileinfo')) { + Maintenance::$errors[] = Lang::$txt['install_no_fileinfo']; + } + + // Check for https stream support. + $supported_streams = stream_get_wrappers(); + + if (!in_array('https', $supported_streams)) { + Maintenance::$warnings[] = Lang::$txt['install_no_https']; + } + + if (empty(Maintenance::$errors)) { + Maintenance::$context['continue'] = true; + } + + return false; + } + + public function CheckFilesWritable() + { + $writable_files = [ + 'attachments', + 'avatars', + 'custom_avatar', + 'cache', + 'Packages', + 'Smileys', + 'Themes', + 'Languages/en_US/agreement.txt', + 'Settings.php', + 'Settings_bak.php', + 'cache/db_last_error.php', + ]; + + foreach ($this->detectLanguages() as $lang => $temp) { + $extra_files[] = 'Languages/' . $lang; + } + + // With mod_security installed, we could attempt to fix it with .htaccess. + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { + $writable_files[] = file_exists(Config::$boarddir . '/.htaccess') ? '.htaccess' : '.'; + } + + $failed_files = []; + + // Windows is trickier. Let's try opening for r+... + if (Sapi::isOS(Sapi::OS_WINDOWS)) { + foreach ($writable_files as $file) { + // Folders can't be opened for write... but the index.php in them can ;) + if (is_dir(Config::$boarddir . '/' . $file)) { + $file .= '/index.php'; + } + + // Funny enough, chmod actually does do something on windows - it removes the read only attribute. + @chmod(Config::$boarddir . '/' . $file, 0777); + $fp = @fopen(Config::$boarddir . '/' . $file, 'r+'); + + // Hmm, okay, try just for write in that case... + if (!is_resource($fp)) { + $fp = @fopen(Config::$boarddir . '/' . $file, 'w'); + } + + if (!is_resource($fp)) { + $failed_files[] = $file; + } + + @fclose($fp); + } + + foreach ($extra_files as $file) { + @chmod(Config::$boarddir . (empty($file) ? '' : '/' . $file), 0777); + } + } else { + // On linux, it's easy - just use is_writable! + foreach ($writable_files as $file) { + // Some files won't exist, try to address up front + if (!file_exists(Config::$boarddir . '/' . $file)) { + @touch(Config::$boarddir . '/' . $file); + } + + // NOW do the writable check... + if (!is_writable(Config::$boarddir . '/' . $file)) { + @chmod(Config::$boarddir . '/' . $file, 0755); + + // Well, 755 hopefully worked... if not, try 777. + if (!is_writable(Config::$boarddir . '/' . $file) && !@chmod(Config::$boarddir . '/' . $file, 0777)) { + $failed_files[] = $file; + } + } + } + + foreach ($extra_files as $file) { + @chmod(Config::$boarddir . (empty($file) ? '' : '/' . $file), 0777); + } + } + + $failure = count($failed_files) >= 1; + + if (!isset($_SERVER)) { + return !$failure; + } + + // Put the list into context. + Maintenance::$context['failed_files'] = $failed_files; + + // It's not going to be possible to use FTP on windows to solve the problem... + if ($failure && Sapi::isOS(Sapi::OS_WINDOWS)) { + Maintenance::$fatal_error = Lang::$txt['error_windows_chmod'] . ' +
    +
  • ' . implode('
  • +
  • ', $failed_files) . '
  • +
'; + + return false; + } + + // We're going to have to use... FTP! + if ($failure) { + // Load any session data we might have... + if (!isset($_POST['ftp']['username']) && isset($_SESSION['ftp'])) { + $_POST['ftp']['server'] = $_SESSION['ftp']['server']; + $_POST['ftp']['port'] = $_SESSION['ftp']['port']; + $_POST['ftp']['username'] = $_SESSION['ftp']['username']; + $_POST['ftp']['password'] = $_SESSION['ftp']['password']; + $_POST['ftp']['path'] = $_SESSION['ftp']['path']; + } + + Maintenance::$context['ftp_errors'] = []; + + if (isset($_POST['ftp_username'])) { + $ftp = new FtpConnection($_POST['ftp']['server'], $_POST['ftp']['port'], $_POST['ftp']['username'], $_POST['ftp']['password']); + + if ($ftp->error === false) { + // Try it without /home/abc just in case they messed up. + if (!$ftp->chdir($_POST['ftp']['path'])) { + Maintenance::$context['ftp_errors'][] = $ftp->last_message; + $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp']['path'])); + } + } + } + + if (!isset($ftp) || $ftp->error !== false) { + if (!isset($ftp)) { + $ftp = new FtpConnection(null); + } + // Save the error so we can mess with listing... + elseif ($ftp->error !== false && empty(Maintenance::$context['ftp_errors']) && !empty($ftp->last_message)) { + Maintenance::$context['ftp_errors'][] = $ftp->last_message; + } + + list($username, $detect_path, $found_path) = $ftp->detect_path(Config::$boarddir); + + if (empty($_POST['ftp']['path']) && $found_path) { + $_POST['ftp']['path'] = $detect_path; + } + + if (!isset($_POST['ftp']['username'])) { + $_POST['ftp']['username'] = $username; + } + + // Set the username etc, into context. + Maintenance::$context['ftp'] = [ + 'server' => $_POST['ftp']['server'] ?? 'localhost', + 'port' => $_POST['ftp']['port'] ?? '21', + 'username' => $_POST['ftp']['username'] ?? '', + 'path' => $_POST['ftp']['path'] ?? '/', + 'path_msg' => !empty($found_path) ? Lang::$txt['ftp_path_found_info'] : Lang::$txt['ftp_path_info'], + ]; + + return false; + } + + + $_SESSION['ftp'] = [ + 'server' => $_POST['ftp']['server'], + 'port' => $_POST['ftp']['port'], + 'username' => $_POST['ftp']['username'], + 'password' => $_POST['ftp']['password'], + 'path' => $_POST['ftp']['path'], + ]; + + $failed_files_updated = []; + + foreach ($failed_files as $file) { + if (!is_writable(Config::$boarddir . '/' . $file)) { + $ftp->chmod($file, 0755); + } + + if (!is_writable(Config::$boarddir . '/' . $file)) { + $ftp->chmod($file, 0777); + } + + if (!is_writable(Config::$boarddir . '/' . $file)) { + $failed_files_updated[] = $file; + Maintenance::$context['ftp_errors'][] = rtrim($ftp->last_message) . ' -> ' . $file . "\n"; + } + } + + $ftp->close(); + + // Are there any errors left? + if (count($failed_files_updated) >= 1) { + // Guess there are... + Maintenance::$context['failed_files'] = $failed_files_updated; + + // Set the username etc, into context. + Maintenance::$context['ftp'] = $_SESSION['ftp'] += [ + 'path_msg' => Lang::$txt['ftp_path_info'], + ]; + + return false; + } + + } + + return true; + } + + public function DatabaseSettings() + { + Maintenance::$context['continue'] = true; + Maintenance::$context['databases'] = []; + $foundOne = false; + + /** @var \SMF\Maintenance\DatabaseInterface $db */ + foreach ($this->supportedDatabases() as $key => $db) { + // Not supported, skip. + if (!$db->isSupported()) { + continue; + } + + Maintenance::$context['databases'][$key] = $db; + + // If we have not found a one, set some defaults. + if (!$foundOne) { + Maintenance::$context['db'] = [ + 'server' => $db->getDefaultHost(), + 'user' => $db->getDefaultUser(), + 'name' => $db->getDefaultName(), + 'pass' => $db->getDefaultPassword(), + 'port' => $db->getDefaultPort(), + 'prefix' => 'smf_', + 'type' => $key + ]; + } + } + + if (isset($_POST['db_user'])) { + Maintenance::$context['db']['user'] = $_POST['db_user']; + Maintenance::$context['db']['name'] = $_POST['db_name']; + Maintenance::$context['db']['server'] = $_POST['db_server']; + Maintenance::$context['db']['prefix'] = $_POST['db_prefix']; + + if (!empty($_POST['db_port'])) { + Maintenance::$context['db']['port'] = (int) $_POST['db_port']; + } + } + + // Are we submitting? + if (!isset($_POST['db_type'])) { + return false; + } + + // What type are they trying? + $db_type = preg_replace('~[^A-Za-z0-9]~', '', $_POST['db_type']); + $db_prefix = $_POST['db_prefix']; + + if (!isset(Maintenance::$context['databases'][$db_type])) { + Maintenance::$fatal_error = Lang::$txt['upgrade_unknown_error']; + return false; + } + + // Validate the prefix. + /** @var \SMF\Maintenance\DatabaseInterface $db */ + $db = Maintenance::$context['databases'][$db_type]; + + // Use a try/catch here, so we can send specific details about the validation error. + try { + if (($db->validatePrefix($db_prefix)) !== true) { + Maintenance::$fatal_error = Lang::$txt['upgrade_unknown_error']; + return false; + } + } + catch (Exception $exception) { + Maintenance::$fatal_error = $exception->getMessage(); + return false; + } + + // Take care of these variables... + $vars = [ + 'db_type' => $db_type, + 'db_name' => $_POST['db_name'], + 'db_user' => $_POST['db_user'], + 'db_passwd' => $_POST['db_passwd'] ?? '', + 'db_server' => $_POST['db_server'], + 'db_prefix' => $db_prefix, + // The cookiename is special; we want it to be the same if it ever needs to be reinstalled with the same info. + 'cookiename' => $this->createCookieName($_POST['db_name'], $db_prefix), + ]; + + // Only set the port if we're not using the default + if (!empty($_POST['db_port']) && $db->getDefaultPort() !== (int) $_POST['db_port']) { + $vars['db_port'] = (int) $_POST['db_port']; + } + + // God I hope it saved! + try{ + if (!$this->updateSettingsFile($vars)) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + + // Update SMF\Config with the changes we just saved. + Config::load(); + + // Better find the database file! + if (!file_exists(Config::$sourcedir . '/Db/APIs/' . Db::getClass(Config::$db_type) . '.php')) { + Maintenance::$fatal_error = sprintf(Lang::$txt['error_db_file'], 'Db/APIs/' . Db::getClass(Config::$db_type) . '.php'); + return false; + } + + // We need to make some queries, that would trip up our normal security checks. + Config::$modSettings['disableQueryCheck'] = true; + + // Attempt a connection. + $needsDB = !empty($databases[Config::$db_type]['always_has_db']); + + Db::load(['non_fatal' => true, 'dont_select_db' => !$needsDB]); + + // Still no connection? Big fat error message :P. + if (!Db::$db->connection) { + // Get error info... Recast just in case we get false or 0... + $error_message = Db::$db->connect_error(); + + if (empty($error_message)) { + $error_message = ''; + } + $error_number = Db::$db->connect_errno(); + + if (empty($error_number)) { + $error_number = ''; + } + $db_error = (!empty($error_number) ? $error_number . ': ' : '') . $error_message; + + Maintenance::$fatal_error = Lang::$txt['error_db_connect'] . '
' . $db_error . '
'; + + return false; + } + + // Do they meet the install requirements? + // @todo Old client, new server? + if (($db_version = $db->getServerVersion()) === false || version_compare($db->getMinimumVersion(), preg_replace('~^\D*|\-.+?$~', '', $db_version = $db->getServerVersion())) > 0) { + Maintenance::$fatal_error = sprintf(Lang::$txt['error_db_too_low'], $db->getTitle()); + return false; + } + + // Let's try that database on for size... assuming we haven't already lost the opportunity. + if (Db::$db->name != '' && !$needsDB) { + Db::$db->query( + '', + 'CREATE DATABASE IF NOT EXISTS `' . Db::$db->name . '`', + [ + 'security_override' => true, + 'db_error_skip' => true, + ], + Db::$db->connection, + ); + + // Okay, let's try the prefix if it didn't work... + if (!Db::$db->select(Db::$db->name, Db::$db->connection) && Db::$db->name != '') { + Db::$db->query( + '', + 'CREATE DATABASE IF NOT EXISTS `' . Db::$db->prefix . Db::$db->name . '`', + [ + 'security_override' => true, + 'db_error_skip' => true, + ], + Db::$db->connection, + ); + + if (Db::$db->select(Db::$db->prefix . Db::$db->name, Db::$db->connection)) { + Db::$db->name = Db::$db->prefix . Db::$db->name; + $this->updateSettingsFile(['db_name' => Db::$db->name]); + } + } + + // Okay, now let's try to connect... + if (!Db::$db->select(Db::$db->name, Db::$db->connection)) { + Maintenance::$fatal_error = sprintf(Lang::$txt['error_db_database'], Db::$db->name); + + return false; + } + } + + // Everything looks good, lets get on with it. + return true; + } + + public function ForumSettings() + { + // Let's see if we got the database type correct. + if (isset($_POST['db_type'], $this->supportedDatabases()[$_POST['db_type']])) { + Config::$db_type = $_POST['db_type']; + + try{ + if (!$this->updateSettingsFile(['db_type' => Config::$db_type])) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + + Config::load(); + } + else { + // Else we'd better be able to get the connection. + $this->loadDatabase(); + } + + $host = $this->defaultHost(); + $secure = Sapi::httpsOn(); + + // Now, to put what we've learned together... and add a path. + Maintenance::$context['detected_url'] = 'http' . ($secure ? 's' : '') . '://' . $host . substr(Maintenance::getSelf(), 0, strrpos(Maintenance::getSelf(), '/')); + + // Check if the database sessions will even work. + Maintenance::$context['test_dbsession'] = (ini_get('session.auto_start') != 1); + + Maintenance::$context['continue'] = true; + + $db = $this->getMaintenanceDatabase(Config::$db_type); + + // We have a failure of database configuration. + try{ + if (!$db->checkConfiguration()) { + Maintenance::$fatal_error = Lang::$txt['upgrade_unknown_error']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = $exception->getMessage(); + return false; + } + + // Setup the SSL checkbox... + Maintenance::$context['ssl_chkbx_protected'] = false; + Maintenance::$context['ssl_chkbx_checked'] = false; + + // If redirect in effect, force SSL ON. + $url = new Url(Maintenance::$context['detected_url']); + + if ($url->redirectsToHttps()) { + Maintenance::$context['ssl_chkbx_protected'] = true; + Maintenance::$context['ssl_chkbx_checked'] = true; + $_POST['force_ssl'] = true; + } + + // If no cert, make sure SSL stays OFF. + if (!$url->hasSSL()) { + Maintenance::$context['ssl_chkbx_protected'] = true; + Maintenance::$context['ssl_chkbx_checked'] = false; + } + + // Submitting? + if (!isset($_POST['boardurl'])) { + return false; + } + + // Deal with different operating systems' directory structure... + $path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', Maintenance::getBaseDir()), '/'); + + // Save these variables. + $vars = [ + 'boardurl' => $this->cleanBoardUrl($_POST['boardurl']), + 'boarddir' => $path, + 'sourcedir' => $path . '/Sources', + 'cachedir' => $path . '/cache', + 'packagesdir' => $path . '/Packages', + 'languagesdir' => $path . '/Languages', + 'mbname' => strtr($_POST['mbname'], ['\"' => '"']), + 'language' => Maintenance::getRequestedLanguage(), + 'image_proxy_secret' => $this->createImageProxySecret(), + 'image_proxy_enabled' => !empty($_POST['force_ssl']), + 'auth_secret' => $this->createAuthSecret(), + ]; + + try{ + if (!$this->updateSettingsFile($vars)) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + + // Update SMF\Config with the changes we just saved. + Config::load(); + + // UTF-8 requires a setting to override the language charset. + try{ + if (!$db->utf8Configured()) { + Maintenance::$fatal_error = Lang::$txt['error_utf8_support']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = $exception->getMessage(); + return false; + } + + // Set the character set here. + try{ + if (!$this->updateSettingsFile(['db_character_set' => 'utf8'], true)) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + } catch (Exception $exception) { + Maintenance::$fatal_error = Lang::$txt['settings_error']; + return false; + } + + // Good, skip on. + return true; + } + + public function DatabasePopulation(): bool + { + Maintenance::$context['continue'] = true; + + // Already done? + if (isset($_POST['pop_done'])) { + return true; + } + + // Reload settings. + Config::load(); + $this->loadDatabase(); + $newSettings = []; + $path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', Maintenance::getBaseDir()), '/'); + + // Before running any of the queries, let's make sure another version isn't already installed. + $result = Db::$db->query( + '', + 'SELECT variable, value + FROM {db_prefix}settings', + [ + 'db_error_skip' => true, + ], + ); + + if ($result !== false) { + while ($row = Db::$db->fetch_assoc($result)) { + Config::$modSettings[$row['variable']] = $row['value']; + } + + Db::$db->free_result($result); + + // Do they match? If so, this is just a refresh so charge on! + if (!isset(Config::$modSettings['smfVersion']) || Config::$modSettings['smfVersion'] != SMF_VERSION) { + Maintenance::$fatal_error = Lang::$txt['error_versions_do_not_match']; + + return false; + } + } + Config::$modSettings['disableQueryCheck'] = true; + + // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... + if (Sapi::isOS(Sapi::OS_WINDOWS)) { + $attachdir = $path . 'attachments'; + } else { + $attachdir = $path . '/attachments'; + } + + $replaces = [ + '{$db_prefix}' => Db::$db->prefix, + '{$attachdir}' => json_encode([1 => Db::$db->escape_string($attachdir)]), + '{$boarddir}' => Db::$db->escape_string(Config::$boarddir), + '{$boardurl}' => Config::$boardurl, + '{$enableCompressedOutput}' => isset($_POST['compress']) ? '1' : '0', + '{$databaseSession_enable}' => isset($_POST['dbsession']) ? '1' : '0', + '{$smf_version}' => SMF_VERSION, + '{$current_time}' => time(), + '{$sched_task_offset}' => 82800 + mt_rand(0, 86399), + '{$registration_method}' => $_POST['reg_mode'] ?? 0, + ]; + + foreach (Lang::$txt as $key => $value) { + if (substr($key, 0, 8) == 'default_') { + $replaces['{$' . $key . '}'] = Db::$db->escape_string($value); + } + } + $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], ['\\\\n' => '\\n']); + + $existing_tables = Db::$db->list_tables(Config::$db_name, Config::$db_prefix); + $install_tables = $this->getTables(Config::$sourcedir . '/Db/Schema/', $this->schema_version); + Maintenance::$context['sql_results'] = [ + 'tables' => 0, + 'inserts' => 0, + 'table_dups' => 0, + 'insert_dups' => 0, + ]; + + // $tables->seek(Maintenance::getCurrentSubStep()); + foreach ($install_tables as $tbl) { + if (in_array(Config::$db_prefix . $tbl->name, $existing_tables)) { + continue; + } + + $original_table = $tbl->name; + $tbl->name = Config::$db_prefix . $tbl->name; + + try + { + $result = $tbl->create(); + + if ($result) { + Maintenance::$context['sql_results']['tables']++; + } else { + Maintenance::$context['failures'][] = trim(Db::$db->error(Db::$db->connection)); + } + } + catch (Exception $exception) + { + Maintenance::$context['failures'][] = trim($exception->getMessage()); + } + + try + { + if (!empty($tbl->initial_data)) { + foreach ($tbl->initial_data as &$col) { + foreach ($col as $key => &$value) { + if (is_string($value)) { + $value = strtr($value, $replaces); + } else if (isset($tbl->initial_columns[$key])) { + switch ($tbl->initial_columns[$key]) { + case 'int': + $value = (int) $value; + break; + default: + $value = (string) $value; + } + } + } + } + + $result = Db::$db->insert( + 'replace', + $tbl->name, + $tbl->initial_columns, + $tbl->initial_data, + array_keys($tbl->initial_columns), + ); + + if ($result || $result === null) { + Maintenance::$context['sql_results']['tables']++; + } else { + Maintenance::$context['failures'][] = trim(Db::$db->error(Db::$db->connection)); + } + } + } + catch (Exception $exception) + { + Maintenance::$context['failures'][] = trim($exception->getMessage()); + } + + // Wait, wait, I'm still working here! + Sapi::setTimeLimit(60); + } + + // Sort out the context for the SQL. + foreach (Maintenance::$context['sql_results'] as $key => $number) { + if ($number === 0) { + unset(Maintenance::$context['sql_results'][$key]); + } else { + Maintenance::$context['sql_results'][$key] = sprintf(Lang::$txt['db_populate_' . $key], $number); + } + } + + // Make sure UTF will be used globally. + $newSettings['global_character_set'] = 'UTF-8'; + + $this->togglleSmStats($newSettings); + + // Are we enabling SSL? + if (!empty($_POST['force_ssl'])) { + $newSettings['force_ssl'] = 1; + } + + // Setting a timezone is required. + $newSettings['default_timezone'] = $this->determineTimezone() ?? 'UTC'; + + if (!empty($newSettings)) { + Config::updateModSettings($newSettings); + } + + // Setup Smieys. + $this->populateSmileys(); + + // Let's optimize those new tables, but not on InnoDB, ok? (SMF will check this) + $install_tables->rewind(); + foreach ($install_tables as $tbl) { + $tbl->name = Config::$db_prefix . $tbl->name; + + try + { + if (!(Db::$db->optimize_table($tbl->name) > -1)) { + Maintenance::$context['failures'][] = Db::$db->error(Db::$db->connection); + } + } + catch (Exception $exception) + { + Maintenance::$context['failures'][] = $exception->getMessage(); + } + } + + // Find out if we have permissions we didn't use, but will need for the future. + // @@ TODO: This was at this location in the original code, it should come earlier. + $db = $this->getMaintenanceDatabase(Config::$db_type); + + if (!$db->hasPermissions()) { + Maintenance::$fatal_error = Lang::$txt['error_db_alter_priv']; + } + + // Was this a refresh? + if (count($existing_tables) > 0) { + $this->page_title = Lang::$txt['user_refresh_install']; + Maintenance::$context['was_refresh'] = true; + } + + return false; + } + + public function AdminAccount(): bool + { + Maintenance::$context['continue'] = true; + + // Skipping? + if (!empty($_POST['skip'])) { + return true; + } + + // Need this to check whether we need the database password. + Config::load(); + $this->loadDatabase(); + + $settingsDefs = Config::getSettingsDefs(); + + // Reload $modSettings. + Config::reloadModSettings(); + + Maintenance::$context['username'] = htmlspecialchars($_POST['username'] ?? ''); + Maintenance::$context['email'] = htmlspecialchars($_POST['email'] ?? ''); + Maintenance::$context['server_email'] = htmlspecialchars($_POST['server_email'] ?? ''); + + Maintenance::$context['require_db_confirm'] = empty(Config::$db_type); + + // Only allow skipping if we think they already have an account setup. + $request = Db::$db->query( + '', + 'SELECT id_member + FROM {db_prefix}members + WHERE id_group = {int:admin_group} OR FIND_IN_SET({int:admin_group}, additional_groups) != 0 + LIMIT 1', + [ + 'db_error_skip' => true, + 'admin_group' => 1, + ], + ); + + if (Db::$db->num_rows($request) != 0) { + Maintenance::$context['skip'] = true; + return false; + } + Db::$db->free_result($request); + + // Trying to create an account? + if (!isset($_POST['password1']) || empty($_POST['contbutt'])) { + return false; + } + + $_POST['username'] ??= ''; + $_POST['email'] ??= ''; + $_POST['password2'] ??= ''; + $_POST['password3'] ??= ''; + + // Wrong password? + if (Maintenance::$context['require_db_confirm'] && $_POST['password3'] != Config::$db_passwd) { + Maintenance::$fatal_error = Lang::$txt['error_db_connect']; + + return false; + } + + // Not matching passwords? + if ($_POST['password1'] != $_POST['password2']) { + Maintenance::$fatal_error = Lang::$txt['error_user_settings_again_match']; + + return false; + } + + // No password? + if (strlen($_POST['password1']) < 4) { + Maintenance::$fatal_error = Lang::$txt['error_user_settings_no_password']; + + return false; + } + + if (!file_exists(Config::$sourcedir . '/Utils.php')) { + Maintenance::$fatal_error = sprintf(Lang::$txt['error_sourcefile_missing'], 'Utils.php'); + + return false; + } + + // Update the webmaster's email? + if (!empty($_POST['server_email']) && (empty(Config::$webmaster_email) || Config::$webmaster_email == $settingsDefs['webmaster_email']['default'])) { + $this->updateSettingsFile(['webmaster_email' => (string) $_POST['server_email']]); + } + + // Work out whether we're going to have dodgy characters and remove them. + $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; + $_POST['username'] = preg_replace('~[<>&"\'=\\\]~', '', $_POST['username']); + + $result = Db::$db->query( + '', + 'SELECT id_member, password_salt + FROM {db_prefix}members + WHERE member_name = {string:username} OR email_address = {string:email} + LIMIT 1', + [ + 'username' => $_POST['username'], + 'email' => $_POST['email'], + 'db_error_skip' => true, + ], + ); + + if (Db::$db->num_rows($result) != 0) { + list(Maintenance::$context['member_id'], Maintenance::$context['member_salt']) = Db::$db->fetch_row($result); + Db::$db->free_result($result); + + Maintenance::$context['account_existed'] = Lang::$txt['error_user_settings_taken']; + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) { + // Try the previous step again. + Maintenance::$fatal_error = $_POST['username'] == '' ? Lang::$txt['error_username_left_empty'] : Lang::$txt['error_username_too_long']; + + return false; + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) { + // Try the previous step again. + Maintenance::$fatal_error = Lang::$txt['error_invalid_characters_username']; + + return false; + } elseif (empty($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) || strlen($_POST['email']) > 255) { + // One step back, this time fill out a proper admin email address. + Maintenance::$fatal_error = sprintf(Lang::$txt['error_valid_admin_email_needed'], $_POST['username']); + + return false; + } elseif (empty($_POST['server_email']) || !filter_var($_POST['server_email'], FILTER_VALIDATE_EMAIL) || strlen($_POST['server_email']) > 255) { + // One step back, this time fill out a proper admin email address. + Maintenance::$fatal_error = Lang::$txt['error_valid_server_email_needed']; + + return false; + } elseif ($_POST['username'] != '') { + Maintenance::$context['member_salt'] = bin2hex(random_bytes(16)); + + // Format the username properly. + $_POST['username'] = preg_replace('~[\t\n\r\x0B\0\xA0]+~', ' ', $_POST['username']); + $ip = isset($_SERVER['REMOTE_ADDR']) ? substr($_SERVER['REMOTE_ADDR'], 0, 255) : ''; + + $_POST['password1'] = Security::hashPassword($_POST['username'], $_POST['password1']); + + try + { + Maintenance::$context['member_id'] = Db::$db->insert( + '', + Db::$db->prefix . 'members', + [ + 'member_name' => 'string-25', + 'real_name' => 'string-25', + 'passwd' => 'string', + 'email_address' => 'string', + 'id_group' => 'int', + 'posts' => 'int', + 'date_registered' => 'int', + 'password_salt' => 'string', + 'lngfile' => 'string', + 'personal_text' => 'string', + 'avatar' => 'string', + 'member_ip' => 'inet', + 'member_ip2' => 'inet', + 'buddy_list' => 'string', + 'pm_ignore_list' => 'string', + 'website_title' => 'string', + 'website_url' => 'string', + 'signature' => 'string', + 'usertitle' => 'string', + 'secret_question' => 'string', + 'additional_groups' => 'string', + 'ignore_boards' => 'string', + ], + [ + $_POST['username'], + $_POST['username'], + $_POST['password1'], + $_POST['email'], + 1, + 0, + time(), + Maintenance::$context['member_salt'], + '', + '', + '', + $ip, + $ip, + '', + '', + '', + '', + '', + '', + '', + '', + '', + ], + ['id_member'], + 1, + ); + + if ((int) Maintenance::$context['member_id'] > 0) { + return true; + } else { + Maintenance::$fatal_error = trim(Db::$db->error(Db::$db->connection)); + return false; + } + } + catch (Exception $exception) + { + Maintenance::$fatal_error = $exception->getMessage(); + var_dump(Maintenance::$fatal_error); + } + } + + return false; + } + + public function DeleteInstall(): bool + { + Maintenance::$context['continue'] = false; + + Config::load(); + $this->loadDatabase(); + + chdir(Config::$boarddir); + + // Reload $modSettings. + Config::reloadModSettings(); + + // Bring a warning over. + if (!empty(Maintenance::$context['account_existed'])) { + Maintenance::$warnings = Maintenance::$context['account_existed']; + } + + Db::$db->query( + '', + 'SET NAMES {string:db_character_set}', + [ + 'db_character_set' => Config::$db_character_set, + 'db_error_skip' => true, + ], + ); + + // As track stats is by default enabled let's add some activity. + Db::$db->insert( + 'ignore', + '{db_prefix}log_activity', + ['date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'], + [Time::strftime('%Y-%m-%d', time()), 1, 1, (!empty(Maintenance::$context['member_id']) ? 1 : 0)], + ['date'], + ); + + // We're going to want our lovely Config::$modSettings now. + $request = Db::$db->query( + '', + 'SELECT variable, value + FROM {db_prefix}settings', + [ + 'db_error_skip' => true, + ], + ); + + // Only proceed if we can load the data. + if ($request) { + while ($row = Db::$db->fetch_row($request)) { + Config::$modSettings[$row[0]] = $row[1]; + } + Db::$db->free_result($request); + } + + + // Automatically log them in ;) + if (isset(Maintenance::$context['member_id'], Maintenance::$context['member_salt'])) { + Cookie::setLoginCookie(3153600 * 60, Maintenance::$context['member_id'], Cookie::encrypt($_POST['password1'], Maintenance::$context['member_salt'])); + } + + $result = Db::$db->query( + '', + 'SELECT value + FROM {db_prefix}settings + WHERE variable = {string:db_sessions}', + [ + 'db_sessions' => 'databaseSession_enable', + 'db_error_skip' => true, + ], + ); + + if (Db::$db->num_rows($result) != 0) { + list($db_sessions) = Db::$db->fetch_row($result); + } + Db::$db->free_result($result); + + if (empty($db_sessions)) { + $_SESSION['admin_time'] = time(); + } else { + $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); + + Db::$db->insert( + 'replace', + '{db_prefix}sessions', + [ + 'session_id' => 'string', 'last_update' => 'int', 'data' => 'string', + ], + [ + session_id(), time(), 'USER_AGENT|s:' . strlen($_SERVER['HTTP_USER_AGENT']) . ':"' . $_SERVER['HTTP_USER_AGENT'] . '";admin_time|i:' . time() . ';', + ], + ['session_id'], + ); + } + + + Logging::updateStats('member'); + Logging::updateStats('message'); + Logging::updateStats('topic'); + + $request = Db::$db->query( + '', + 'SELECT id_msg + FROM {db_prefix}messages + WHERE id_msg = 1 + AND modified_time = 0 + LIMIT 1', + [ + 'db_error_skip' => true, + ], + ); + Utils::$context['utf8'] = true; + + if (Db::$db->num_rows($request) > 0) { + Logging::updateStats('subject', 1, htmlspecialchars(Lang::$txt['default_topic_subject'])); + } + Db::$db->free_result($request); + + // Now is the perfect time to fetch the SM files. + // Sanity check that they loaded earlier! + if (isset(Config::$modSettings['recycle_board'])) { + (new TaskRunner())->runScheduledTasks(['fetchSMfiles']); // Now go get those files! + + // We've just installed! + $_SERVER['BAN_CHECK_IP'] = $_SERVER['REMOTE_ADDR']; + if (isset(Maintenance::$context['member_id'])) { + User::setMe(Maintenance::$context['member_id']); + } else { + User::load(); + } + + User::$me->ip = $_SERVER['REMOTE_ADDR']; + + Logging::logAction('install', ['version' => SMF_FULL_VERSION], 'admin'); + } + + // Disable the legacy BBC by default for new installs + Config::updateModSettings([ + 'disabledBBC' => implode(',', Utils::$context['legacy_bbc']), + ]); + + // Some final context for the template. + Maintenance::$context['dir_still_writable'] = is_writable(Config::$boarddir) && substr(__FILE__, 1, 2) != ':\\'; + Maintenance::$context['probably_delete_install'] = isset($_SESSION['installer_temp_ftp']) || is_writable(Config::$boarddir) || is_writable(__FILE__); + + // Update hash's cost to an appropriate setting + Config::updateModSettings([ + 'bcrypt_hash_cost' => Security::hashBenchmark(), + ]); + + return false; + } + + // Create an .htaccess file to prevent mod_security. SMF has filtering built-in. + private function checkAndTryToFixModSecurity(): bool + { + $htaccess_addition = ' + + # Turn off mod_security filtering. SMF is a big boy, it doesn\'t need its hands held. + SecFilterEngine Off + + # The below probably isn\'t needed, but better safe than sorry. + SecFilterScanPOST Off + '; + + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { + return true; + } + + if (file_exists(Config::$boarddir . '/.htaccess') && is_writable(Config::$boarddir . '/.htaccess')) { + $current_htaccess = implode('', file(Config::$boarddir . '/.htaccess')); + + // Only change something if mod_security hasn't been addressed yet. + if (strpos($current_htaccess, '') === false) { + if ($ht_handle = fopen(Config::$boarddir . '/.htaccess', 'a')) { + fwrite($ht_handle, $htaccess_addition); + fclose($ht_handle); + + return true; + } + + return false; + } + + return true; + } + + if (file_exists(Config::$boarddir . '/.htaccess')) { + return strpos(implode('', file(Config::$boarddir . '/.htaccess')), '') !== false; + } + + if (is_writable(Config::$boarddir)) { + if ($ht_handle = fopen(Config::$boarddir . '/.htaccess', 'w')) { + fwrite($ht_handle, $htaccess_addition); + fclose($ht_handle); + + return true; + } + + return false; + } + + return false; + } + + private function createCookieName(string $db_name, string $db_prefix) { + return 'SMFCookie' . abs(crc32($db_name . preg_replace('~[^A-Za-z0-9_$]~', '', $db_prefix)) % 1000); + } + + private function createAuthSecret() { + return bin2hex(random_bytes(32)); + } + + private function createImageProxySecret() { + return bin2hex(random_bytes(10)); + } + private function updateSettingsFile($vars, $rebuild = false): bool + { + if (!is_writable(SMF_SETTINGS_FILE)) { + @chmod(SMF_SETTINGS_FILE, 0777); + + if (!is_writable(SMF_SETTINGS_FILE)) { + return false; + } + } + + return Config::updateSettingsFile($vars, false, $rebuild); + } + + private function loadDatabase(): void + { + // Connect the database. + if (empty(Db::$db->connection)) { + Db::load(); + } + } + + private function getMaintenanceDatabase(string $db_type): DatabaseInterface + { + /** @var \SMF\Maintenance\DatabaseInterface $db_class */ + $db_class = '\\SMF\\Maintenance\\Database\\' . $db_type; + require_once Config::$sourcedir . '/Maintenance/Database/' . $db_type . '.php'; + return new $db_class(); + } + + private function defaultHost(): string + { + return empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']; + } + + private function cleanBoardUrl(string $boardurl): string + { + if (substr($boardurl, -10) == '/index.php') { + $boardurl = substr($boardurl, 0, -10); + } elseif (substr($boardurl, -1) == '/') { + $boardurl = substr($boardurl, 0, -1); + } + + if (substr($boardurl, 0, 7) != 'http://' && substr($boardurl, 0, 7) != 'file://' && substr($boardurl, 0, 8) != 'https://') { + $boardurl = 'http://' . $boardurl; + } + + // Make sure boardurl is aligned with ssl setting + if (empty($_POST['force_ssl'])) { + $boardurl = strtr($boardurl, ['https://' => 'http://']); + } else { + $boardurl = strtr($boardurl, ['http://' => 'https://']); + } + + // Make sure international domain names are normalized correctly. + if (Lang::$txt['lang_character_set'] == 'UTF-8') { + $boardurl = (string) new Url($boardurl, true); + } + + return $boardurl; + } + + /** + * + * @return \ArrayIterator|\SMF\Db\Schema\Table[] + */ + private function getTables(string $base_directory, string $schema_version): \ArrayIterator + { + $files = []; + + foreach (new \DirectoryIterator($base_directory . '/' . $schema_version) as $fileInfo) { + if ($fileInfo->isDot() || $fileInfo->isDir() || $fileInfo->getExtension() !== 'php' || $fileInfo->getFilename() == 'index.php') { + continue; + } + $tbl = $fileInfo->getBasename('.' . $fileInfo->getExtension()); + + /** @var \SMF\Db\Schema\Table $tbl_class */ + $tbl_class = '\\SMF\\Db\\Schema\\' . $schema_version . '\\' . $tbl; + require_once Config::$sourcedir . '/Db/Schema/' . $schema_version . '/' . $fileInfo->getFilename(); + $files[$tbl] = new $tbl_class(); + } + + ksort($files); + + return new \ArrayIterator($files); + } + + private function togglleSmStats(array &$settings): void { + if (!empty($_POST['stats']) && substr(Config::$boardurl, 0, 16) != 'http://localhost' && empty(Config::$modSettings['allow_sm_stats']) && empty(Config::$modSettings['enable_sm_stats'])) { + Maintenance::$context['allow_sm_stats'] = true; + + // Attempt to register the site etc. + $fp = @fsockopen('www.simplemachines.org', 443, $errno, $errstr); + + if (!$fp) { + $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); + } + + if (!$fp) { + return; + } + + $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode(Config::$boardurl) . ' HTTP/1.1' . "\r\n"; + $out .= 'Host: www.simplemachines.org' . "\r\n"; + $out .= 'Connection: Close' . "\r\n\r\n"; + fwrite($fp, $out); + + $return_data = ''; + + while (!feof($fp)) { + $return_data .= fgets($fp, 128); + } + + fclose($fp); + + // Get the unique site ID. + preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); + + if (!empty($ID[1])) { + $settings['sm_stats_key'] = $ID[1]; + $settings['enable_sm_stats'] = 1; + } + } + // Don't remove stat collection unless we unchecked the box for real, not from the loop. + elseif (empty($_POST['stats']) && empty(Maintenance::$context['allow_sm_stats'])) { + $settings[] =['enable_sm_stats', null]; + } + } + + private function determineTimezone(): ?string { + if (isset(Config::$modSettings['default_timezone']) || !function_exists('date_default_timezone_set')) { + return null; + } + + // Get PHP's default timezone, if set + $ini_tz = ini_get('date.timezone'); + + if (!empty($ini_tz)) { + $timezone_id = $ini_tz; + } else { + $timezone_id = ''; + } + + // If date.timezone is unset, invalid, or just plain weird, make a best guess + if (!in_array($timezone_id, timezone_identifiers_list())) { + $server_offset = @mktime(0, 0, 0, 1, 1, 1970) * -1; + $timezone_id = timezone_name_from_abbr('', $server_offset, 0); + + if (empty($timezone_id)) { + $timezone_id = 'UTC'; + } + } + + if (date_default_timezone_set($timezone_id)) { + return $timezone_id; + } + + return null; + } + + private function populateSmileys(): void { + // Populate the smiley_files table. + // Can't just dump this data in the SQL file because we need to know the id for each smiley. + $smiley_filenames = [ + ':)' => 'smiley', + ';)' => 'wink', + ':D' => 'cheesy', + ';D' => 'grin', + '>:(' => 'angry', + ':(' => 'sad', + ':o' => 'shocked', + '8)' => 'cool', + '???' => 'huh', + '::)' => 'rolleyes', + ':P' => 'tongue', + ':-[' => 'embarrassed', + ':-X' => 'lipsrsealed', + ':-\\' => 'undecided', + ':-*' => 'kiss', + ':\'(' => 'cry', + '>:D' => 'evil', + '^-^' => 'azn', + 'O0' => 'afro', + ':))' => 'laugh', + 'C:-)' => 'police', + 'O:-)' => 'angel', + ]; + $smiley_set_extensions = ['fugue' => '.png', 'alienine' => '.png']; + + $smiley_inserts = []; + $request = Db::$db->query( + '', + 'SELECT id_smiley, code + FROM {db_prefix}smileys', + [], + ); + + while ($row = Db::$db->fetch_assoc($request)) { + foreach ($smiley_set_extensions as $set => $ext) { + $smiley_inserts[] = [$row['id_smiley'], $set, $smiley_filenames[$row['code']] . $ext]; + } + } + Db::$db->free_result($request); + + Db::$db->insert( + 'ignore', + '{db_prefix}smiley_files', + ['id_smiley' => 'int', 'smiley_set' => 'string-48', 'filename' => 'string-48'], + $smiley_inserts, + ['id_smiley', 'smiley_set'], + ); + + } +} diff --git a/Sources/Maintenance/ToolsBase.php b/Sources/Maintenance/ToolsBase.php new file mode 100644 index 0000000000..5b5c12509d --- /dev/null +++ b/Sources/Maintenance/ToolsBase.php @@ -0,0 +1,137 @@ + 0) { + return $languages; + } else if (!file_exists(Config::$languagesdir)) { + return $languages; + } + + $dir = dir(Config::$languagesdir); + + while ($entry = $dir->read()) { + if (!is_dir(Config::$languagesdir . '/' . $entry)) { + continue; + } + + // Skip if we don't have all the key files. + foreach ($key_files as $file) { + if (!file_exists(Config::$languagesdir . '/' . $entry . '/' . $file . '.php')) { + continue 2; + } + } + + $fp = @fopen(Config::$languagesdir . '/' . $entry . '/' . 'General.php', 'r'); + + // Yay! + if ($fp) + { + while (($line = fgets($fp)) !== false) + { + if (strpos($line, '$txt[\'native_name\']') === false) + continue; + + preg_match('~\$txt\[\'native_name\'\]\s*=\s*\'([^\']+)\';~', $line, $matchNative); + + // Set the language's name. + if (!empty($matchNative) && !empty($matchNative[1])) + { + // Don't mislabel the language if the translator missed this one. + if ($entry !== 'en_US' && $matchNative[1] === 'English (US)') + break; + + $langName = Utils::htmlspecialcharsDecode($matchNative[1]); + break; + } + } + + fclose($fp); + } + + $languages[$entry] = $langName ?? $entry; + } + + return $languages; + } + + public function supportedDatabases(): array + { + static $dbs = []; + + if (count($dbs) > 0) { + return $dbs; + } + + if (!file_exists(Config::$sourcedir . '/Maintenance/Database/') || !file_exists(Config::$sourcedir . '/Db/APIs')) { + return $dbs; + } + + $dir = dir(Config::$sourcedir . '/Maintenance/Database/'); + + while ($entry = $dir->read()) { + if (is_dir(Config::$languagesdir . '/' . $entry) || $entry == 'index.php' || substr($entry, -3) !== 'php') { + continue; + } + + /** @var \SMF\Maintenance\DatabaseInterface $db_class */ + $db_class = '\\SMF\\Maintenance\\Database\\' . substr($entry, 0, -4); + require_once Config::$sourcedir . '/Maintenance/Database/' . $entry; + $db = new $db_class(); + + if (!$db->isSupported()) { + continue; + } + + $dbs[substr($entry, 0, -4)] = $db; + } + + return $dbs; + } + + final public function deleteTool(): void + { + if (!empty($this->script_name) && file_exists(Config::$boarddir . '/' . $this->script_name)) { + if (!empty($_SESSION['ftp'])) { + $ftp = new FtpConnection($_SESSION['ftp']['server'], $_SESSION['ftp']['port'], $_SESSION['ftp']['username'], $_SESSION['ftp']['password']); + $ftp->chdir($_SESSION['ftp']['path']); + $ftp->unlink($this->script_name); + $ftp->close(); + + unset($_SESSION['ftp']); + } else { + @unlink(Config::$boarddir . '/' . $this->script_name); + } + + // Now just redirect to a blank.png... + header('location: http' . (Sapi::httpsOn() ? 's' : '') . '://' . ($_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/Themes/default/images/blank.png'); + } + } +} \ No newline at end of file diff --git a/Sources/Maintenance/ToolsInterface.php b/Sources/Maintenance/ToolsInterface.php new file mode 100644 index 0000000000..f68ca8d06d --- /dev/null +++ b/Sources/Maintenance/ToolsInterface.php @@ -0,0 +1,31 @@ +Error!Sorry, this installer requires PHP!
-if (!defined('SMF')) { +/* + * 1. Define some constants we need. + */ + + if (!defined('SMF')) { define('SMF', 1); } -// Let's pull in useful classes -require_once 'Sources/Autoloader.php'; - -// Get the current settings, without affecting global namespace. -Config::$backward_compatibility = false; -Config::load(); -Config::$backward_compatibility = true; - -Utils::load(); - -require_once Config::$sourcedir . '/Subs-Compat.php'; - -// Database info. -$databases = [ - 'mysql' => [ - 'name' => 'MySQL', - 'version' => '8.0.35', - 'version_check' => function () { - if (!function_exists('mysqli_fetch_row')) { - return false; - } - - return mysqli_fetch_row(mysqli_query(Db::$db->connection, 'SELECT VERSION();'))[0]; - }, - 'supported' => function_exists('mysqli_connect'), - 'default_user' => 'mysql.default_user', - 'default_password' => 'mysql.default_password', - 'default_host' => 'mysql.default_host', - 'default_port' => 'mysql.default_port', - 'utf8_support' => function () { - return true; - }, - 'utf8_version' => '5.0.22', - 'utf8_version_check' => function () { - return mysqli_get_server_info(Db::$db->connection); - }, - 'alter_support' => true, - 'validate_prefix' => function (&$value) { - $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); - - return true; - }, - ], - 'postgresql' => [ - 'name' => 'PostgreSQL', - 'version' => '12.17', - 'version_check' => function () { - $request = pg_query(Db::$db->connection, 'SELECT version()'); - list($version) = pg_fetch_row($request); - list($pgl, $version) = explode(' ', $version); - - return $version; - }, - 'supported' => function_exists('pg_connect'), - 'always_has_db' => true, - 'utf8_support' => function () { - $request = pg_query(Db::$db->connection, 'SHOW SERVER_ENCODING'); - - list($charcode) = pg_fetch_row($request); - - return (bool) ($charcode == 'UTF8'); - }, - 'utf8_version' => '8.0', - 'utf8_version_check' => function () { - $request = pg_query(Db::$db->connection, 'SELECT version()'); - list($version) = pg_fetch_row($request); - list($pgl, $version) = explode(' ', $version); - - return $version; - }, - 'validate_prefix' => function (&$value) { - $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); - - // Is it reserved? - if ($value == 'pg_') { - return Lang::$txt['error_db_prefix_reserved']; - } +if (!defined('SMF_VERSION')) { + define('SMF_VERSION', '3.0 Alpha 1'); +} - // Is the prefix numeric? - if (preg_match('~^\d~', $value)) { - return Lang::$txt['error_db_prefix_numeric']; - } +if (!defined('SMF_FULL_VERSION')) { + define('SMF_FULL_VERSION', 'SMF ' . SMF_VERSION); +} - return true; - }, - ], -]; +if (!defined('SMF_SOFTWARE_YEAR')) { + define('SMF_SOFTWARE_YEAR', '2024'); +} -// Initialize everything and load the language files. -initialize_inputs(); -load_lang_file(); +if (!defined('JQUERY_VERSION')) { + define('JQUERY_VERSION', '3.6.3'); +} -// This is what we are. -$installurl = $_SERVER['PHP_SELF']; +if (!defined('POSTGRE_TITLE')) { + define('POSTGRE_TITLE', 'PostgreSQL'); +} -// All the steps in detail. -// Number,Name,Function,Progress Weight. -$incontext['steps'] = [ - 0 => [1, Lang::$txt['install_step_welcome'], 'Welcome', 0], - 1 => [2, Lang::$txt['install_step_writable'], 'CheckFilesWritable', 10], - 2 => [3, Lang::$txt['install_step_databaseset'], 'DatabaseSettings', 15], - 3 => [4, Lang::$txt['install_step_forum'], 'ForumSettings', 40], - 4 => [5, Lang::$txt['install_step_databasechange'], 'DatabasePopulation', 15], - 5 => [6, Lang::$txt['install_step_admin'], 'AdminAccount', 20], - 6 => [7, Lang::$txt['install_step_delete'], 'DeleteInstall', 0], -]; +if (!defined('MYSQL_TITLE')) { + define('MYSQL_TITLE', 'MySQL'); +} -// Default title... -$incontext['page_title'] = Lang::$txt['smf_installer']; +if (!defined('SMF_USER_AGENT')) { + define('SMF_USER_AGENT', 'Mozilla/5.0 (' . php_uname('s') . ' ' . php_uname('m') . ') AppleWebKit/605.1.15 (KHTML, like Gecko) SMF/' . strtr(SMF_VERSION, ' ', '.')); +} -// What step are we on? -$incontext['current_step'] = isset($_GET['step']) ? (int) $_GET['step'] : 0; +if (!defined('TIME_START')) { + define('TIME_START', microtime(true)); +} -// Loop through all the steps doing each one as required. -$incontext['overall_percent'] = 0; +DEFINE('SMF_SETTINGS_FILE', __DIR__ . '/NewSettings.php'); -foreach ($incontext['steps'] as $num => $step) { - if ($num >= $incontext['current_step']) { - // The current weight of this step in terms of overall progress. - $incontext['step_weight'] = $step[3]; - // Make sure we reset the skip button. - $incontext['skip'] = false; +if (!defined('SMF_SETTINGS_FILE')) { + define('SMF_SETTINGS_FILE', __DIR__ . '/Settings.php'); +} - // Call the step and if it returns false that means pause! - if (function_exists($step[2]) && $step[2]() === false) { - break; - } +if (!defined('SMF_SETTINGS_BACKUP_FILE')) { + define('SMF_SETTINGS_BACKUP_FILE', dirname(SMF_SETTINGS_FILE) . '/' . pathinfo(SMF_SETTINGS_FILE, PATHINFO_FILENAME) . '_bak.php'); +} - if (function_exists($step[2])) { - $incontext['current_step']++; - } +/* + * 2. Load the Settings.php file. + */ - // No warnings pass on. - $incontext['warning'] = ''; - } - $incontext['overall_percent'] += $step[3]; +if (!is_file(SMF_SETTINGS_FILE) || !is_readable(SMF_SETTINGS_FILE)) { + die('File not readable: ' . basename(SMF_SETTINGS_FILE)); } -// Actually do the template stuff. -installExit(); - -function initialize_inputs() -{ - global $databases; +// Don't load it twice. +if (in_array(SMF_SETTINGS_FILE, get_included_files())) { + return; +} - // Just so people using older versions of PHP aren't left in the cold. - if (!isset($_SERVER['PHP_SELF'])) { - $_SERVER['PHP_SELF'] = $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] ?? 'install.php'; - } +define('SMF_INSTALLING', 1); +// If anything goes wrong loading Settings.php, make sure the admin knows it. +if (SMF === 1) { // In pre-release versions, report all errors. if (strspn(SMF_VERSION, '1234567890.') !== strlen(SMF_VERSION)) { error_reporting(E_ALL); @@ -210,2340 +103,46 @@ function initialize_inputs() error_reporting(E_ALL & ~E_DEPRECATED); } - // Fun. Low PHP version... - if (!isset($_GET)) { - $GLOBALS['_GET']['step'] = 0; - - return; - } - - if (!isset($_GET['obgz'])) { - ob_start(); - - if (ini_get('session.save_handler') == 'user') { - @ini_set('session.save_handler', 'files'); - } - - if (function_exists('session_start')) { - @session_start(); - } - } else { - ob_start('ob_gzhandler'); - - if (ini_get('session.save_handler') == 'user') { - @ini_set('session.save_handler', 'files'); - } - session_start(); - - if (!headers_sent()) { - echo ' - - - ', htmlspecialchars($_GET['pass_string']), ' - - - ', htmlspecialchars($_GET['pass_string']), ' - -'; - } - - exit; - } - - // This is really quite simple; if ?delete is on the URL, delete the installer... - if (isset($_GET['delete'])) { - if (isset($_SESSION['installer_temp_ftp'])) { - $ftp = new FtpConnection($_SESSION['installer_temp_ftp']['server'], $_SESSION['installer_temp_ftp']['port'], $_SESSION['installer_temp_ftp']['username'], $_SESSION['installer_temp_ftp']['password']); - $ftp->chdir($_SESSION['installer_temp_ftp']['path']); - - $ftp->unlink('install.php'); - - foreach ($databases as $key => $dummy) { - $type = ($key == 'mysqli') ? 'mysql' : $key; - $ftp->unlink('install_' . DB_SCRIPT_VERSION . '_' . Db::getClass($type) . '.sql'); - } - - $ftp->close(); - - unset($_SESSION['installer_temp_ftp']); - } else { - @unlink(__FILE__); - - foreach ($databases as $key => $dummy) { - $type = ($key == 'mysqli') ? 'mysql' : $key; - @unlink(Config::$boarddir . '/install_' . DB_SCRIPT_VERSION . '_' . Db::getClass($type) . '.sql'); - } - } - - // Now just redirect to a blank.png... - $secure = false; - - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $secure = true; - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { - $secure = true; - } - - header('location: http' . ($secure ? 's' : '') . '://' . ($_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) . dirname($_SERVER['PHP_SELF']) . '/Themes/default/images/blank.png'); - - exit; - } - - // PHP 5 might cry if we don't do this now. - if (function_exists('date_default_timezone_set')) { - // Get PHP's default timezone, if set - $ini_tz = ini_get('date.timezone'); - - if (!empty($ini_tz)) { - $timezone_id = $ini_tz; - } else { - $timezone_id = ''; - } - - // If date.timezone is unset, invalid, or just plain weird, make a best guess - if (!in_array($timezone_id, timezone_identifiers_list())) { - $server_offset = @mktime(0, 0, 0, 1, 1, 1970) * -1; - $timezone_id = timezone_name_from_abbr('', $server_offset, 0); - - if (empty($timezone_id)) { - $timezone_id = 'UTC'; - } - } - - date_default_timezone_set($timezone_id); - } - header('X-Frame-Options: SAMEORIGIN'); - header('X-XSS-Protection: 1'); - header('X-Content-Type-Options: nosniff'); - - // Force an integer step, defaulting to 0. - $_GET['step'] = (int) @$_GET['step']; -} - -// Load the list of language files, and the current language file. -function load_lang_file() -{ - global $incontext; - - $incontext['detected_languages'] = []; - - // Make sure the languages directory actually exists. - if (file_exists(Config::$languagesdir)) { - // Find all the "Install" language files in the directory. - $dir = dir(Config::$languagesdir); - - while ($entry = $dir->read()) { - if (!is_dir(Config::$languagesdir . '/' . $entry) || !file_exists(Config::$languagesdir . '/' . $entry . '/' . 'Install.php') || !file_exists(Config::$languagesdir . '/' . $entry . '/' . 'General.php')) { - continue; - } - - // Get the line we need. - $fp = @fopen(Config::$languagesdir . '/' . $entry . '/' . 'General.php', 'r'); - - // Yay! - if ($fp) - { - while (($line = fgets($fp)) !== false) - { - if (strpos($line, '$txt[\'native_name\']') === false) - continue; - - preg_match('~\$txt\[\'native_name\'\]\s*=\s*\'([^\']+)\';~', $line, $matchNative); - - // Set the language's name. - if (!empty($matchNative) && !empty($matchNative[1])) - { - // Don't mislabel the language if the translator missed this one. - if ($entry !== 'en_US' && $matchNative[1] === 'English (US)') - break; - - $langName = Utils::htmlspecialcharsDecode($matchNative[1]); - break; - } - } - - fclose($fp); - } - - $incontext['detected_languages'][$entry] = $langName ?? $entry; - } - $dir->close(); - } - - // Didn't find any, show an error message! - if (empty($incontext['detected_languages'])) { - // Let's not cache this message, eh? - header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('cache-control: no-cache'); - - echo ' - - - SMF Installer: Error! - - - -

A critical error has occurred.

- -

This installer was unable to find the installer\'s language file or files. They should be found under:

- -
', dirname($_SERVER['PHP_SELF']) != '/' ? dirname($_SERVER['PHP_SELF']) : '', '/Languages
- -

In some cases, FTP clients do not properly upload files with this many folders. Please double check to make sure you have uploaded all the files in the distribution.

-

If that doesn\'t help, please make sure this install.php file is in the same place as the Themes folder.

-

If you continue to get this error message, feel free to look to us for support.

-
-'; - - die; - } - - // Override the language file? - if (isset($_GET['lang_file'])) { - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; - } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; - } - - // Make sure it exists, if it doesn't reset it. - if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(Config::$languagesdir . '/' . $_SESSION['installer_temp_lang'] . '/Install.php')) { - // Use the first one... - list($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); - - // If we have english and some other language, use the other language. We Americans hate english :P. - if ($_SESSION['installer_temp_lang'] == 'en_US' && count($incontext['detected_languages']) > 1) { - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); - } - } - - // Which language are we loading? Assume that the admin likes that language. - Config::$language = preg_replace('~^[A-Za-z0-9]+$~', '', $_SESSION['installer_temp_lang']); - - // Ensure SMF\Lang knows the path to the language directory. - Lang::addDirs(Config::$languagesdir); - - // And now load the language file. - Lang::load('Install'); -} - -// This handy function loads some settings and the like. -function load_database() -{ - Config::$modSettings['disableQueryCheck'] = true; - - // Connect the database. - if (empty(Db::$db->connection)) { - Db::load(); - } -} - -// This is called upon exiting the installer, for template etc. -function installExit($fallThrough = false) -{ - global $incontext, $installurl; - - // Send character set. - header('content-type: text/html; charset=' . (Lang::$txt['lang_character_set'] ?? 'UTF-8')); - - // We usually dump our templates out. - if (!$fallThrough) { - // The top install bit. - template_install_above(); - - // Call the template. - if (isset($incontext['sub_template'])) { - $incontext['form_url'] = $installurl . '?step=' . $incontext['current_step']; - - call_user_func('template_' . $incontext['sub_template']); - } - // @todo REMOVE THIS!! - else { - if (function_exists('doStep' . $_GET['step'])) { - call_user_func('doStep' . $_GET['step']); - } - } - // Show the footer. - template_install_below(); - } - - // Bang - gone! - die(); -} - -function Welcome() -{ - global $incontext, $databases, $installurl; - - $incontext['page_title'] = Lang::$txt['install_welcome']; - $incontext['sub_template'] = 'welcome_message'; - - // Done the submission? - if (isset($_POST['contbutt'])) { - return true; - } - - // See if we think they have already installed it? - $probably_installed = 0; - - $settingsDefs = Config::getSettingsDefs(); - - foreach (['db_passwd', 'boardurl'] as $var) { - if (!empty(Config::${$var}) && Config::${$var} != $settingsDefs[$var]['default']) { - $probably_installed++; - } - } - - if ($probably_installed == 2) { - $incontext['warning'] = Lang::$txt['error_already_installed']; - } - - // Is some database support even compiled in? - $incontext['supported_databases'] = []; - - foreach ($databases as $key => $db) { - if ($db['supported']) { - $type = ($key == 'mysqli') ? 'mysql' : $key; - - if (!file_exists(Config::$boarddir . '/install_' . DB_SCRIPT_VERSION . '_' . Db::getClass($type) . '.sql')) { - $databases[$key]['supported'] = false; - $notFoundSQLFile = true; - Lang::$txt['error_db_script_missing'] = Lang::getTxt('error_db_script_missing', ['file' => 'install_' . DB_SCRIPT_VERSION . '_' . Db::getClass($type) . '.sql']); - } else { - $incontext['supported_databases'][] = $db; - } - } - } - - // Check the PHP version. - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>='))) { - $error = 'error_php_too_low'; - } - // Make sure we have a supported database - elseif (empty($incontext['supported_databases'])) { - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; - } - // How about session support? Some crazy sysadmin remove it? - elseif (!function_exists('session_start')) { - $error = 'error_session_missing'; - } - // Make sure they uploaded all the files. - elseif (!file_exists(Config::$boarddir . '/index.php')) { - $error = 'error_missing_files'; - } - // Very simple check on the session.save_path for Windows. - // @todo Move this down later if they don't use database-driven sessions? - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { - $error = 'error_session_save_path'; - } - - // Since each of the three messages would look the same, anyway... - if (isset($error)) { - $incontext['error'] = Lang::$txt[$error]; - } - - // Mod_security blocks everything that smells funny. Let SMF handle security. - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { - $incontext['error'] = Lang::$txt['error_mod_security'] . '

' . Lang::$txt['error_message_click'] . ' ' . Lang::$txt['error_message_bad_try_again']; - } - - // Confirm mbstring is loaded... - if (!extension_loaded('mbstring')) { - $incontext['error'] = Lang::$txt['install_no_mbstring']; - } - - // Confirm fileinfo is loaded... - if (!extension_loaded('fileinfo')) { - $incontext['error'] = Lang::$txt['install_no_fileinfo']; - } - - // Check for https stream support. - $supported_streams = stream_get_wrappers(); - - if (!in_array('https', $supported_streams)) { - $incontext['warning'] = Lang::$txt['install_no_https']; - } - - return false; + ob_start(); } -function CheckFilesWritable() -{ - global $incontext; - - $incontext['page_title'] = Lang::$txt['ftp_checking_writable']; - $incontext['sub_template'] = 'chmod_files'; - - $writable_files = [ - 'attachments', - 'avatars', - 'custom_avatar', - 'cache', - 'Packages', - 'Smileys', - 'Themes', - 'Languages/en_US/agreement.txt', - 'Settings.php', - 'Settings_bak.php', - 'cache/db_last_error.php', - ]; - - foreach ($incontext['detected_languages'] as $lang => $temp) { - $extra_files[] = 'Languages/' . $lang; - } - - // With mod_security installed, we could attempt to fix it with .htaccess. - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { - $writable_files[] = file_exists(Config::$boarddir . '/.htaccess') ? '.htaccess' : '.'; - } - - $failed_files = []; - - // On linux, it's easy - just use is_writable! - if (substr(__FILE__, 1, 2) != ':\\') { - $incontext['systemos'] = 'linux'; - - foreach ($writable_files as $file) { - // Some files won't exist, try to address up front - if (!file_exists(Config::$boarddir . '/' . $file)) { - @touch(Config::$boarddir . '/' . $file); - } - - // NOW do the writable check... - if (!is_writable(Config::$boarddir . '/' . $file)) { - @chmod(Config::$boarddir . '/' . $file, 0755); - - // Well, 755 hopefully worked... if not, try 777. - if (!is_writable(Config::$boarddir . '/' . $file) && !@chmod(Config::$boarddir . '/' . $file, 0777)) { - $failed_files[] = $file; - } - } - } - - foreach ($extra_files as $file) { - @chmod(Config::$boarddir . (empty($file) ? '' : '/' . $file), 0777); - } - } - // Windows is trickier. Let's try opening for r+... - else { - $incontext['systemos'] = 'windows'; - - foreach ($writable_files as $file) { - // Folders can't be opened for write... but the index.php in them can ;) - if (is_dir(Config::$boarddir . '/' . $file)) { - $file .= '/index.php'; - } - - // Funny enough, chmod actually does do something on windows - it removes the read only attribute. - @chmod(Config::$boarddir . '/' . $file, 0777); - $fp = @fopen(Config::$boarddir . '/' . $file, 'r+'); - - // Hmm, okay, try just for write in that case... - if (!is_resource($fp)) { - $fp = @fopen(Config::$boarddir . '/' . $file, 'w'); - } - - if (!is_resource($fp)) { - $failed_files[] = $file; - } - - @fclose($fp); - } - - foreach ($extra_files as $file) { - @chmod(Config::$boarddir . (empty($file) ? '' : '/' . $file), 0777); - } - } - - $failure = count($failed_files) >= 1; - - if (!isset($_SERVER)) { - return !$failure; - } - - // Put the list into context. - $incontext['failed_files'] = $failed_files; - - // It's not going to be possible to use FTP on windows to solve the problem... - if ($failure && substr(__FILE__, 1, 2) == ':\\') { - $incontext['error'] = Lang::$txt['error_windows_chmod'] . ' -
    -
  • ' . implode('
  • -
  • ', $failed_files) . '
  • -
'; - - return false; - } - - // We're going to have to use... FTP! - if ($failure) { - // Load any session data we might have... - if (!isset($_POST['ftp_username']) && isset($_SESSION['installer_temp_ftp'])) { - $_POST['ftp_server'] = $_SESSION['installer_temp_ftp']['server']; - $_POST['ftp_port'] = $_SESSION['installer_temp_ftp']['port']; - $_POST['ftp_username'] = $_SESSION['installer_temp_ftp']['username']; - $_POST['ftp_password'] = $_SESSION['installer_temp_ftp']['password']; - $_POST['ftp_path'] = $_SESSION['installer_temp_ftp']['path']; - } - - $incontext['ftp_errors'] = []; - - if (isset($_POST['ftp_username'])) { - $ftp = new FtpConnection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']); - - if ($ftp->error === false) { - // Try it without /home/abc just in case they messed up. - if (!$ftp->chdir($_POST['ftp_path'])) { - $incontext['ftp_errors'][] = $ftp->last_message; - $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path'])); - } - } - } - - if (!isset($ftp) || $ftp->error !== false) { - if (!isset($ftp)) { - $ftp = new FtpConnection(null); - } - // Save the error so we can mess with listing... - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { - $incontext['ftp_errors'][] = $ftp->last_message; - } +// This is wrapped in a closure to keep the global namespace clean. +call_user_func(function () { + require_once SMF_SETTINGS_FILE; - list($username, $detect_path, $found_path) = $ftp->detect_path(Config::$boarddir); + // Ensure $sourcedir is valid. + $sourcedir = rtrim($sourcedir, '\\/'); - if (empty($_POST['ftp_path']) && $found_path) { - $_POST['ftp_path'] = $detect_path; - } + if ((empty($sourcedir) || !is_dir(realpath($sourcedir)))) { + $boarddir = rtrim($boarddir, '\\/'); - if (!isset($_POST['ftp_username'])) { - $_POST['ftp_username'] = $username; - } - - // Set the username etc, into context. - $incontext['ftp'] = [ - 'server' => $_POST['ftp_server'] ?? 'localhost', - 'port' => $_POST['ftp_port'] ?? '21', - 'username' => $_POST['ftp_username'] ?? '', - 'path' => $_POST['ftp_path'] ?? '/', - 'path_msg' => !empty($found_path) ? Lang::$txt['ftp_path_found_info'] : Lang::$txt['ftp_path_info'], - ]; - - return false; + if (empty($boarddir) || !is_dir(realpath($boarddir))) { + $boarddir = __DIR__; } - - $_SESSION['installer_temp_ftp'] = [ - 'server' => $_POST['ftp_server'], - 'port' => $_POST['ftp_port'], - 'username' => $_POST['ftp_username'], - 'password' => $_POST['ftp_password'], - 'path' => $_POST['ftp_path'], - ]; - - $failed_files_updated = []; - - foreach ($failed_files as $file) { - if (!is_writable(Config::$boarddir . '/' . $file)) { - $ftp->chmod($file, 0755); - } - - if (!is_writable(Config::$boarddir . '/' . $file)) { - $ftp->chmod($file, 0777); - } - - if (!is_writable(Config::$boarddir . '/' . $file)) { - $failed_files_updated[] = $file; - $incontext['ftp_errors'][] = rtrim($ftp->last_message) . ' -> ' . $file . "\n"; - } - } - - $ftp->close(); - - // Are there any errors left? - if (count($failed_files_updated) >= 1) { - // Guess there are... - $incontext['failed_files'] = $failed_files_updated; - - // Set the username etc, into context. - $incontext['ftp'] = $_SESSION['installer_temp_ftp'] += [ - 'path_msg' => Lang::$txt['ftp_path_info'], - ]; - - return false; - } - - } - - return true; -} - -function DatabaseSettings() -{ - global $databases, $incontext; - - $incontext['sub_template'] = 'database_settings'; - $incontext['page_title'] = Lang::$txt['db_settings']; - $incontext['continue'] = 1; - - // Set up the defaults. - $incontext['db']['server'] = 'localhost'; - $incontext['db']['user'] = ''; - $incontext['db']['name'] = ''; - $incontext['db']['pass'] = ''; - $incontext['db']['type'] = ''; - $incontext['supported_databases'] = []; - - $foundOne = false; - - foreach ($databases as $key => $db) { - // Override with the defaults for this DB if appropriate. - if ($db['supported']) { - $incontext['supported_databases'][$key] = $db; - - if (!$foundOne) { - if (isset($db['default_host'])) { - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; - } - - if (isset($db['default_user'])) { - $incontext['db']['user'] = ini_get($db['default_user']); - $incontext['db']['name'] = ini_get($db['default_user']); - } - - if (isset($db['default_password'])) { - $incontext['db']['pass'] = ini_get($db['default_password']); - } - - // For simplicity and less confusion, leave the port blank by default - $incontext['db']['port'] = ''; - - $incontext['db']['type'] = $key; - $foundOne = true; - } + if (is_dir($boarddir . '/Sources')) { + $sourcedir = $boarddir . '/Sources'; } } - // Override for repost. - if (isset($_POST['db_user'])) { - $incontext['db']['user'] = $_POST['db_user']; - $incontext['db']['name'] = $_POST['db_name']; - $incontext['db']['server'] = $_POST['db_server']; - $incontext['db']['prefix'] = $_POST['db_prefix']; - - if (!empty($_POST['db_port'])) { - $incontext['db']['port'] = $_POST['db_port']; - } - } else { - $incontext['db']['prefix'] = 'smf_'; + // We need this class, or nothing works. + if (!is_file($sourcedir . '/Config.php') || !is_readable($sourcedir . '/Config.php')) { + die('File not readable: (Sources)/Config.php'); } - // Are we submitting? - if (isset($_POST['db_type'])) { - // What type are they trying? - $db_type = preg_replace('~[^A-Za-z0-9]~', '', $_POST['db_type']); - $db_prefix = $_POST['db_prefix']; - // Validate the prefix. - $valid_prefix = $databases[$db_type]['validate_prefix']($db_prefix); - - if ($valid_prefix !== true) { - $incontext['error'] = $valid_prefix; - - return false; - } - - // Take care of these variables... - $vars = [ - 'db_type' => $db_type, - 'db_name' => $_POST['db_name'], - 'db_user' => $_POST['db_user'], - 'db_passwd' => $_POST['db_passwd'] ?? '', - 'db_server' => $_POST['db_server'], - 'db_prefix' => $db_prefix, - // The cookiename is special; we want it to be the same if it ever needs to be reinstalled with the same info. - 'cookiename' => 'SMFCookie' . abs(crc32($_POST['db_name'] . preg_replace('~[^A-Za-z0-9_$]~', '', $_POST['db_prefix'])) % 1000), - ]; - - // Only set the port if we're not using the default - if (!empty($_POST['db_port'])) { - // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { - $vars['db_port'] = (int) $_POST['db_port']; - } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { - $vars['db_port'] = (int) $_POST['db_port']; - } - } - - // God I hope it saved! - if (!installer_updateSettingsFile($vars)) { - $incontext['error'] = Lang::$txt['settings_error']; - - return false; - } - - // Update SMF\Config with the changes we just saved. - Config::load(); - - // Better find the database file! - if (!file_exists(Config::$sourcedir . '/Db/APIs/' . Db::getClass(Config::$db_type) . '.php')) { - $incontext['error'] = Lang::getTxt('error_db_file', ['Db/APIs/' . Db::getClass(Config::$db_type) . '.php']); - - return false; - } - - Config::$modSettings['disableQueryCheck'] = true; - - // Attempt a connection. - $needsDB = !empty($databases[Config::$db_type]['always_has_db']); - - Db::load(['non_fatal' => true, 'dont_select_db' => !$needsDB]); - - // Still no connection? Big fat error message :P. - if (!Db::$db->connection) { - // Get error info... Recast just in case we get false or 0... - $error_message = Db::$db->connect_error(); - - if (empty($error_message)) { - $error_message = ''; - } - $error_number = Db::$db->connect_errno(); - - if (empty($error_number)) { - $error_number = ''; - } - $db_error = (!empty($error_number) ? $error_number . ': ' : '') . $error_message; - - $incontext['error'] = Lang::$txt['error_db_connect'] . '
' . $db_error . '
'; - - return false; - } - - // Do they meet the install requirements? - // @todo Old client, new server? - if (version_compare($databases[Config::$db_type]['version'], preg_replace('~^\D*|\-.+?$~', '', $databases[Config::$db_type]['version_check']())) > 0) { - $incontext['error'] = Lang::getTxt('error_db_too_low', $databases[Config::$db_type]); - - return false; - } + // Pass all the settings to SMF\Config. + require_once $sourcedir . '/Config.php'; + SMF\Config::set(get_defined_vars()); +}); - // Let's try that database on for size... assuming we haven't already lost the opportunity. - if (Db::$db->name != '' && !$needsDB) { - Db::$db->query( - '', - 'CREATE DATABASE IF NOT EXISTS `' . Db::$db->name . '`', - [ - 'security_override' => true, - 'db_error_skip' => true, - ], - Db::$db->connection, - ); - - // Okay, let's try the prefix if it didn't work... - if (!Db::$db->select(Db::$db->name, Db::$db->connection) && Db::$db->name != '') { - Db::$db->query( - '', - 'CREATE DATABASE IF NOT EXISTS `' . Db::$db->prefix . Db::$db->name . '`', - [ - 'security_override' => true, - 'db_error_skip' => true, - ], - Db::$db->connection, - ); - - if (Db::$db->select(Db::$db->prefix . Db::$db->name, Db::$db->connection)) { - Db::$db->name = Db::$db->prefix . Db::$db->name; - installer_updateSettingsFile(['db_name' => Db::$db->name]); - } - } +/* + * 3. Load some other essential includes. + */ +require_once 'Sources/Autoloader.php'; - // Okay, now let's try to connect... - if (!Db::$db->select(Db::$db->name, Db::$db->connection)) { - $incontext['error'] = Lang::getTxt('error_db_database', ['db_name' => Db::$db->name]); +// Ensure we don't trip over disabled internal functions +require_once SMF\Config::$sourcedir . '/Subs-Compat.php'; - return false; - } - } - - return true; - } - - return false; -} - -// Let's start with basic forum type settings. -function ForumSettings() -{ - global $incontext, $databases; - - $incontext['sub_template'] = 'forum_settings'; - $incontext['page_title'] = Lang::$txt['install_settings']; - - // Let's see if we got the database type correct. - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { - Config::$db_type = $_POST['db_type']; - } - - // Else we'd better be able to get the connection. - else { - load_database(); - } - - Config::$db_type = $_POST['db_type'] ?? Config::$db_type; - - // What host and port are we on? - $host = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']; - - $secure = false; - - if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $secure = true; - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { - $secure = true; - } - - // Now, to put what we've learned together... and add a path. - $incontext['detected_url'] = 'http' . ($secure ? 's' : '') . '://' . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')); - - // Check if the database sessions will even work. - $incontext['test_dbsession'] = (ini_get('session.auto_start') != 1); - - $incontext['continue'] = 1; - - // Check Postgres setting - if (Config::$db_type === 'postgresql') { - load_database(); - $result = Db::$db->query( - '', - 'show standard_conforming_strings', - [ - 'db_error_skip' => true, - ], - ); - - if ($result !== false) { - $row = Db::$db->fetch_assoc($result); - - if ($row['standard_conforming_strings'] !== 'on') { - $incontext['continue'] = 0; - $incontext['error'] = Lang::$txt['error_pg_scs']; - } - Db::$db->free_result($result); - } - } - - // Setup the SSL checkbox... - $incontext['ssl_chkbx_protected'] = false; - $incontext['ssl_chkbx_checked'] = false; - - // If redirect in effect, force SSL ON. - $url = new Url($incontext['detected_url']); - - if ($url->redirectsToHttps()) { - $incontext['ssl_chkbx_protected'] = true; - $incontext['ssl_chkbx_checked'] = true; - $_POST['force_ssl'] = true; - } - - // If no cert, make sure SSL stays OFF. - if (!$url->hasSSL()) { - $incontext['ssl_chkbx_protected'] = true; - $incontext['ssl_chkbx_checked'] = false; - } - - // Submitting? - if (isset($_POST['boardurl'])) { - if (substr($_POST['boardurl'], -10) == '/index.php') { - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); - } elseif (substr($_POST['boardurl'], -1) == '/') { - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); - } - - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; - } - - // Make sure boardurl is aligned with ssl setting - if (empty($_POST['force_ssl'])) { - $_POST['boardurl'] = strtr($_POST['boardurl'], ['https://' => 'http://']); - } else { - $_POST['boardurl'] = strtr($_POST['boardurl'], ['http://' => 'https://']); - } - - // Make sure international domain names are normalized correctly. - if (Lang::$txt['lang_character_set'] == 'UTF-8') { - $_POST['boardurl'] = (string) new Url($_POST['boardurl'], true); - } - - // Deal with different operating systems' directory structure... - $path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', __DIR__), '/'); - - // Save these variables. - $vars = [ - 'boardurl' => $_POST['boardurl'], - 'boarddir' => $path, - 'sourcedir' => $path . '/Sources', - 'cachedir' => $path . '/cache', - 'packagesdir' => $path . '/Packages', - 'languagesdir' => $path . '/Languages', - 'mbname' => strtr($_POST['mbname'], ['\"' => '"']), - 'language' => substr($_SESSION['installer_temp_lang'], 8, -4), - 'image_proxy_secret' => bin2hex(random_bytes(10)), - 'image_proxy_enabled' => !empty($_POST['force_ssl']), - 'auth_secret' => bin2hex(random_bytes(32)), - ]; - - // Must save! - if (!installer_updateSettingsFile($vars)) { - $incontext['error'] = Lang::$txt['settings_error']; - - return false; - } - - // Update SMF\Config with the changes we just saved. - Config::load(); - - // UTF-8 requires a setting to override the language charset. - if (!$databases[Config::$db_type]['utf8_support']()) { - $incontext['error'] = Lang::getTxt('error_utf8_support'); - - return false; - } - - if (!empty($databases[Config::$db_type]['utf8_version_check']) && version_compare($databases[Config::$db_type]['utf8_version'], preg_replace('~\-.+?$~', '', $databases[Config::$db_type]['utf8_version_check']()), '>')) { - $incontext['error'] = Lang::getTxt('error_utf8_version', $databases[Config::$db_type]); - - return false; - } - - // Set the character set here. - installer_updateSettingsFile(['db_character_set' => 'utf8'], true); - - // Good, skip on. - return true; - } - - return false; -} - -// Step one: Do the SQL thang. -function DatabasePopulation() -{ - global $databases, $incontext; - - $incontext['sub_template'] = 'populate_database'; - $incontext['page_title'] = Lang::$txt['db_populate']; - $incontext['continue'] = 1; - - // Already done? - if (isset($_POST['pop_done'])) { - return true; - } - - // Reload settings. - Config::load(); - load_database(); - - // Before running any of the queries, let's make sure another version isn't already installed. - $result = Db::$db->query( - '', - 'SELECT variable, value - FROM {db_prefix}settings', - [ - 'db_error_skip' => true, - ], - ); - $newSettings = []; - - if ($result !== false) { - while ($row = Db::$db->fetch_assoc($result)) { - Config::$modSettings[$row['variable']] = $row['value']; - } - - Db::$db->free_result($result); - - // Do they match? If so, this is just a refresh so charge on! - if (!isset(Config::$modSettings['smfVersion']) || Config::$modSettings['smfVersion'] != SMF_VERSION) { - $incontext['error'] = Lang::$txt['error_versions_do_not_match']; - - return false; - } - } - Config::$modSettings['disableQueryCheck'] = true; - - // If doing UTF8, select it. PostgreSQL requires passing it as a string... - Db::$db->query( - '', - 'SET NAMES {string:utf8}', - [ - 'db_error_skip' => true, - 'utf8' => 'utf8', - ], - ); - - // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... - if (substr(__DIR__, -1) == '\\') { - $attachdir = __DIR__ . 'attachments'; - } else { - $attachdir = __DIR__ . '/attachments'; - } - - $replaces = [ - '{$db_prefix}' => Db::$db->prefix, - '{$attachdir}' => json_encode([1 => Db::$db->escape_string($attachdir)]), - '{$boarddir}' => Db::$db->escape_string(Config::$boarddir), - '{$boardurl}' => Config::$boardurl, - '{$enableCompressedOutput}' => isset($_POST['compress']) ? '1' : '0', - '{$databaseSession_enable}' => isset($_POST['dbsession']) ? '1' : '0', - '{$smf_version}' => SMF_VERSION, - '{$current_time}' => time(), - '{$sched_task_offset}' => 82800 + mt_rand(0, 86399), - '{$registration_method}' => $_POST['reg_mode'] ?? 0, - ]; - - foreach (Lang::$txt as $key => $value) { - if (substr($key, 0, 8) == 'default_') { - $replaces['{$' . $key . '}'] = Db::$db->escape_string($value); - } - } - $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], ['\\\\n' => '\\n']); - - // MySQL-specific stuff - storage engine and UTF8 handling - if (substr(Config::$db_type, 0, 5) == 'mysql') { - // Just in case the query fails for some reason... - $engines = []; - - // Figure out storage engines - what do we have, etc. - $get_engines = Db::$db->query('', 'SHOW ENGINES', []); - - while ($row = Db::$db->fetch_assoc($get_engines)) { - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { - $engines[] = $row['Engine']; - } - } - - // Done with this now - Db::$db->free_result($get_engines); - - // InnoDB is better, so use it if possible... - $has_innodb = in_array('InnoDB', $engines); - $replaces['{$engine}'] = $has_innodb ? 'InnoDB' : 'MyISAM'; - $replaces['{$memory}'] = (!$has_innodb && in_array('MEMORY', $engines)) ? 'MEMORY' : $replaces['{$engine}']; - - // UTF-8 is required. - $replaces['{$engine}'] .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; - $replaces['{$memory}'] .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; - - // One last thing - if we don't have InnoDB, we can't do transactions... - if (!$has_innodb) { - $replaces['START TRANSACTION;'] = ''; - $replaces['COMMIT;'] = ''; - } - } else { - $has_innodb = false; - } - - // Read in the SQL. Turn this on and that off... internationalize... etc. - $type = (Config::$db_type == 'mysqli' ? 'mysql' : Config::$db_type); - $sql_lines = explode("\n", strtr(implode(' ', file(Config::$boarddir . '/install_' . DB_SCRIPT_VERSION . '_' . Db::getClass($type) . '.sql')), $replaces)); - - // Execute the SQL. - $current_statement = ''; - $exists = []; - $incontext['failures'] = []; - $incontext['sql_results'] = [ - 'tables' => 0, - 'inserts' => 0, - 'table_dups' => 0, - 'insert_dups' => 0, - ]; - - foreach ($sql_lines as $count => $line) { - // No comments allowed! - if (substr(trim($line), 0, 1) != '#') { - $current_statement .= "\n" . rtrim($line); - } - - // Is this the end of the query string? - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { - continue; - } - - // Does this table already exist? If so, don't insert more data into it! - if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) { - preg_match_all('~\)[,;]~', $current_statement, $matches); - - if (!empty($matches[0])) { - $incontext['sql_results']['insert_dups'] += count($matches[0]); - } else { - $incontext['sql_results']['insert_dups']++; - } - - $current_statement = ''; - - continue; - } - - if (Db::$db->query('', $current_statement, ['security_override' => true, 'db_error_skip' => true], Db::$db->connection) === false) { - // Error 1050: Table already exists! - // @todo Needs to be made better! - if (((Config::$db_type != 'mysql' && Config::$db_type != 'mysqli') || mysqli_errno(Db::$db->connection) == 1050) && preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { - $exists[] = $match[1]; - $incontext['sql_results']['table_dups']++; - } - // Don't error on duplicate indexes (or duplicate operators in PostgreSQL.) - elseif (!preg_match('~^\s*CREATE( UNIQUE)? INDEX ([^\n\r]+?)~', $current_statement, $match) && !(Config::$db_type == 'postgresql' && preg_match('~^\s*CREATE OPERATOR (^\n\r]+?)~', $current_statement, $match))) { - // MySQLi requires a connection object. It's optional with MySQL and Postgres - $incontext['failures'][$count] = Db::$db->error(Db::$db->connection); - } - } else { - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { - $incontext['sql_results']['tables']++; - } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) { - preg_match_all('~\)[,;]~', $current_statement, $matches); - - if (!empty($matches[0])) { - $incontext['sql_results']['inserts'] += count($matches[0]); - } else { - $incontext['sql_results']['inserts']++; - } - } - } - - $current_statement = ''; - - // Wait, wait, I'm still working here! - @set_time_limit(60); - } - - // Sort out the context for the SQL. - foreach ($incontext['sql_results'] as $key => $number) { - if ($number == 0) { - unset($incontext['sql_results'][$key]); - } else { - $incontext['sql_results'][$key] = Lang::getTxt('db_populate_' . $key, [$number]); - } - } - - // Make sure UTF will be used globally. - $newSettings[] = ['global_character_set', 'UTF-8']; - - // Are we allowing stat collection? - if (!empty($_POST['stats']) && substr(Config::$boardurl, 0, 16) != 'http://localhost' && empty(Config::$modSettings['allow_sm_stats']) && empty(Config::$modSettings['enable_sm_stats'])) { - $incontext['allow_sm_stats'] = true; - - // Attempt to register the site etc. - $fp = @fsockopen('www.simplemachines.org', 443, $errno, $errstr); - - if (!$fp) { - $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); - } - - if ($fp) { - $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode(Config::$boardurl) . ' HTTP/1.1' . "\r\n"; - $out .= 'Host: www.simplemachines.org' . "\r\n"; - $out .= 'Connection: Close' . "\r\n\r\n"; - fwrite($fp, $out); - - $return_data = ''; - - while (!feof($fp)) { - $return_data .= fgets($fp, 128); - } - - fclose($fp); - - // Get the unique site ID. - preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); - - if (!empty($ID[1])) { - Db::$db->insert( - 'replace', - Db::$db->prefix . 'settings', - ['variable' => 'string', 'value' => 'string'], - [ - ['sm_stats_key', $ID[1]], - ['enable_sm_stats', 1], - ], - ['variable'], - ); - } - } - } - // Don't remove stat collection unless we unchecked the box for real, not from the loop. - elseif (empty($_POST['stats']) && empty($incontext['allow_sm_stats'])) { - Db::$db->query( - '', - 'DELETE FROM {db_prefix}settings - WHERE variable = {string:enable_sm_stats}', - [ - 'enable_sm_stats' => 'enable_sm_stats', - 'db_error_skip' => true, - ], - ); - } - - // Are we enabling SSL? - if (!empty($_POST['force_ssl'])) { - $newSettings[] = ['force_ssl', 1]; - } - - // Setting a timezone is required. - if (!isset(Config::$modSettings['default_timezone']) && function_exists('date_default_timezone_set')) { - // Get PHP's default timezone, if set - $ini_tz = ini_get('date.timezone'); - - if (!empty($ini_tz)) { - $timezone_id = $ini_tz; - } else { - $timezone_id = ''; - } - - // If date.timezone is unset, invalid, or just plain weird, make a best guess - if (!in_array($timezone_id, timezone_identifiers_list())) { - $server_offset = @mktime(0, 0, 0, 1, 1, 1970) * -1; - $timezone_id = timezone_name_from_abbr('', $server_offset, 0); - - if (empty($timezone_id)) { - $timezone_id = 'UTC'; - } - } - - if (date_default_timezone_set($timezone_id)) { - $newSettings[] = ['default_timezone', $timezone_id]; - } - } - - if (!empty($newSettings)) { - Db::$db->insert( - 'replace', - '{db_prefix}settings', - ['variable' => 'string-255', 'value' => 'string-65534'], - $newSettings, - ['variable'], - ); - } - - // Populate the smiley_files table. - // Can't just dump this data in the SQL file because we need to know the id for each smiley. - $smiley_filenames = [ - ':)' => 'smiley', - ';)' => 'wink', - ':D' => 'cheesy', - ';D' => 'grin', - '>:(' => 'angry', - ':(' => 'sad', - ':o' => 'shocked', - '8)' => 'cool', - '???' => 'huh', - '::)' => 'rolleyes', - ':P' => 'tongue', - ':-[' => 'embarrassed', - ':-X' => 'lipsrsealed', - ':-\\' => 'undecided', - ':-*' => 'kiss', - ':\'(' => 'cry', - '>:D' => 'evil', - '^-^' => 'azn', - 'O0' => 'afro', - ':))' => 'laugh', - 'C:-)' => 'police', - 'O:-)' => 'angel', - ]; - $smiley_set_extensions = ['fugue' => '.png', 'alienine' => '.png']; - - $smiley_inserts = []; - $request = Db::$db->query( - '', - 'SELECT id_smiley, code - FROM {db_prefix}smileys', - [], - ); - - while ($row = Db::$db->fetch_assoc($request)) { - foreach ($smiley_set_extensions as $set => $ext) { - $smiley_inserts[] = [$row['id_smiley'], $set, $smiley_filenames[$row['code']] . $ext]; - } - } - Db::$db->free_result($request); - - Db::$db->insert( - 'ignore', - '{db_prefix}smiley_files', - ['id_smiley' => 'int', 'smiley_set' => 'string-48', 'filename' => 'string-48'], - $smiley_inserts, - ['id_smiley', 'smiley_set'], - ); - - // Let's optimize those new tables, but not on InnoDB, ok? - if (!$has_innodb) { - $tables = Db::$db->list_tables(Db::$db->name, Db::$db->prefix . '%'); - - foreach ($tables as $table) { - Db::$db->optimize_table($table) != -1 or $db_messed = true; - - if (!empty($db_messed)) { - $incontext['failures'][-1] = Db::$db->error(); - break; - } - } - } - - // MySQL specific stuff - if (substr(Config::$db_type, 0, 5) != 'mysql') { - return false; - } - - // Find database user privileges. - $privs = []; - $get_privs = Db::$db->query('', 'SHOW PRIVILEGES', []); - - while ($row = Db::$db->fetch_assoc($get_privs)) { - if ($row['Privilege'] == 'Alter') { - $privs[] = $row['Privilege']; - } - } - Db::$db->free_result($get_privs); - - // Check for the ALTER privilege. - if (!empty($databases[Config::$db_type]['alter_support']) && !in_array('Alter', $privs)) { - $incontext['error'] = Lang::$txt['error_db_alter_priv']; - - return false; - } - - if (!empty($exists)) { - $incontext['page_title'] = Lang::$txt['user_refresh_install']; - $incontext['was_refresh'] = true; - } - - return false; -} - -// Ask for the administrator login information. -function AdminAccount() -{ - global $incontext; - - $incontext['sub_template'] = 'admin_account'; - $incontext['page_title'] = Lang::$txt['user_settings']; - $incontext['continue'] = 1; - - // Skipping? - if (!empty($_POST['skip'])) { - return true; - } - - // Need this to check whether we need the database password. - Config::load(); - load_database(); - - $settingsDefs = Config::getSettingsDefs(); - - // Reload $modSettings. - Config::reloadModSettings(); - - if (!isset($_POST['username'])) { - $_POST['username'] = ''; - } - - if (!isset($_POST['email'])) { - $_POST['email'] = ''; - } - - if (!isset($_POST['server_email'])) { - $_POST['server_email'] = ''; - } - - $incontext['username'] = htmlspecialchars($_POST['username']); - $incontext['email'] = htmlspecialchars($_POST['email']); - $incontext['server_email'] = htmlspecialchars($_POST['server_email']); - - $incontext['require_db_confirm'] = empty(Config::$db_type); - - // Only allow skipping if we think they already have an account setup. - $request = Db::$db->query( - '', - 'SELECT id_member - FROM {db_prefix}members - WHERE id_group = {int:admin_group} OR FIND_IN_SET({int:admin_group}, additional_groups) != 0 - LIMIT 1', - [ - 'db_error_skip' => true, - 'admin_group' => 1, - ], - ); - - if (Db::$db->num_rows($request) != 0) { - $incontext['skip'] = 1; - } - Db::$db->free_result($request); - - // Trying to create an account? - if (isset($_POST['password1']) && !empty($_POST['contbutt'])) { - // Wrong password? - if ($incontext['require_db_confirm'] && $_POST['password3'] != Config::$db_passwd) { - $incontext['error'] = Lang::$txt['error_db_connect']; - - return false; - } - - // Not matching passwords? - if ($_POST['password1'] != $_POST['password2']) { - $incontext['error'] = Lang::$txt['error_user_settings_again_match']; - - return false; - } - - // No password? - if (strlen($_POST['password1']) < 4) { - $incontext['error'] = Lang::$txt['error_user_settings_no_password']; - - return false; - } - - if (!file_exists(Config::$sourcedir . '/Utils.php')) { - $incontext['error'] = Lang::getTxt('error_sourcefile_missing', ['file' => 'Utils.php']); - - return false; - } - - // Update the webmaster's email? - if (!empty($_POST['server_email']) && (empty(Config::$webmaster_email) || Config::$webmaster_email == $settingsDefs['webmaster_email']['default'])) { - installer_updateSettingsFile(['webmaster_email' => $_POST['server_email']]); - } - - // Work out whether we're going to have dodgy characters and remove them. - $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; - $_POST['username'] = preg_replace('~[<>&"\'=\\\]~', '', $_POST['username']); - - $result = Db::$db->query( - '', - 'SELECT id_member, password_salt - FROM {db_prefix}members - WHERE member_name = {string:username} OR email_address = {string:email} - LIMIT 1', - [ - 'username' => $_POST['username'], - 'email' => $_POST['email'], - 'db_error_skip' => true, - ], - ); - - if (Db::$db->num_rows($result) != 0) { - list($incontext['member_id'], $incontext['member_salt']) = Db::$db->fetch_row($result); - Db::$db->free_result($result); - - $incontext['account_existed'] = Lang::$txt['error_user_settings_taken']; - } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) { - // Try the previous step again. - $incontext['error'] = $_POST['username'] == '' ? Lang::$txt['error_username_left_empty'] : Lang::$txt['error_username_too_long']; - - return false; - } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) { - // Try the previous step again. - $incontext['error'] = Lang::$txt['error_invalid_characters_username']; - - return false; - } elseif (empty($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) || strlen($_POST['email']) > 255) { - // One step back, this time fill out a proper admin email address. - $incontext['error'] = Lang::$txt['error_valid_admin_email_needed']; - - return false; - } elseif (empty($_POST['server_email']) || !filter_var($_POST['server_email'], FILTER_VALIDATE_EMAIL) || strlen($_POST['server_email']) > 255) { - // One step back, this time fill out a proper admin email address. - $incontext['error'] = Lang::$txt['error_valid_server_email_needed']; - - return false; - } elseif ($_POST['username'] != '') { - $incontext['member_salt'] = bin2hex(random_bytes(16)); - - // Format the username properly. - $_POST['username'] = preg_replace('~[\t\n\r\x0B\0\xA0]+~', ' ', $_POST['username']); - $ip = isset($_SERVER['REMOTE_ADDR']) ? substr($_SERVER['REMOTE_ADDR'], 0, 255) : ''; - - $_POST['password1'] = Security::hashPassword($_POST['username'], $_POST['password1']); - - $incontext['member_id'] = Db::$db->insert( - '', - Db::$db->prefix . 'members', - [ - 'member_name' => 'string-25', - 'real_name' => 'string-25', - 'passwd' => 'string', - 'email_address' => 'string', - 'id_group' => 'int', - 'posts' => 'int', - 'date_registered' => 'int', - 'password_salt' => 'string', - 'lngfile' => 'string', - 'personal_text' => 'string', - 'avatar' => 'string', - 'member_ip' => 'inet', - 'member_ip2' => 'inet', - 'buddy_list' => 'string', - 'pm_ignore_list' => 'string', - 'website_title' => 'string', - 'website_url' => 'string', - 'signature' => 'string', - 'usertitle' => 'string', - 'secret_question' => 'string', - 'additional_groups' => 'string', - 'ignore_boards' => 'string', - ], - [ - $_POST['username'], - $_POST['username'], - $_POST['password1'], - $_POST['email'], - 1, - 0, - time(), - $incontext['member_salt'], - '', - '', - '', - $ip, - $ip, - '', - '', - '', - '', - '', - '', - '', - '', - '', - ], - ['id_member'], - 1, - ); - } - - // If we're here we're good. - return true; - } - - return false; -} - -// Final step, clean up and a complete message! -function DeleteInstall() -{ - global $incontext; - global $databases; - - $incontext['page_title'] = Lang::$txt['congratulations']; - $incontext['sub_template'] = 'delete_install'; - $incontext['continue'] = 0; - - Config::load(); - load_database(); - - chdir(Config::$boarddir); - - // Reload $modSettings. - Config::reloadModSettings(); - - // Bring a warning over. - if (!empty($incontext['account_existed'])) { - $incontext['warning'] = $incontext['account_existed']; - } - - Db::$db->query( - '', - 'SET NAMES {string:db_character_set}', - [ - 'db_character_set' => Config::$db_character_set, - 'db_error_skip' => true, - ], - ); - - // As track stats is by default enabled let's add some activity. - Db::$db->insert( - 'ignore', - '{db_prefix}log_activity', - ['date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'], - [Time::strftime('%Y-%m-%d', time()), 1, 1, (!empty($incontext['member_id']) ? 1 : 0)], - ['date'], - ); - - // We're going to want our lovely Config::$modSettings now. - $request = Db::$db->query( - '', - 'SELECT variable, value - FROM {db_prefix}settings', - [ - 'db_error_skip' => true, - ], - ); - - // Only proceed if we can load the data. - if ($request) { - while ($row = Db::$db->fetch_row($request)) { - Config::$modSettings[$row[0]] = $row[1]; - } - Db::$db->free_result($request); - } - - // Automatically log them in ;) - if (isset($incontext['member_id'], $incontext['member_salt'])) { - Cookie::setLoginCookie(3153600 * 60, $incontext['member_id'], Cookie::encrypt($_POST['password1'], $incontext['member_salt'])); - } - - $result = Db::$db->query( - '', - 'SELECT value - FROM {db_prefix}settings - WHERE variable = {string:db_sessions}', - [ - 'db_sessions' => 'databaseSession_enable', - 'db_error_skip' => true, - ], - ); - - if (Db::$db->num_rows($result) != 0) { - list($db_sessions) = Db::$db->fetch_row($result); - } - Db::$db->free_result($result); - - if (empty($db_sessions)) { - $_SESSION['admin_time'] = time(); - } else { - $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); - - Db::$db->insert( - 'replace', - '{db_prefix}sessions', - [ - 'session_id' => 'string', 'last_update' => 'int', 'data' => 'string', - ], - [ - session_id(), time(), 'USER_AGENT|s:' . strlen($_SERVER['HTTP_USER_AGENT']) . ':"' . $_SERVER['HTTP_USER_AGENT'] . '";admin_time|i:' . time() . ';', - ], - ['session_id'], - ); - } - - Logging::updateStats('member'); - Logging::updateStats('message'); - Logging::updateStats('topic'); - - $request = Db::$db->query( - '', - 'SELECT id_msg - FROM {db_prefix}messages - WHERE id_msg = 1 - AND modified_time = 0 - LIMIT 1', - [ - 'db_error_skip' => true, - ], - ); - Utils::$context['utf8'] = true; - - if (Db::$db->num_rows($request) > 0) { - Logging::updateStats('subject', 1, htmlspecialchars(Lang::$txt['default_topic_subject'])); - } - Db::$db->free_result($request); - - // Now is the perfect time to fetch the SM files. - // Sanity check that they loaded earlier! - if (isset(Config::$modSettings['recycle_board'])) { - (new TaskRunner())->runScheduledTasks(['fetchSMfiles']); // Now go get those files! - - // We've just installed! - if (isset($incontext['member_id'])) { - User::setMe($incontext['member_id']); - } else { - User::load(); - } - - User::$me->ip = $_SERVER['REMOTE_ADDR']; - - Logging::logAction('install', ['version' => SMF_FULL_VERSION], 'admin'); - } - - // Disable the legacy BBC by default for new installs - Config::updateModSettings([ - 'disabledBBC' => implode(',', Utils::$context['legacy_bbc']), - ]); - - // Some final context for the template. - $incontext['dir_still_writable'] = is_writable(Config::$boarddir) && substr(__FILE__, 1, 2) != ':\\'; - $incontext['probably_delete_install'] = isset($_SESSION['installer_temp_ftp']) || is_writable(Config::$boarddir) || is_writable(__FILE__); - - // Update hash's cost to an appropriate setting - Config::updateModSettings([ - 'bcrypt_hash_cost' => Security::hashBenchmark(), - ]); - - return false; -} - -function installer_updateSettingsFile($vars, $rebuild = false) -{ - if (!is_writable(SMF_SETTINGS_FILE)) { - @chmod(SMF_SETTINGS_FILE, 0777); - - if (!is_writable(SMF_SETTINGS_FILE)) { - return false; - } - } - - return Config::updateSettingsFile($vars, false, $rebuild); -} - -// Create an .htaccess file to prevent mod_security. SMF has filtering built-in. -function fixModSecurity() -{ - $htaccess_addition = ' - - # Turn off mod_security filtering. SMF is a big boy, it doesn\'t need its hands held. - SecFilterEngine Off - - # The below probably isn\'t needed, but better safe than sorry. - SecFilterScanPOST Off -'; - - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { - return true; - } - - if (file_exists(Config::$boarddir . '/.htaccess') && is_writable(Config::$boarddir . '/.htaccess')) { - $current_htaccess = implode('', file(Config::$boarddir . '/.htaccess')); - - // Only change something if mod_security hasn't been addressed yet. - if (strpos($current_htaccess, '') === false) { - if ($ht_handle = fopen(Config::$boarddir . '/.htaccess', 'a')) { - fwrite($ht_handle, $htaccess_addition); - fclose($ht_handle); - - return true; - } - - return false; - } - - return true; - } - - if (file_exists(Config::$boarddir . '/.htaccess')) { - return strpos(implode('', file(Config::$boarddir . '/.htaccess')), '') !== false; - } - - if (is_writable(Config::$boarddir)) { - if ($ht_handle = fopen(Config::$boarddir . '/.htaccess', 'w')) { - fwrite($ht_handle, $htaccess_addition); - fclose($ht_handle); - - return true; - } - - return false; - } - - return false; -} - -function template_install_above() -{ - global $incontext, $installurl; - - echo ' - - - - - ', Lang::$txt['smf_installer'], ' - - - ', Lang::$txt['lang_rtl'] == '1' ? '' : '', ' - - - - - -
- -
'; - - // Have we got a language drop down - if so do it on the first step only. - if (!empty($incontext['detected_languages']) && count($incontext['detected_languages']) > 1 && $incontext['current_step'] == 0) { - echo ' -
-
-
-
-
- - - -
-
-
-
-
-
'; - } - - echo ' -
-
-
-

', Lang::$txt['upgrade_progress'], '

-
    '; - - foreach ($incontext['steps'] as $num => $step) { - echo ' - - ', Lang::$txt['upgrade_step'], ' ', $step[0], ': ', $step[1], ' - '; - } - - echo ' -
-
-
-
-

' . Lang::$txt['upgrade_overall_progress'], '

- ', $incontext['overall_percent'], '% -
-
-
-
-

', $incontext['page_title'], '

-
'; -} - -function template_install_below() -{ - global $incontext; - - if (!empty($incontext['continue']) || !empty($incontext['skip'])) { - echo ' -
'; - - if (!empty($incontext['continue'])) { - echo ' - '; - } - - if (!empty($incontext['skip'])) { - echo ' - '; - } - echo ' -
'; - } - - // Show the closing form tag and other data only if not in the last step - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { - echo ' - '; - } - - echo ' -
-
-
-
-
-
- - -'; -} - -// Welcome them to the wonderful world of SMF! -function template_welcome_message() -{ - global $incontext; - - echo ' - -
-

', Lang::getTxt('install_welcome_desc', ['SMF_VERSION' => SMF_VERSION]), '

- '; - - // Show the warnings, or not. - if (template_warning_divs()) { - echo ' -

', Lang::$txt['install_all_lovely'], '

'; - } - - // Say we want the continue button! - if (empty($incontext['error'])) { - $incontext['continue'] = 1; - } - - // For the latest version stuff. - echo ' - '; -} - -// A shortcut for any warning stuff. -function template_warning_divs() -{ - global $incontext; - - // Errors are very serious.. - if (!empty($incontext['error'])) { - echo ' -
-

', Lang::$txt['upgrade_critical_error'], '

- ', $incontext['error'], ' -
'; - } - // A warning message? - elseif (!empty($incontext['warning'])) { - echo ' -
-

', Lang::$txt['upgrade_warning'], '

- ', $incontext['warning'], ' -
'; - } - - return empty($incontext['error']) && empty($incontext['warning']); -} - -function template_chmod_files() -{ - global $incontext; - - echo ' -

', Lang::$txt['ftp_setup_why_info'], '

-
    -
  • ', implode('
  • -
  • ', $incontext['failed_files']), '
  • -
'; - - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { - echo ' -
-

', Lang::$txt['chmod_linux_info'], '

- # chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), ''; - } - - // This is serious! - if (!template_warning_divs()) { - return; - } - - echo ' -
-

', Lang::$txt['ftp_setup_info'], '

'; - - if (!empty($incontext['ftp_errors'])) { - echo ' -
- ', Lang::$txt['error_ftp_no_connect'], '

- ', implode('
', $incontext['ftp_errors']), '
-
'; - } - - echo ' - -
-
- -
-
-
- - -
- -
', Lang::$txt['ftp_server_info'], '
-
-
- -
-
- -
', Lang::$txt['ftp_username_info'], '
-
-
- -
-
- -
', Lang::$txt['ftp_password_info'], '
-
-
- -
-
- -
', $incontext['ftp']['path_msg'], '
-
-
-
- -
-
- ', Lang::$txt['error_message_click'], ' ', Lang::$txt['ftp_setup_again']; -} - -// Get the database settings prepared. -function template_database_settings() -{ - global $incontext; - - echo ' -
-

', Lang::$txt['db_settings_info'], '

'; - - template_warning_divs(); - - echo ' -
'; - - // More than one database type? - if (count($incontext['supported_databases']) > 1) { - echo ' -
- -
-
- -
', Lang::$txt['db_settings_type_info'], '
-
'; - } else { - echo ' -
- -
'; - } - - echo ' -
- -
-
- -
', Lang::$txt['db_settings_server_info'], '
-
-
- -
-
- -
', Lang::$txt['db_settings_port_info'], '
-
-
- -
-
- -
', Lang::$txt['db_settings_username_info'], '
-
-
- -
-
- -
', Lang::$txt['db_settings_password_info'], '
-
-
- -
-
- -
- ', Lang::$txt['db_settings_database_info'], ' - ', Lang::$txt['db_settings_database_info_note'], ' -
-
-
- -
-
- -
', Lang::$txt['db_settings_prefix_info'], '
-
-
'; - - // Toggles a warning related to db names in PostgreSQL - echo ' - '; -} - -// Stick in their forum settings. -function template_forum_settings() -{ - global $incontext; - - echo ' - -

', Lang::$txt['install_settings_info'], '

'; - - template_warning_divs(); - - echo ' -
-
- -
-
- -
', Lang::$txt['install_settings_name_info'], '
-
-
- -
-
- -
', Lang::$txt['install_settings_url_info'], '
-
-
- -
-
- -
', Lang::$txt['install_settings_reg_mode_info'], '
-
-
', Lang::$txt['install_settings_compress'], ':
-
- - -
', Lang::$txt['install_settings_compress_info'], '
-
-
', Lang::$txt['install_settings_dbsession'], ':
-
- - -
', $incontext['test_dbsession'] ? Lang::$txt['install_settings_dbsession_info1'] : Lang::$txt['install_settings_dbsession_info2'], '
-
-
', Lang::$txt['install_settings_stats'], ':
-
- - -
', Lang::$txt['install_settings_stats_info'], '
-
-
', Lang::$txt['force_ssl'], ':
-
- - -
', Lang::$txt['force_ssl_info'], '
-
-
'; -} - -// Show results of the database population. -function template_populate_database() -{ - global $incontext; - - echo ' - -

', !empty($incontext['was_refresh']) ? Lang::$txt['user_refresh_install_desc'] : Lang::$txt['db_populate_info'], '

'; - - if (!empty($incontext['sql_results'])) { - echo ' -
    -
  • ', implode('
  • ', $incontext['sql_results']), '
  • -
'; - } - - if (!empty($incontext['failures'])) { - echo ' -
', Lang::$txt['error_db_queries'], '
-
    '; - - foreach ($incontext['failures'] as $line => $fail) { - echo ' -
  • ', Lang::$txt['error_db_queries_line'], $line + 1, ': ', nl2br(htmlspecialchars($fail)), '
  • '; - } - - echo ' -
'; - } - - echo ' -

', Lang::$txt['db_populate_info2'], '

'; - - template_warning_divs(); - - echo ' - '; -} - -// Create the admin account. -function template_admin_account() -{ - global $incontext; - - echo ' - -

', Lang::$txt['user_settings_info'], '

'; - - template_warning_divs(); - - echo ' -
-
- -
-
- -
', Lang::$txt['user_settings_username_info'], '
-
-
- -
-
- -
', Lang::$txt['user_settings_password_info'], '
-
-
- -
-
- -
', Lang::$txt['user_settings_again_info'], '
-
-
- -
-
- -
', Lang::$txt['user_settings_admin_email_info'], '
-
-
- -
-
- -
', Lang::$txt['user_settings_server_email_info'], '
-
-
'; - - if ($incontext['require_db_confirm']) { - echo ' -

', Lang::$txt['user_settings_database'], '

-

', Lang::$txt['user_settings_database_info'], '

- -
- -
'; - } -} - -// Tell them it's done, and to delete. -function template_delete_install() -{ - global $incontext, $installurl; - - echo ' -

', Lang::$txt['congratulations_help'], '

'; - - template_warning_divs(); - - // Install directory still writable? - if ($incontext['dir_still_writable']) { - echo ' -

', Lang::$txt['still_writable'], '

'; - } - - // Don't show the box if it's like 99% sure it won't work :P. - if ($incontext['probably_delete_install']) { - echo ' - - '; - } - - echo ' -

', Lang::getTxt('go_to_your_forum', ['scripturl' => Config::$boardurl . '/index.php']), '

-
- ', Lang::$txt['good_luck']; -} +(new SMF\Maintenance())->execute(Maintenance::INSTALL); -?> \ No newline at end of file +exit; \ No newline at end of file diff --git a/other/install_3-0_MySQL.sql b/other/install_3-0_MySQL.sql deleted file mode 100644 index e5641ba27e..0000000000 --- a/other/install_3-0_MySQL.sql +++ /dev/null @@ -1,2300 +0,0 @@ -#### ATTENTION: You do not need to run or use this file! The install.php script does everything for you! - -# -# Table structure for table `admin_info_files` -# - -CREATE TABLE {$db_prefix}admin_info_files ( - id_file TINYINT UNSIGNED AUTO_INCREMENT, - filename VARCHAR(255) NOT NULL DEFAULT '', - path VARCHAR(255) NOT NULL DEFAULT '', - parameters VARCHAR(255) NOT NULL DEFAULT '', - data TEXT NOT NULL, - filetype VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_file), - INDEX idx_filename (filename(30)) -) ENGINE={$engine}; - -# -# Table structure for table `approval_queue` -# - -CREATE TABLE {$db_prefix}approval_queue ( - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_attach INT UNSIGNED NOT NULL DEFAULT '0', - id_event SMALLINT UNSIGNED NOT NULL DEFAULT '0' -) ENGINE={$engine}; - -# -# Table structure for table `attachments` -# - -CREATE TABLE {$db_prefix}attachments ( - id_attach INT UNSIGNED AUTO_INCREMENT, - id_thumb INT UNSIGNED NOT NULL DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_folder TINYINT NOT NULL DEFAULT '1', - attachment_type TINYINT UNSIGNED NOT NULL DEFAULT '0', - filename VARCHAR(255) NOT NULL DEFAULT '', - file_hash VARCHAR(40) NOT NULL DEFAULT '', - fileext VARCHAR(8) NOT NULL DEFAULT '', - size INT UNSIGNED NOT NULL DEFAULT '0', - downloads MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - width MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - height MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - mime_type VARCHAR(128) NOT NULL DEFAULT '', - approved TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_attach), - UNIQUE idx_id_member (id_member, id_attach), - INDEX idx_id_msg (id_msg), - INDEX idx_attachment_type (attachment_type), - INDEX idx_id_thumb (id_thumb) -) ENGINE={$engine}; - -# -# Table structure for table `background_tasks` -# - -CREATE TABLE {$db_prefix}background_tasks ( - id_task INT UNSIGNED AUTO_INCREMENT, - task_file VARCHAR(255) NOT NULL DEFAULT '', - task_class VARCHAR(255) NOT NULL DEFAULT '', - task_data MEDIUMTEXT NOT NULL, - claimed_time INT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_task) -) ENGINE={$engine}; - -# -# Table structure for table `ban_groups` -# - -CREATE TABLE {$db_prefix}ban_groups ( - id_ban_group MEDIUMINT UNSIGNED AUTO_INCREMENT, - name VARCHAR(20) NOT NULL DEFAULT '', - ban_time INT UNSIGNED NOT NULL DEFAULT '0', - expire_time INT UNSIGNED, - cannot_access TINYINT UNSIGNED NOT NULL DEFAULT '0', - cannot_register TINYINT UNSIGNED NOT NULL DEFAULT '0', - cannot_post TINYINT UNSIGNED NOT NULL DEFAULT '0', - cannot_login TINYINT UNSIGNED NOT NULL DEFAULT '0', - reason VARCHAR(255) NOT NULL DEFAULT '', - notes TEXT NOT NULL, - PRIMARY KEY (id_ban_group) -) ENGINE={$engine}; - -# -# Table structure for table `ban_items` -# - -CREATE TABLE {$db_prefix}ban_items ( - id_ban MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_ban_group SMALLINT UNSIGNED NOT NULL DEFAULT '0', - ip_low VARBINARY(16), - ip_high VARBINARY(16), - hostname VARCHAR(255) NOT NULL DEFAULT '', - email_address VARCHAR(255) NOT NULL DEFAULT '', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - hits MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_ban), - INDEX idx_id_ban_group (id_ban_group), - INDEX idx_id_ban_ip (ip_low,ip_high) -) ENGINE={$engine}; - -# -# Table structure for table `board_permissions` -# - -CREATE TABLE {$db_prefix}board_permissions ( - id_group SMALLINT DEFAULT '0', - id_profile SMALLINT UNSIGNED DEFAULT '0', - permission VARCHAR(30) DEFAULT '', - add_deny TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_group, id_profile, permission) -) ENGINE={$engine}; - -# -# Table structure for table `boards` -# - -CREATE TABLE {$db_prefix}boards ( - id_board SMALLINT UNSIGNED AUTO_INCREMENT, - id_cat TINYINT UNSIGNED NOT NULL DEFAULT '0', - child_level TINYINT UNSIGNED NOT NULL DEFAULT '0', - id_parent SMALLINT UNSIGNED NOT NULL DEFAULT '0', - board_order SMALLINT NOT NULL DEFAULT '0', - id_last_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_msg_updated INT UNSIGNED NOT NULL DEFAULT '0', - member_groups VARCHAR(255) NOT NULL DEFAULT '-1,0', - id_profile SMALLINT UNSIGNED NOT NULL DEFAULT '1', - name VARCHAR(255) NOT NULL DEFAULT '', - description TEXT NOT NULL, - num_topics MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - num_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - count_posts TINYINT NOT NULL DEFAULT '0', - id_theme TINYINT UNSIGNED NOT NULL DEFAULT '0', - override_theme TINYINT UNSIGNED NOT NULL DEFAULT '0', - unapproved_posts SMALLINT NOT NULL DEFAULT '0', - unapproved_topics SMALLINT NOT NULL DEFAULT '0', - redirect VARCHAR(255) NOT NULL DEFAULT '', - deny_member_groups VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_board), - UNIQUE idx_categories (id_cat, id_board), - INDEX idx_id_parent (id_parent), - INDEX idx_id_msg_updated (id_msg_updated), - INDEX idx_member_groups (member_groups(48)) -) ENGINE={$engine}; - -# -# Table structure for table `board_permissions_view` -# - -CREATE TABLE {$db_prefix}board_permissions_view -( - id_group SMALLINT NOT NULL DEFAULT '0', - id_board SMALLINT UNSIGNED NOT NULL, - deny smallint NOT NULL, - PRIMARY KEY (id_group, id_board, deny) -) ENGINE={$engine}; - -# -# Table structure for table `calendar` -# - -CREATE TABLE {$db_prefix}calendar ( - id_event SMALLINT UNSIGNED AUTO_INCREMENT, - start_date date NOT NULL DEFAULT '1004-01-01', - end_date date NOT NULL DEFAULT '1004-01-01', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - title VARCHAR(255) NOT NULL DEFAULT '', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - start_time time, - end_time time, - timezone VARCHAR(80), - location VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_event), - INDEX idx_start_date (start_date), - INDEX idx_end_date (end_date), - INDEX idx_topic (id_topic, id_member) -) ENGINE={$engine}; - -# -# Table structure for table `calendar_holidays` -# - -CREATE TABLE {$db_prefix}calendar_holidays ( - id_holiday SMALLINT UNSIGNED AUTO_INCREMENT, - event_date date NOT NULL DEFAULT '1004-01-01', - title VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_holiday), - INDEX idx_event_date (event_date) -) ENGINE={$engine}; - -# -# Table structure for table `categories` -# - -CREATE TABLE {$db_prefix}categories ( - id_cat TINYINT UNSIGNED AUTO_INCREMENT, - cat_order TINYINT NOT NULL DEFAULT '0', - name VARCHAR(255) NOT NULL DEFAULT '', - description TEXT NOT NULL, - can_collapse TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_cat) -) ENGINE={$engine}; - -# -# Table structure for table `custom_fields` -# - -CREATE TABLE {$db_prefix}custom_fields ( - id_field SMALLINT AUTO_INCREMENT, - col_name VARCHAR(12) NOT NULL DEFAULT '', - field_name VARCHAR(40) NOT NULL DEFAULT '', - field_desc VARCHAR(255) NOT NULL DEFAULT '', - field_type VARCHAR(8) NOT NULL DEFAULT 'text', - field_length SMALLINT NOT NULL DEFAULT '255', - field_options TEXT NOT NULL, - field_order SMALLINT NOT NULL DEFAULT '0', - mask VARCHAR(255) NOT NULL DEFAULT '', - show_reg TINYINT NOT NULL DEFAULT '0', - show_display TINYINT NOT NULL DEFAULT '0', - show_mlist SMALLINT NOT NULL DEFAULT '0', - show_profile VARCHAR(20) NOT NULL DEFAULT 'forumprofile', - private TINYINT NOT NULL DEFAULT '0', - active TINYINT NOT NULL DEFAULT '1', - bbc TINYINT NOT NULL DEFAULT '0', - can_search TINYINT NOT NULL DEFAULT '0', - default_value VARCHAR(255) NOT NULL DEFAULT '', - enclose TEXT NOT NULL, - placement TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_field), - UNIQUE idx_col_name (col_name) -) ENGINE={$engine}; - -# -# Table structure for table `group_moderators` -# - -CREATE TABLE {$db_prefix}group_moderators ( - id_group SMALLINT UNSIGNED DEFAULT '0', - id_member MEDIUMINT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_group, id_member) -) ENGINE={$engine}; - -# -# Table structure for table `log_actions` -# - -CREATE TABLE {$db_prefix}log_actions ( - id_action INT UNSIGNED AUTO_INCREMENT, - id_log TINYINT UNSIGNED NOT NULL DEFAULT '1', - log_time INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - ip VARBINARY(16), - action VARCHAR(30) NOT NULL DEFAULT '', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - extra TEXT NOT NULL, - PRIMARY KEY (id_action), - INDEX idx_id_log (id_log), - INDEX idx_log_time (log_time), - INDEX idx_id_member (id_member), - INDEX idx_id_board (id_board), - INDEX idx_id_msg (id_msg), - INDEX idx_id_topic_id_log (id_topic, id_log) -) ENGINE={$engine}; - -# -# Table structure for table `log_activity` -# - -CREATE TABLE {$db_prefix}log_activity ( - date DATE NOT NULL, - hits MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - topics SMALLINT UNSIGNED NOT NULL DEFAULT '0', - posts SMALLINT UNSIGNED NOT NULL DEFAULT '0', - registers SMALLINT UNSIGNED NOT NULL DEFAULT '0', - most_on SMALLINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (date) -) ENGINE={$engine}; - -# -# Table structure for table `log_banned` -# - -CREATE TABLE {$db_prefix}log_banned ( - id_ban_log MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - ip VARBINARY(16), - email VARCHAR(255) NOT NULL DEFAULT '', - log_time INT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_ban_log), - INDEX idx_log_time (log_time) -) ENGINE={$engine}; - -# -# Table structure for table `log_boards` -# - -CREATE TABLE {$db_prefix}log_boards ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - id_board SMALLINT UNSIGNED DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_board) -) ENGINE={$engine}; - -# -# Table structure for table `log_comments` -# - -CREATE TABLE {$db_prefix}log_comments ( - id_comment MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - member_name VARCHAR(80) NOT NULL DEFAULT '', - comment_type VARCHAR(8) NOT NULL DEFAULT 'warning', - id_recipient MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - recipient_name VARCHAR(255) NOT NULL DEFAULT '', - log_time INT NOT NULL DEFAULT '0', - id_notice MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - counter TINYINT NOT NULL DEFAULT '0', - body TEXT NOT NULL, - PRIMARY KEY (id_comment), - INDEX idx_id_recipient (id_recipient), - INDEX idx_log_time (log_time), - INDEX idx_comment_type (comment_type(8)) -) ENGINE={$engine}; - -# -# Table structure for table `log_digest` -# - -CREATE TABLE {$db_prefix}log_digest ( - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - note_type VARCHAR(10) NOT NULL DEFAULT 'post', - daily TINYINT UNSIGNED NOT NULL DEFAULT '0', - exclude MEDIUMINT UNSIGNED NOT NULL DEFAULT '0' -) ENGINE={$engine}; - -# -# Table structure for table `log_errors` -# - -CREATE TABLE {$db_prefix}log_errors ( - id_error MEDIUMINT UNSIGNED AUTO_INCREMENT, - log_time INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - ip VARBINARY(16), - url TEXT NOT NULL, - message TEXT NOT NULL, - session VARCHAR(128) NOT NULL DEFAULT '', - error_type CHAR(15) NOT NULL DEFAULT 'general', - file VARCHAR(255) NOT NULL DEFAULT '', - line MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - backtrace VARCHAR(10000) NOT NULL DEFAULT '', - PRIMARY KEY (id_error), - INDEX idx_log_time (log_time), - INDEX idx_id_member (id_member), - INDEX idx_ip (ip) -) ENGINE={$engine}; - -# -# Table structure for table `log_floodcontrol` -# - -CREATE TABLE {$db_prefix}log_floodcontrol ( - ip VARBINARY(16), - log_time INT UNSIGNED NOT NULL DEFAULT '0', - log_type VARCHAR(30) DEFAULT 'post', - PRIMARY KEY (ip, log_type) -) ENGINE={$memory}; - -# -# Table structure for table `log_group_requests` -# - -CREATE TABLE {$db_prefix}log_group_requests ( - id_request MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_group SMALLINT UNSIGNED NOT NULL DEFAULT '0', - time_applied INT UNSIGNED NOT NULL DEFAULT '0', - reason TEXT NOT NULL, - status TINYINT UNSIGNED NOT NULL DEFAULT '0', - id_member_acted MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - member_name_acted VARCHAR(255) NOT NULL DEFAULT '', - time_acted INT UNSIGNED NOT NULL DEFAULT '0', - act_reason TEXT NOT NULL, - PRIMARY KEY (id_request), - INDEX idx_id_member (id_member, id_group) -) ENGINE={$engine}; - -# -# Table structure for table `log_mark_read` -# - -CREATE TABLE {$db_prefix}log_mark_read ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - id_board SMALLINT UNSIGNED DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_board) -) ENGINE={$engine}; - -# -# Table structure for table `log_member_notices` -# - -CREATE TABLE {$db_prefix}log_member_notices ( - id_notice MEDIUMINT UNSIGNED AUTO_INCREMENT, - subject VARCHAR(255) NOT NULL DEFAULT '', - body TEXT NOT NULL, - PRIMARY KEY (id_notice) -) ENGINE={$engine}; - -# -# Table structure for table `log_notify` -# - -CREATE TABLE {$db_prefix}log_notify ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - id_topic MEDIUMINT UNSIGNED DEFAULT '0', - id_board SMALLINT UNSIGNED DEFAULT '0', - sent TINYINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_topic, id_board), - INDEX idx_id_topic (id_topic, id_member) -) ENGINE={$engine}; - -# -# Table structure for table `log_online` -# - -CREATE TABLE {$db_prefix}log_online ( - session VARCHAR(128) DEFAULT '', - log_time INT NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_spider SMALLINT UNSIGNED NOT NULL DEFAULT '0', - ip VARBINARY(16), - url VARCHAR(2048) NOT NULL DEFAULT '', - PRIMARY KEY (session), - INDEX idx_log_time (log_time), - INDEX idx_id_member (id_member) -) ENGINE={$memory}; - -# -# Table structure for table `log_packages` -# - -CREATE TABLE {$db_prefix}log_packages ( - id_install INT AUTO_INCREMENT, - filename VARCHAR(255) NOT NULL DEFAULT '', - package_id VARCHAR(255) NOT NULL DEFAULT '', - name VARCHAR(255) NOT NULL DEFAULT '', - version VARCHAR(255) NOT NULL DEFAULT '', - id_member_installed MEDIUMINT NOT NULL DEFAULT '0', - member_installed VARCHAR(255) NOT NULL DEFAULT '', - time_installed INT NOT NULL DEFAULT '0', - id_member_removed MEDIUMINT NOT NULL DEFAULT '0', - member_removed VARCHAR(255) NOT NULL DEFAULT '', - time_removed INT NOT NULL DEFAULT '0', - install_state TINYINT NOT NULL DEFAULT '1', - failed_steps TEXT NOT NULL, - themes_installed VARCHAR(255) NOT NULL DEFAULT '', - db_changes TEXT NOT NULL, - credits TEXT NOT NULL, - sha256_hash TEXT, - PRIMARY KEY (id_install), - INDEX idx_filename (filename(15)) -) ENGINE={$engine}; - -# -# Table structure for table `log_polls` -# - -CREATE TABLE {$db_prefix}log_polls ( - id_poll MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_choice TINYINT UNSIGNED NOT NULL DEFAULT '0', - INDEX idx_id_poll (id_poll, id_member, id_choice) -) ENGINE={$engine}; - -# -# Table structure for table `log_reported` -# - -CREATE TABLE {$db_prefix}log_reported ( - id_report MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - membername VARCHAR(255) NOT NULL DEFAULT '', - subject VARCHAR(255) NOT NULL DEFAULT '', - body MEDIUMTEXT NOT NULL, - time_started INT NOT NULL DEFAULT '0', - time_updated INT NOT NULL DEFAULT '0', - num_reports MEDIUMINT NOT NULL DEFAULT '0', - closed TINYINT NOT NULL DEFAULT '0', - ignore_all TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_report), - INDEX idx_id_member (id_member), - INDEX idx_id_topic (id_topic), - INDEX idx_closed (closed), - INDEX idx_time_started (time_started), - INDEX idx_id_msg (id_msg) -) ENGINE={$engine}; - -# -# Table structure for table `log_reported_comments` -# - -CREATE TABLE {$db_prefix}log_reported_comments ( - id_comment MEDIUMINT UNSIGNED AUTO_INCREMENT, - id_report MEDIUMINT NOT NULL DEFAULT '0', - id_member MEDIUMINT NOT NULL, - membername VARCHAR(255) NOT NULL DEFAULT '', - member_ip VARBINARY(16), - comment VARCHAR(255) NOT NULL DEFAULT '', - time_sent INT NOT NULL, - PRIMARY KEY (id_comment), - INDEX idx_id_report (id_report), - INDEX idx_id_member (id_member), - INDEX idx_time_sent (time_sent) -) ENGINE={$engine}; - -# -# Table structure for table `log_scheduled_tasks` -# - -CREATE TABLE {$db_prefix}log_scheduled_tasks ( - id_log MEDIUMINT AUTO_INCREMENT, - id_task SMALLINT NOT NULL DEFAULT '0', - time_run INT NOT NULL DEFAULT '0', - time_taken float NOT NULL DEFAULT '0', - PRIMARY KEY (id_log) -) ENGINE={$engine}; - -# -# Table structure for table `log_search_messages` -# - -CREATE TABLE {$db_prefix}log_search_messages ( - id_search TINYINT UNSIGNED DEFAULT '0', - id_msg INT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_search, id_msg) -) ENGINE={$engine}; - -# -# Table structure for table `log_search_results` -# - -CREATE TABLE {$db_prefix}log_search_results ( - id_search TINYINT UNSIGNED DEFAULT '0', - id_topic MEDIUMINT UNSIGNED DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - relevance SMALLINT UNSIGNED NOT NULL DEFAULT '0', - num_matches SMALLINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_search, id_topic) -) ENGINE={$engine}; - -# -# Table structure for table `log_search_subjects` -# - -CREATE TABLE {$db_prefix}log_search_subjects ( - word VARCHAR(20) DEFAULT '', - id_topic MEDIUMINT UNSIGNED DEFAULT '0', - PRIMARY KEY (word, id_topic), - INDEX idx_id_topic (id_topic) -) ENGINE={$engine}; - -# -# Table structure for table `log_search_topics` -# - -CREATE TABLE {$db_prefix}log_search_topics ( - id_search TINYINT UNSIGNED DEFAULT '0', - id_topic MEDIUMINT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_search, id_topic) -) ENGINE={$engine}; - -# -# Table structure for table `log_spider_hits` -# - -CREATE TABLE {$db_prefix}log_spider_hits ( - id_hit INT UNSIGNED AUTO_INCREMENT, - id_spider SMALLINT UNSIGNED NOT NULL DEFAULT '0', - log_time INT UNSIGNED NOT NULL DEFAULT '0', - url VARCHAR(1024) NOT NULL DEFAULT '', - processed TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_hit), - INDEX idx_id_spider(id_spider), - INDEX idx_log_time(log_time), - INDEX idx_processed (processed) -) ENGINE={$engine}; - -# -# Table structure for table `log_spider_stats` -# - -CREATE TABLE {$db_prefix}log_spider_stats ( - id_spider SMALLINT UNSIGNED DEFAULT '0', - page_hits INT NOT NULL DEFAULT '0', - last_seen INT UNSIGNED NOT NULL DEFAULT '0', - stat_date DATE DEFAULT '1004-01-01', - PRIMARY KEY (stat_date, id_spider) -) ENGINE={$engine}; - -# -# Table structure for table `log_subscribed` -# - -CREATE TABLE {$db_prefix}log_subscribed ( - id_sublog INT UNSIGNED AUTO_INCREMENT, - id_subscribe MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_member INT NOT NULL DEFAULT '0', - old_id_group SMALLINT NOT NULL DEFAULT '0', - start_time INT NOT NULL DEFAULT '0', - end_time INT NOT NULL DEFAULT '0', - status TINYINT NOT NULL DEFAULT '0', - payments_pending TINYINT NOT NULL DEFAULT '0', - pending_details TEXT NOT NULL, - reminder_sent TINYINT NOT NULL DEFAULT '0', - vendor_ref VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_sublog), - UNIQUE KEY id_subscribe (id_subscribe, id_member), - INDEX idx_end_time (end_time), - INDEX idx_reminder_sent (reminder_sent), - INDEX idx_payments_pending (payments_pending), - INDEX idx_status (status), - INDEX idx_id_member (id_member) -) ENGINE={$engine}; - -# -# Table structure for table `log_topics` -# - -CREATE TABLE {$db_prefix}log_topics ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - id_topic MEDIUMINT UNSIGNED DEFAULT '0', - id_msg INT UNSIGNED NOT NULL DEFAULT '0', - unwatched TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_topic), - INDEX idx_id_topic (id_topic) -) ENGINE={$engine}; - -# -# Table structure for table `mail_queue` -# - -CREATE TABLE {$db_prefix}mail_queue ( - id_mail INT UNSIGNED AUTO_INCREMENT, - time_sent INT NOT NULL DEFAULT '0', - recipient VARCHAR(255) NOT NULL DEFAULT '', - body MEDIUMTEXT NOT NULL, - subject VARCHAR(255) NOT NULL DEFAULT '', - headers TEXT NOT NULL, - send_html TINYINT NOT NULL DEFAULT '0', - priority TINYINT NOT NULL DEFAULT '1', - private TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_mail), - INDEX idx_time_sent (time_sent), - INDEX idx_mail_priority (priority, id_mail) -) ENGINE={$engine}; - -# -# Table structure for table `membergroups` -# - -CREATE TABLE {$db_prefix}membergroups ( - id_group SMALLINT UNSIGNED AUTO_INCREMENT, - group_name VARCHAR(80) NOT NULL DEFAULT '', - description TEXT NOT NULL, - online_color VARCHAR(20) NOT NULL DEFAULT '', - min_posts MEDIUMINT NOT NULL DEFAULT '-1', - max_messages SMALLINT UNSIGNED NOT NULL DEFAULT '0', - icons VARCHAR(255) NOT NULL DEFAULT '', - group_type TINYINT NOT NULL DEFAULT '0', - hidden TINYINT NOT NULL DEFAULT '0', - id_parent SMALLINT NOT NULL DEFAULT '-2', - tfa_required TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_group), - INDEX idx_min_posts (min_posts) -) ENGINE={$engine}; - -# -# Table structure for table `members` -# - -CREATE TABLE {$db_prefix}members ( - id_member MEDIUMINT UNSIGNED AUTO_INCREMENT, - member_name VARCHAR(80) NOT NULL DEFAULT '', - date_registered INT UNSIGNED NOT NULL DEFAULT '0', - posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_group SMALLINT UNSIGNED NOT NULL DEFAULT '0', - lngfile VARCHAR(255) NOT NULL DEFAULT '', - last_login INT UNSIGNED NOT NULL DEFAULT '0', - real_name VARCHAR(255) NOT NULL DEFAULT '', - instant_messages SMALLINT NOT NULL DEFAULT 0, - unread_messages SMALLINT NOT NULL DEFAULT 0, - new_pm TINYINT UNSIGNED NOT NULL DEFAULT '0', - alerts INT UNSIGNED NOT NULL DEFAULT '0', - buddy_list TEXT NOT NULL, - pm_ignore_list TEXT NULL, - pm_prefs MEDIUMINT NOT NULL DEFAULT '0', - mod_prefs VARCHAR(20) NOT NULL DEFAULT '', - passwd VARCHAR(64) NOT NULL DEFAULT '', - email_address VARCHAR(255) NOT NULL DEFAULT '', - personal_text VARCHAR(255) NOT NULL DEFAULT '', - birthdate date NOT NULL DEFAULT '1004-01-01', - website_title VARCHAR(255) NOT NULL DEFAULT '', - website_url VARCHAR(255) NOT NULL DEFAULT '', - show_online TINYINT NOT NULL DEFAULT '1', - time_format VARCHAR(80) NOT NULL DEFAULT '', - signature TEXT NOT NULL, - time_offset float NOT NULL DEFAULT '0', - avatar VARCHAR(255) NOT NULL DEFAULT '', - usertitle VARCHAR(255) NOT NULL DEFAULT '', - member_ip VARBINARY(16), - member_ip2 VARBINARY(16), - secret_question VARCHAR(255) NOT NULL DEFAULT '', - secret_answer VARCHAR(64) NOT NULL DEFAULT '', - id_theme TINYINT UNSIGNED NOT NULL DEFAULT '0', - is_activated TINYINT UNSIGNED NOT NULL DEFAULT '1', - validation_code VARCHAR(10) NOT NULL DEFAULT '', - id_msg_last_visit INT UNSIGNED NOT NULL DEFAULT '0', - additional_groups VARCHAR(255) NOT NULL DEFAULT '', - smiley_set VARCHAR(48) NOT NULL DEFAULT '', - id_post_group SMALLINT UNSIGNED NOT NULL DEFAULT '0', - total_time_logged_in INT UNSIGNED NOT NULL DEFAULT '0', - password_salt VARCHAR(255) NOT NULL DEFAULT '', - ignore_boards TEXT NOT NULL, - warning TINYINT NOT NULL DEFAULT '0', - passwd_flood VARCHAR(12) NOT NULL DEFAULT '', - pm_receive_from TINYINT UNSIGNED NOT NULL DEFAULT '1', - timezone VARCHAR(80) NOT NULL DEFAULT '', - tfa_secret VARCHAR(24) NOT NULL DEFAULT '', - tfa_backup VARCHAR(64) NOT NULL DEFAULT '', - PRIMARY KEY (id_member), - INDEX idx_member_name (member_name), - INDEX idx_real_name (real_name), - INDEX idx_email_address (email_address), - INDEX idx_date_registered (date_registered), - INDEX idx_id_group (id_group), - INDEX idx_birthdate (birthdate), - INDEX idx_posts (posts), - INDEX idx_last_login (last_login), - INDEX idx_lngfile (lngfile(30)), - INDEX idx_id_post_group (id_post_group), - INDEX idx_warning (warning), - INDEX idx_total_time_logged_in (total_time_logged_in), - INDEX idx_id_theme (id_theme), - INDEX idx_active_real_name (is_activated, real_name) -) ENGINE={$engine}; - -# -# Table structure for table `member_logins` -# - -CREATE TABLE {$db_prefix}member_logins ( - id_login INT AUTO_INCREMENT, - id_member MEDIUMINT NOT NULL DEFAULT '0', - time INT NOT NULL DEFAULT '0', - ip VARBINARY(16), - ip2 VARBINARY(16), - PRIMARY KEY (id_login), - INDEX idx_id_member (id_member), - INDEX idx_time (time) -) ENGINE={$engine}; - -# -# Table structure for table `message_icons` -# - -CREATE TABLE {$db_prefix}message_icons ( - id_icon SMALLINT UNSIGNED AUTO_INCREMENT, - title VARCHAR(80) NOT NULL DEFAULT '', - filename VARCHAR(80) NOT NULL DEFAULT '', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - icon_order SMALLINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_icon), - INDEX idx_id_board (id_board) -) ENGINE={$engine}; - -# -# Table structure for table `messages` -# - -CREATE TABLE {$db_prefix}messages ( - id_msg INT UNSIGNED AUTO_INCREMENT, - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - poster_time INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_msg_modified INT UNSIGNED NOT NULL DEFAULT '0', - subject VARCHAR(255) NOT NULL DEFAULT '', - poster_name VARCHAR(255) NOT NULL DEFAULT '', - poster_email VARCHAR(255) NOT NULL DEFAULT '', - poster_ip VARBINARY(16), - smileys_enabled TINYINT NOT NULL DEFAULT '1', - modified_time INT UNSIGNED NOT NULL DEFAULT '0', - modified_name VARCHAR(255) NOT NULL DEFAULT '', - modified_reason VARCHAR(255) NOT NULL DEFAULT '', - body TEXT NOT NULL, - icon VARCHAR(16) NOT NULL DEFAULT 'xx', - approved TINYINT NOT NULL DEFAULT '1', - likes SMALLINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_msg), - UNIQUE idx_id_board (id_board, id_msg, approved), - UNIQUE idx_id_member (id_member, id_msg), - INDEX idx_ip_index (poster_ip, id_topic), - INDEX idx_participation (id_member, id_topic), - INDEX idx_show_posts (id_member, id_board), - INDEX idx_id_member_msg (id_member, approved, id_msg), - INDEX idx_current_topic (id_topic, id_msg, id_member, approved), - INDEX idx_related_ip (id_member, poster_ip, id_msg), - INDEX idx_likes (likes) -) ENGINE={$engine}; - -# -# Table structure for table `moderators` -# - -CREATE TABLE {$db_prefix}moderators ( - id_board SMALLINT UNSIGNED DEFAULT '0', - id_member MEDIUMINT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_board, id_member) -) ENGINE={$engine}; - -# -# Table structure for table `moderator_groups` -# - -CREATE TABLE {$db_prefix}moderator_groups ( - id_board SMALLINT UNSIGNED DEFAULT '0', - id_group SMALLINT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_board, id_group) -) ENGINE={$engine}; - -# -# Table structure for table `package_servers` -# - -CREATE TABLE {$db_prefix}package_servers ( - id_server SMALLINT UNSIGNED AUTO_INCREMENT, - name VARCHAR(255) NOT NULL DEFAULT '', - url VARCHAR(255) NOT NULL DEFAULT '', - validation_url VARCHAR(255) NOT NULL DEFAULT '', - extra TEXT, - PRIMARY KEY (id_server) -) ENGINE={$engine}; - -# -# Table structure for table `permission_profiles` -# - -CREATE TABLE {$db_prefix}permission_profiles ( - id_profile SMALLINT AUTO_INCREMENT, - profile_name VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_profile) -) ENGINE={$engine}; - -# -# Table structure for table `permissions` -# - -CREATE TABLE {$db_prefix}permissions ( - id_group SMALLINT DEFAULT '0', - permission VARCHAR(30) DEFAULT '', - add_deny TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_group, permission) -) ENGINE={$engine}; - -# -# Table structure for table `personal_messages` -# - -CREATE TABLE {$db_prefix}personal_messages ( - id_pm INT UNSIGNED AUTO_INCREMENT, - id_pm_head INT UNSIGNED NOT NULL DEFAULT '0', - id_member_from MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - deleted_by_sender TINYINT UNSIGNED NOT NULL DEFAULT '0', - from_name VARCHAR(255) NOT NULL DEFAULT '', - msgtime INT UNSIGNED NOT NULL DEFAULT '0', - subject VARCHAR(255) NOT NULL DEFAULT '', - body TEXT NOT NULL, - PRIMARY KEY (id_pm), - INDEX idx_id_member (id_member_from, deleted_by_sender), - INDEX idx_msgtime (msgtime), - INDEX idx_id_pm_head (id_pm_head) -) ENGINE={$engine}; - -# -# Table structure for table `pm_labels` -# -CREATE TABLE {$db_prefix}pm_labels ( - id_label INT UNSIGNED AUTO_INCREMENT, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - name VARCHAR(30) NOT NULL DEFAULT '', - PRIMARY KEY (id_label) -) ENGINE={$engine}; - -# -# Table structure for table `pm_labeled_messages` -# -CREATE TABLE {$db_prefix}pm_labeled_messages ( - id_label INT UNSIGNED DEFAULT '0', - id_pm INT UNSIGNED DEFAULT '0', - PRIMARY KEY (id_label, id_pm) -) ENGINE={$engine}; - -# -# Table structure for table `pm_recipients` -# - -CREATE TABLE {$db_prefix}pm_recipients ( - id_pm INT UNSIGNED DEFAULT '0', - id_member MEDIUMINT UNSIGNED DEFAULT '0', - bcc TINYINT UNSIGNED NOT NULL DEFAULT '0', - is_read TINYINT UNSIGNED NOT NULL DEFAULT '0', - is_new TINYINT UNSIGNED NOT NULL DEFAULT '0', - deleted TINYINT UNSIGNED NOT NULL DEFAULT '0', - in_inbox TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_pm, id_member), - UNIQUE idx_id_member (id_member, deleted, id_pm) -) ENGINE={$engine}; - -# -# Table structure for table `pm_rules` -# - -CREATE TABLE {$db_prefix}pm_rules ( - id_rule INT UNSIGNED AUTO_INCREMENT, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - rule_name VARCHAR(60) NOT NULL, - criteria TEXT NOT NULL, - actions TEXT NOT NULL, - delete_pm TINYINT UNSIGNED NOT NULL DEFAULT '0', - is_or TINYINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_rule), - INDEX idx_id_member (id_member), - INDEX idx_delete_pm (delete_pm) -) ENGINE={$engine}; - -# -# Table structure for table `polls` -# - -CREATE TABLE {$db_prefix}polls ( - id_poll MEDIUMINT UNSIGNED AUTO_INCREMENT, - question VARCHAR(255) NOT NULL DEFAULT '', - voting_locked TINYINT NOT NULL DEFAULT '0', - max_votes TINYINT UNSIGNED NOT NULL DEFAULT '1', - expire_time INT UNSIGNED NOT NULL DEFAULT '0', - hide_results TINYINT UNSIGNED NOT NULL DEFAULT '0', - change_vote TINYINT UNSIGNED NOT NULL DEFAULT '0', - guest_vote TINYINT UNSIGNED NOT NULL DEFAULT '0', - num_guest_voters INT UNSIGNED NOT NULL DEFAULT '0', - reset_poll INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - poster_name VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_poll) -) ENGINE={$engine}; - -# -# Table structure for table `poll_choices` -# - -CREATE TABLE {$db_prefix}poll_choices ( - id_poll MEDIUMINT UNSIGNED DEFAULT '0', - id_choice TINYINT UNSIGNED DEFAULT '0', - label VARCHAR(255) NOT NULL DEFAULT '', - votes SMALLINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_poll, id_choice) -) ENGINE={$engine}; - -# -# Table structure for table `qanda` -# - -CREATE TABLE {$db_prefix}qanda ( - id_question SMALLINT UNSIGNED AUTO_INCREMENT, - lngfile VARCHAR(255) NOT NULL DEFAULT '', - question VARCHAR(255) NOT NULL DEFAULT '', - answers TEXT NOT NULL, - PRIMARY KEY (id_question), - INDEX idx_lngfile (lngfile) -) ENGINE={$engine}; - -# -# Table structure for table `scheduled_tasks` -# - -CREATE TABLE {$db_prefix}scheduled_tasks ( - id_task SMALLINT AUTO_INCREMENT, - next_time INT NOT NULL DEFAULT '0', - time_offset INT NOT NULL DEFAULT '0', - time_regularity SMALLINT NOT NULL DEFAULT '0', - time_unit VARCHAR(1) NOT NULL DEFAULT 'h', - disabled TINYINT NOT NULL DEFAULT '0', - task VARCHAR(24) NOT NULL DEFAULT '', - callable VARCHAR(60) NOT NULL DEFAULT '', - PRIMARY KEY (id_task), - INDEX idx_next_time (next_time), - INDEX idx_disabled (disabled), - UNIQUE idx_task (task) -) ENGINE={$engine}; - -# -# Table structure for table `settings` -# - -CREATE TABLE {$db_prefix}settings ( - variable VARCHAR(255) DEFAULT '', - value TEXT NOT NULL, - PRIMARY KEY (variable(30)) -) ENGINE={$engine}; - -# -# Table structure for table `sessions` -# - -CREATE TABLE {$db_prefix}sessions ( - session_id VARCHAR(128) NOT NULL DEFAULT '', - last_update INT UNSIGNED NOT NULL DEFAULT '0', - data TEXT NOT NULL, - PRIMARY KEY (session_id) -) ENGINE={$engine}; - -# -# Table structure for table `smileys` -# - -CREATE TABLE {$db_prefix}smileys ( - id_smiley SMALLINT UNSIGNED AUTO_INCREMENT, - code VARCHAR(30) NOT NULL DEFAULT '', - description VARCHAR(80) NOT NULL DEFAULT '', - smiley_row TINYINT UNSIGNED NOT NULL DEFAULT '0', - smiley_order SMALLINT UNSIGNED NOT NULL DEFAULT '0', - hidden TINYINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (id_smiley) -) ENGINE={$engine}; - -# -# Table structure for table `smiley_files` -# - -CREATE TABLE {$db_prefix}smiley_files -( - id_smiley SMALLINT NOT NULL DEFAULT '0', - smiley_set VARCHAR(48) NOT NULL DEFAULT '', - filename VARCHAR(48) NOT NULL DEFAULT '', - PRIMARY KEY (id_smiley, smiley_set) -) ENGINE={$engine}; - -# -# Table structure for table `spiders` -# - -CREATE TABLE {$db_prefix}spiders ( - id_spider SMALLINT UNSIGNED AUTO_INCREMENT, - spider_name VARCHAR(255) NOT NULL DEFAULT '', - user_agent VARCHAR(255) NOT NULL DEFAULT '', - ip_info VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY id_spider(id_spider) -) ENGINE={$engine}; - -# -# Table structure for table `subscriptions` -# - -CREATE TABLE {$db_prefix}subscriptions( - id_subscribe MEDIUMINT UNSIGNED AUTO_INCREMENT, - name VARCHAR(60) NOT NULL DEFAULT '', - description VARCHAR(255) NOT NULL DEFAULT '', - cost TEXT NOT NULL, - length VARCHAR(6) NOT NULL DEFAULT '', - id_group SMALLINT NOT NULL DEFAULT '0', - add_groups VARCHAR(40) NOT NULL DEFAULT '', - active TINYINT NOT NULL DEFAULT '1', - repeatable TINYINT NOT NULL DEFAULT '0', - allow_partial TINYINT NOT NULL DEFAULT '0', - reminder TINYINT NOT NULL DEFAULT '0', - email_complete TEXT NOT NULL, - PRIMARY KEY (id_subscribe), - INDEX idx_active (active) -) ENGINE={$engine}; - -# -# Table structure for table `themes` -# - -CREATE TABLE {$db_prefix}themes ( - id_member MEDIUMINT DEFAULT '0', - id_theme TINYINT UNSIGNED DEFAULT '1', - variable VARCHAR(255) DEFAULT '', - value TEXT NOT NULL, - PRIMARY KEY (id_theme, id_member, variable(30)), - INDEX idx_id_member (id_member) -) ENGINE={$engine}; - -# -# Table structure for table `topics` -# - -CREATE TABLE {$db_prefix}topics ( - id_topic MEDIUMINT UNSIGNED AUTO_INCREMENT, - is_sticky TINYINT NOT NULL DEFAULT '0', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - id_first_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_last_msg INT UNSIGNED NOT NULL DEFAULT '0', - id_member_started MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_member_updated MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_poll MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_previous_board SMALLINT NOT NULL DEFAULT '0', - id_previous_topic MEDIUMINT NOT NULL DEFAULT '0', - num_replies INT UNSIGNED NOT NULL DEFAULT '0', - num_views INT UNSIGNED NOT NULL DEFAULT '0', - locked TINYINT NOT NULL DEFAULT '0', - redirect_expires INT UNSIGNED NOT NULL DEFAULT '0', - id_redirect_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - unapproved_posts SMALLINT NOT NULL DEFAULT '0', - approved TINYINT NOT NULL DEFAULT '1', - PRIMARY KEY (id_topic), - UNIQUE idx_last_message (id_last_msg, id_board), - UNIQUE idx_first_message (id_first_msg, id_board), - UNIQUE idx_poll (id_poll, id_topic), - INDEX idx_is_sticky (is_sticky), - INDEX idx_approved (approved), - INDEX idx_member_started (id_member_started, id_board), - INDEX idx_last_message_sticky (id_board, is_sticky, id_last_msg), - INDEX idx_board_news (id_board, id_first_msg) -) ENGINE={$engine}; - -# -# Table structure for table `user_alerts` -# - -CREATE TABLE {$db_prefix}user_alerts ( - id_alert INT UNSIGNED AUTO_INCREMENT, - alert_time INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_member_started MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - member_name VARCHAR(255) NOT NULL DEFAULT '', - content_type VARCHAR(255) NOT NULL DEFAULT '', - content_id INT UNSIGNED NOT NULL DEFAULT '0', - content_action VARCHAR(255) NOT NULL DEFAULT '', - is_read INT UNSIGNED NOT NULL DEFAULT '0', - extra TEXT NOT NULL, - PRIMARY KEY (id_alert), - INDEX idx_id_member (id_member), - INDEX idx_alert_time (alert_time) -) ENGINE={$engine}; - -# -# Table structure for table `user_alerts_prefs` -# - -CREATE TABLE {$db_prefix}user_alerts_prefs ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - alert_pref VARCHAR(32) DEFAULT '', - alert_value TINYINT NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, alert_pref) -) ENGINE={$engine}; - -# -# Table structure for table `user_drafts` -# - -CREATE TABLE {$db_prefix}user_drafts ( - id_draft INT UNSIGNED AUTO_INCREMENT, - id_topic MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - id_board SMALLINT UNSIGNED NOT NULL DEFAULT '0', - id_reply INT UNSIGNED NOT NULL DEFAULT '0', - type TINYINT NOT NULL DEFAULT '0', - poster_time INT UNSIGNED NOT NULL DEFAULT '0', - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - subject VARCHAR(255) NOT NULL DEFAULT '', - smileys_enabled TINYINT NOT NULL DEFAULT '1', - body MEDIUMTEXT NOT NULL, - icon VARCHAR(16) NOT NULL DEFAULT 'xx', - locked TINYINT NOT NULL DEFAULT '0', - is_sticky TINYINT NOT NULL DEFAULT '0', - to_list VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_draft), - UNIQUE idx_id_member (id_member, id_draft, type) -) ENGINE={$engine}; - -# -# Table structure for table `user_likes` -# - -CREATE TABLE {$db_prefix}user_likes ( - id_member MEDIUMINT UNSIGNED DEFAULT '0', - content_type CHAR(6) DEFAULT '', - content_id INT UNSIGNED DEFAULT '0', - like_time INT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (content_id, content_type, id_member), - INDEX content (content_id, content_type), - INDEX liker (id_member) -) ENGINE={$engine}; - -# -# Table structure for table `mentions` -# -CREATE TABLE {$db_prefix}mentions ( - content_id INT DEFAULT '0', - content_type VARCHAR(10) DEFAULT '', - id_mentioned INT DEFAULT 0, - id_member MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, - `time` INT NOT NULL DEFAULT 0, - PRIMARY KEY (content_id, content_type, id_mentioned), - INDEX content (content_id, content_type), - INDEX mentionee (id_member) -) ENGINE={$engine}; - -# Transactions for the win - only used if we have InnoDB available... -START TRANSACTION; - -# -# Dumping data for table `admin_info_files` -# - -INSERT INTO {$db_prefix}admin_info_files - (id_file, filename, path, parameters, data, filetype) -VALUES - (1, 'current-version.js', '/smf/', 'version=%3$s', '', 'text/javascript'), - (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript'), - (3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript'), - (4, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'); -# -------------------------------------------------------- - -# -# Dumping data for table `board_permissions` -# - -INSERT INTO {$db_prefix}board_permissions - (id_group, id_profile, permission) -VALUES (-1, 1, 'poll_view'), - (0, 1, 'remove_own'), - (0, 1, 'lock_own'), - (0, 1, 'modify_own'), - (0, 1, 'poll_add_own'), - (0, 1, 'poll_edit_own'), - (0, 1, 'poll_lock_own'), - (0, 1, 'poll_post'), - (0, 1, 'poll_view'), - (0, 1, 'poll_vote'), - (0, 1, 'post_attachment'), - (0, 1, 'post_new'), - (0, 1, 'post_draft'), - (0, 1, 'post_reply_any'), - (0, 1, 'post_reply_own'), - (0, 1, 'post_unapproved_topics'), - (0, 1, 'post_unapproved_replies_any'), - (0, 1, 'post_unapproved_replies_own'), - (0, 1, 'post_unapproved_attachments'), - (0, 1, 'delete_own'), - (0, 1, 'report_any'), - (0, 1, 'view_attachments'), - (2, 1, 'moderate_board'), - (2, 1, 'post_new'), - (2, 1, 'post_draft'), - (2, 1, 'post_reply_own'), - (2, 1, 'post_reply_any'), - (2, 1, 'post_unapproved_topics'), - (2, 1, 'post_unapproved_replies_any'), - (2, 1, 'post_unapproved_replies_own'), - (2, 1, 'post_unapproved_attachments'), - (2, 1, 'poll_post'), - (2, 1, 'poll_add_any'), - (2, 1, 'poll_remove_any'), - (2, 1, 'poll_view'), - (2, 1, 'poll_vote'), - (2, 1, 'poll_lock_any'), - (2, 1, 'poll_edit_any'), - (2, 1, 'report_any'), - (2, 1, 'lock_own'), - (2, 1, 'delete_own'), - (2, 1, 'modify_own'), - (2, 1, 'make_sticky'), - (2, 1, 'lock_any'), - (2, 1, 'remove_any'), - (2, 1, 'move_any'), - (2, 1, 'merge_any'), - (2, 1, 'split_any'), - (2, 1, 'delete_any'), - (2, 1, 'modify_any'), - (2, 1, 'approve_posts'), - (2, 1, 'post_attachment'), - (2, 1, 'view_attachments'), - (3, 1, 'moderate_board'), - (3, 1, 'post_new'), - (3, 1, 'post_draft'), - (3, 1, 'post_reply_own'), - (3, 1, 'post_reply_any'), - (3, 1, 'post_unapproved_topics'), - (3, 1, 'post_unapproved_replies_any'), - (3, 1, 'post_unapproved_replies_own'), - (3, 1, 'post_unapproved_attachments'), - (3, 1, 'poll_post'), - (3, 1, 'poll_add_any'), - (3, 1, 'poll_remove_any'), - (3, 1, 'poll_view'), - (3, 1, 'poll_vote'), - (3, 1, 'poll_lock_any'), - (3, 1, 'poll_edit_any'), - (3, 1, 'report_any'), - (3, 1, 'lock_own'), - (3, 1, 'delete_own'), - (3, 1, 'modify_own'), - (3, 1, 'make_sticky'), - (3, 1, 'lock_any'), - (3, 1, 'remove_any'), - (3, 1, 'move_any'), - (3, 1, 'merge_any'), - (3, 1, 'split_any'), - (3, 1, 'delete_any'), - (3, 1, 'modify_any'), - (3, 1, 'approve_posts'), - (3, 1, 'post_attachment'), - (3, 1, 'view_attachments'), - (-1, 2, 'poll_view'), - (0, 2, 'remove_own'), - (0, 2, 'lock_own'), - (0, 2, 'modify_own'), - (0, 2, 'poll_view'), - (0, 2, 'poll_vote'), - (0, 2, 'post_attachment'), - (0, 2, 'post_new'), - (0, 2, 'post_draft'), - (0, 2, 'post_reply_any'), - (0, 2, 'post_reply_own'), - (0, 2, 'post_unapproved_topics'), - (0, 2, 'post_unapproved_replies_any'), - (0, 2, 'post_unapproved_replies_own'), - (0, 2, 'post_unapproved_attachments'), - (0, 2, 'delete_own'), - (0, 2, 'report_any'), - (0, 2, 'view_attachments'), - (2, 2, 'moderate_board'), - (2, 2, 'post_new'), - (2, 2, 'post_draft'), - (2, 2, 'post_reply_own'), - (2, 2, 'post_reply_any'), - (2, 2, 'post_unapproved_topics'), - (2, 2, 'post_unapproved_replies_any'), - (2, 2, 'post_unapproved_replies_own'), - (2, 2, 'post_unapproved_attachments'), - (2, 2, 'poll_post'), - (2, 2, 'poll_add_any'), - (2, 2, 'poll_remove_any'), - (2, 2, 'poll_view'), - (2, 2, 'poll_vote'), - (2, 2, 'poll_lock_any'), - (2, 2, 'poll_edit_any'), - (2, 2, 'report_any'), - (2, 2, 'lock_own'), - (2, 2, 'delete_own'), - (2, 2, 'modify_own'), - (2, 2, 'make_sticky'), - (2, 2, 'lock_any'), - (2, 2, 'remove_any'), - (2, 2, 'move_any'), - (2, 2, 'merge_any'), - (2, 2, 'split_any'), - (2, 2, 'delete_any'), - (2, 2, 'modify_any'), - (2, 2, 'approve_posts'), - (2, 2, 'post_attachment'), - (2, 2, 'view_attachments'), - (3, 2, 'moderate_board'), - (3, 2, 'post_new'), - (3, 2, 'post_draft'), - (3, 2, 'post_reply_own'), - (3, 2, 'post_reply_any'), - (3, 2, 'post_unapproved_topics'), - (3, 2, 'post_unapproved_replies_any'), - (3, 2, 'post_unapproved_replies_own'), - (3, 2, 'post_unapproved_attachments'), - (3, 2, 'poll_post'), - (3, 2, 'poll_add_any'), - (3, 2, 'poll_remove_any'), - (3, 2, 'poll_view'), - (3, 2, 'poll_vote'), - (3, 2, 'poll_lock_any'), - (3, 2, 'poll_edit_any'), - (3, 2, 'report_any'), - (3, 2, 'lock_own'), - (3, 2, 'delete_own'), - (3, 2, 'modify_own'), - (3, 2, 'make_sticky'), - (3, 2, 'lock_any'), - (3, 2, 'remove_any'), - (3, 2, 'move_any'), - (3, 2, 'merge_any'), - (3, 2, 'split_any'), - (3, 2, 'delete_any'), - (3, 2, 'modify_any'), - (3, 2, 'approve_posts'), - (3, 2, 'post_attachment'), - (3, 2, 'view_attachments'), - (-1, 3, 'poll_view'), - (0, 3, 'remove_own'), - (0, 3, 'lock_own'), - (0, 3, 'modify_own'), - (0, 3, 'poll_view'), - (0, 3, 'poll_vote'), - (0, 3, 'post_attachment'), - (0, 3, 'post_reply_any'), - (0, 3, 'post_reply_own'), - (0, 3, 'post_unapproved_replies_any'), - (0, 3, 'post_unapproved_replies_own'), - (0, 3, 'post_unapproved_attachments'), - (0, 3, 'delete_own'), - (0, 3, 'report_any'), - (0, 3, 'view_attachments'), - (2, 3, 'moderate_board'), - (2, 3, 'post_new'), - (2, 3, 'post_draft'), - (2, 3, 'post_reply_own'), - (2, 3, 'post_reply_any'), - (2, 3, 'post_unapproved_topics'), - (2, 3, 'post_unapproved_replies_any'), - (2, 3, 'post_unapproved_replies_own'), - (2, 3, 'post_unapproved_attachments'), - (2, 3, 'poll_post'), - (2, 3, 'poll_add_any'), - (2, 3, 'poll_remove_any'), - (2, 3, 'poll_view'), - (2, 3, 'poll_vote'), - (2, 3, 'poll_lock_any'), - (2, 3, 'poll_edit_any'), - (2, 3, 'report_any'), - (2, 3, 'lock_own'), - (2, 3, 'delete_own'), - (2, 3, 'modify_own'), - (2, 3, 'make_sticky'), - (2, 3, 'lock_any'), - (2, 3, 'remove_any'), - (2, 3, 'move_any'), - (2, 3, 'merge_any'), - (2, 3, 'split_any'), - (2, 3, 'delete_any'), - (2, 3, 'modify_any'), - (2, 3, 'approve_posts'), - (2, 3, 'post_attachment'), - (2, 3, 'view_attachments'), - (3, 3, 'moderate_board'), - (3, 3, 'post_new'), - (3, 3, 'post_draft'), - (3, 3, 'post_reply_own'), - (3, 3, 'post_reply_any'), - (3, 3, 'post_unapproved_topics'), - (3, 3, 'post_unapproved_replies_any'), - (3, 3, 'post_unapproved_replies_own'), - (3, 3, 'post_unapproved_attachments'), - (3, 3, 'poll_post'), - (3, 3, 'poll_add_any'), - (3, 3, 'poll_remove_any'), - (3, 3, 'poll_view'), - (3, 3, 'poll_vote'), - (3, 3, 'poll_lock_any'), - (3, 3, 'poll_edit_any'), - (3, 3, 'report_any'), - (3, 3, 'lock_own'), - (3, 3, 'delete_own'), - (3, 3, 'modify_own'), - (3, 3, 'make_sticky'), - (3, 3, 'lock_any'), - (3, 3, 'remove_any'), - (3, 3, 'move_any'), - (3, 3, 'merge_any'), - (3, 3, 'split_any'), - (3, 3, 'delete_any'), - (3, 3, 'modify_any'), - (3, 3, 'approve_posts'), - (3, 3, 'post_attachment'), - (3, 3, 'view_attachments'), - (-1, 4, 'poll_view'), - (0, 4, 'poll_view'), - (0, 4, 'poll_vote'), - (0, 4, 'report_any'), - (0, 4, 'view_attachments'), - (2, 4, 'moderate_board'), - (2, 4, 'post_new'), - (2, 4, 'post_draft'), - (2, 4, 'post_reply_own'), - (2, 4, 'post_reply_any'), - (2, 4, 'post_unapproved_topics'), - (2, 4, 'post_unapproved_replies_any'), - (2, 4, 'post_unapproved_replies_own'), - (2, 4, 'post_unapproved_attachments'), - (2, 4, 'poll_post'), - (2, 4, 'poll_add_any'), - (2, 4, 'poll_remove_any'), - (2, 4, 'poll_view'), - (2, 4, 'poll_vote'), - (2, 4, 'poll_lock_any'), - (2, 4, 'poll_edit_any'), - (2, 4, 'report_any'), - (2, 4, 'lock_own'), - (2, 4, 'delete_own'), - (2, 4, 'modify_own'), - (2, 4, 'make_sticky'), - (2, 4, 'lock_any'), - (2, 4, 'remove_any'), - (2, 4, 'move_any'), - (2, 4, 'merge_any'), - (2, 4, 'split_any'), - (2, 4, 'delete_any'), - (2, 4, 'modify_any'), - (2, 4, 'approve_posts'), - (2, 4, 'post_attachment'), - (2, 4, 'view_attachments'), - (3, 4, 'moderate_board'), - (3, 4, 'post_new'), - (3, 4, 'post_draft'), - (3, 4, 'post_reply_own'), - (3, 4, 'post_reply_any'), - (3, 4, 'post_unapproved_topics'), - (3, 4, 'post_unapproved_replies_any'), - (3, 4, 'post_unapproved_replies_own'), - (3, 4, 'post_unapproved_attachments'), - (3, 4, 'poll_post'), - (3, 4, 'poll_add_any'), - (3, 4, 'poll_remove_any'), - (3, 4, 'poll_view'), - (3, 4, 'poll_vote'), - (3, 4, 'poll_lock_any'), - (3, 4, 'poll_edit_any'), - (3, 4, 'report_any'), - (3, 4, 'lock_own'), - (3, 4, 'delete_own'), - (3, 4, 'modify_own'), - (3, 4, 'make_sticky'), - (3, 4, 'lock_any'), - (3, 4, 'remove_any'), - (3, 4, 'move_any'), - (3, 4, 'merge_any'), - (3, 4, 'split_any'), - (3, 4, 'delete_any'), - (3, 4, 'modify_any'), - (3, 4, 'approve_posts'), - (3, 4, 'post_attachment'), - (3, 4, 'view_attachments'); -# -------------------------------------------------------- - -# -# Dumping data for table `boards` -# - -INSERT INTO {$db_prefix}boards - (id_board, id_cat, board_order, id_last_msg, id_msg_updated, name, description, num_topics, num_posts, member_groups) -VALUES (1, 1, 1, 1, 1, '{$default_board_name}', '{$default_board_description}', 1, 1, '-1,0,2'); -# -------------------------------------------------------- - - -# -# Dumping data for table `board_permissions_view` -# - -INSERT INTO {$db_prefix}board_permissions_view - (id_group, id_board, deny) -VALUES (-1, 1, 0), - (0, 1, 0), - (2, 1, 0); -# -------------------------------------------------------- - -# -# Dumping data for table `calendar_holidays` -# - -INSERT INTO {$db_prefix}calendar_holidays - (title, event_date) -VALUES ('New Year''s', '1004-01-01'), - ('Christmas', '1004-12-25'), - ('Valentine''s Day', '1004-02-14'), - ('St. Patrick''s Day', '1004-03-17'), - ('April Fools', '1004-04-01'), - ('Earth Day', '1004-04-22'), - ('United Nations Day', '1004-10-24'), - ('Halloween', '1004-10-31'), - ('Mother''s Day', '2010-05-09'), - ('Mother''s Day', '2011-05-08'), - ('Mother''s Day', '2012-05-13'), - ('Mother''s Day', '2013-05-12'), - ('Mother''s Day', '2014-05-11'), - ('Mother''s Day', '2015-05-10'), - ('Mother''s Day', '2016-05-08'), - ('Mother''s Day', '2017-05-14'), - ('Mother''s Day', '2018-05-13'), - ('Mother''s Day', '2019-05-12'), - ('Mother''s Day', '2020-05-10'), - ('Mother''s Day', '2021-05-09'), - ('Mother''s Day', '2022-05-08'), - ('Mother''s Day', '2023-05-14'), - ('Mother''s Day', '2024-05-12'), - ('Mother''s Day', '2025-05-11'), - ('Mother''s Day', '2026-05-10'), - ('Mother''s Day', '2027-05-09'), - ('Mother''s Day', '2028-05-14'), - ('Mother''s Day', '2029-05-13'), - ('Mother''s Day', '2030-05-12'), - ('Father''s Day', '2010-06-20'), - ('Father''s Day', '2011-06-19'), - ('Father''s Day', '2012-06-17'), - ('Father''s Day', '2013-06-16'), - ('Father''s Day', '2014-06-15'), - ('Father''s Day', '2015-06-21'), - ('Father''s Day', '2016-06-19'), - ('Father''s Day', '2017-06-18'), - ('Father''s Day', '2018-06-17'), - ('Father''s Day', '2019-06-16'), - ('Father''s Day', '2020-06-21'), - ('Father''s Day', '2021-06-20'), - ('Father''s Day', '2022-06-19'), - ('Father''s Day', '2023-06-18'), - ('Father''s Day', '2024-06-16'), - ('Father''s Day', '2025-06-15'), - ('Father''s Day', '2026-06-21'), - ('Father''s Day', '2027-06-20'), - ('Father''s Day', '2028-06-18'), - ('Father''s Day', '2029-06-17'), - ('Father''s Day', '2030-06-16'), - ('Summer Solstice', '2010-06-21'), - ('Summer Solstice', '2011-06-21'), - ('Summer Solstice', '2012-06-20'), - ('Summer Solstice', '2013-06-21'), - ('Summer Solstice', '2014-06-21'), - ('Summer Solstice', '2015-06-21'), - ('Summer Solstice', '2016-06-20'), - ('Summer Solstice', '2017-06-20'), - ('Summer Solstice', '2018-06-21'), - ('Summer Solstice', '2019-06-21'), - ('Summer Solstice', '2020-06-20'), - ('Summer Solstice', '2021-06-21'), - ('Summer Solstice', '2022-06-21'), - ('Summer Solstice', '2023-06-21'), - ('Summer Solstice', '2024-06-20'), - ('Summer Solstice', '2025-06-21'), - ('Summer Solstice', '2026-06-21'), - ('Summer Solstice', '2027-06-21'), - ('Summer Solstice', '2028-06-20'), - ('Summer Solstice', '2029-06-21'), - ('Summer Solstice', '2030-06-21'), - ('Vernal Equinox', '2010-03-20'), - ('Vernal Equinox', '2011-03-20'), - ('Vernal Equinox', '2012-03-20'), - ('Vernal Equinox', '2013-03-20'), - ('Vernal Equinox', '2014-03-20'), - ('Vernal Equinox', '2015-03-20'), - ('Vernal Equinox', '2016-03-20'), - ('Vernal Equinox', '2017-03-20'), - ('Vernal Equinox', '2018-03-20'), - ('Vernal Equinox', '2019-03-20'), - ('Vernal Equinox', '2020-03-20'), - ('Vernal Equinox', '2021-03-20'), - ('Vernal Equinox', '2022-03-20'), - ('Vernal Equinox', '2023-03-20'), - ('Vernal Equinox', '2024-03-20'), - ('Vernal Equinox', '2025-03-20'), - ('Vernal Equinox', '2026-03-20'), - ('Vernal Equinox', '2027-03-20'), - ('Vernal Equinox', '2028-03-20'), - ('Vernal Equinox', '2029-03-20'), - ('Vernal Equinox', '2030-03-20'), - ('Winter Solstice', '2010-12-21'), - ('Winter Solstice', '2011-12-22'), - ('Winter Solstice', '2012-12-21'), - ('Winter Solstice', '2013-12-21'), - ('Winter Solstice', '2014-12-21'), - ('Winter Solstice', '2015-12-22'), - ('Winter Solstice', '2016-12-21'), - ('Winter Solstice', '2017-12-21'), - ('Winter Solstice', '2018-12-21'), - ('Winter Solstice', '2019-12-22'), - ('Winter Solstice', '2020-12-21'), - ('Winter Solstice', '2021-12-21'), - ('Winter Solstice', '2022-12-21'), - ('Winter Solstice', '2023-12-22'), - ('Winter Solstice', '2024-12-21'), - ('Winter Solstice', '2025-12-21'), - ('Winter Solstice', '2026-12-21'), - ('Winter Solstice', '2027-12-22'), - ('Winter Solstice', '2028-12-21'), - ('Winter Solstice', '2029-12-21'), - ('Winter Solstice', '2030-12-21'), - ('Autumnal Equinox', '2010-09-23'), - ('Autumnal Equinox', '2011-09-23'), - ('Autumnal Equinox', '2012-09-22'), - ('Autumnal Equinox', '2013-09-22'), - ('Autumnal Equinox', '2014-09-23'), - ('Autumnal Equinox', '2015-09-23'), - ('Autumnal Equinox', '2016-09-22'), - ('Autumnal Equinox', '2017-09-22'), - ('Autumnal Equinox', '2018-09-23'), - ('Autumnal Equinox', '2019-09-23'), - ('Autumnal Equinox', '2020-09-22'), - ('Autumnal Equinox', '2021-09-22'), - ('Autumnal Equinox', '2022-09-23'), - ('Autumnal Equinox', '2023-09-23'), - ('Autumnal Equinox', '2024-09-22'), - ('Autumnal Equinox', '2025-09-22'), - ('Autumnal Equinox', '2026-09-23'), - ('Autumnal Equinox', '2027-09-23'), - ('Autumnal Equinox', '2028-09-22'), - ('Autumnal Equinox', '2029-09-22'), - ('Autumnal Equinox', '2030-09-22'); - -INSERT INTO {$db_prefix}calendar_holidays - (title, event_date) -VALUES ('Independence Day', '1004-07-04'), - ('Cinco de Mayo', '1004-05-05'), - ('Flag Day', '1004-06-14'), - ('Veterans Day', '1004-11-11'), - ('Groundhog Day', '1004-02-02'), - ('Thanksgiving', '2010-11-25'), - ('Thanksgiving', '2011-11-24'), - ('Thanksgiving', '2012-11-22'), - ('Thanksgiving', '2013-11-28'), - ('Thanksgiving', '2014-11-27'), - ('Thanksgiving', '2015-11-26'), - ('Thanksgiving', '2016-11-24'), - ('Thanksgiving', '2017-11-23'), - ('Thanksgiving', '2018-11-22'), - ('Thanksgiving', '2019-11-28'), - ('Thanksgiving', '2020-11-26'), - ('Thanksgiving', '2021-11-25'), - ('Thanksgiving', '2022-11-24'), - ('Thanksgiving', '2023-11-23'), - ('Thanksgiving', '2024-11-28'), - ('Thanksgiving', '2025-11-27'), - ('Thanksgiving', '2026-11-26'), - ('Thanksgiving', '2027-11-25'), - ('Thanksgiving', '2028-11-23'), - ('Thanksgiving', '2029-11-22'), - ('Thanksgiving', '2030-11-28'), - ('Memorial Day', '2010-05-31'), - ('Memorial Day', '2011-05-30'), - ('Memorial Day', '2012-05-28'), - ('Memorial Day', '2013-05-27'), - ('Memorial Day', '2014-05-26'), - ('Memorial Day', '2015-05-25'), - ('Memorial Day', '2016-05-30'), - ('Memorial Day', '2017-05-29'), - ('Memorial Day', '2018-05-28'), - ('Memorial Day', '2019-05-27'), - ('Memorial Day', '2020-05-25'), - ('Memorial Day', '2021-05-31'), - ('Memorial Day', '2022-05-30'), - ('Memorial Day', '2023-05-29'), - ('Memorial Day', '2024-05-27'), - ('Memorial Day', '2025-05-26'), - ('Memorial Day', '2026-05-25'), - ('Memorial Day', '2027-05-31'), - ('Memorial Day', '2028-05-29'), - ('Memorial Day', '2029-05-28'), - ('Memorial Day', '2030-05-27'), - ('Labor Day', '2010-09-06'), - ('Labor Day', '2011-09-05'), - ('Labor Day', '2012-09-03'), - ('Labor Day', '2013-09-02'), - ('Labor Day', '2014-09-01'), - ('Labor Day', '2015-09-07'), - ('Labor Day', '2016-09-05'), - ('Labor Day', '2017-09-04'), - ('Labor Day', '2018-09-03'), - ('Labor Day', '2019-09-02'), - ('Labor Day', '2020-09-07'), - ('Labor Day', '2021-09-06'), - ('Labor Day', '2022-09-05'), - ('Labor Day', '2023-09-04'), - ('Labor Day', '2024-09-02'), - ('Labor Day', '2025-09-01'), - ('Labor Day', '2026-09-07'), - ('Labor Day', '2027-09-06'), - ('Labor Day', '2028-09-04'), - ('Labor Day', '2029-09-03'), - ('Labor Day', '2030-09-02'), - ('D-Day', '1004-06-06'); -# -------------------------------------------------------- - -# -# Dumping data for table `categories` -# - -INSERT INTO {$db_prefix}categories - (id_cat, cat_order, name, description, can_collapse) -VALUES (1, 0, '{$default_category_name}', '', 1); -# -------------------------------------------------------- - -# -# Dumping data for table `custom_fields` -# - -INSERT INTO {$db_prefix}custom_fields - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `field_order`, `mask`, `show_reg`, `show_display`, `show_mlist`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES ('cust_icq', '{icq}', '{icq_desc}', 'text', 12, '', 1, 'regex~[1-9][0-9]{4,9}~i', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', 'ICQ - {INPUT}', 1), - ('cust_skype', '{skype}', '{skype_desc}', 'text', 32, '', 2, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '{INPUT} ', 1), - ('cust_loca', '{location}', '{location_desc}', 'text', 50, '', 4, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '', 0), - ('cust_gender', '{gender}', '{gender_desc}', 'radio', 255, '{gender_0},{gender_1},{gender_2}', 5, 'nohtml', 1, 1, 0, 'forumprofile', 0, 1, 0, 0, '{gender_0}', '', 1); - -# -------------------------------------------------------- - -# -# Dumping data for table `membergroups` -# - -INSERT INTO {$db_prefix}membergroups - (id_group, group_name, description, online_color, min_posts, icons, group_type) -VALUES (1, '{$default_administrator_group}', '', '#FF0000', -1, '5#iconadmin.png', 1), - (2, '{$default_global_moderator_group}', '', '#0000FF', -1, '5#icongmod.png', 0), - (3, '{$default_moderator_group}', '', '', -1, '5#iconmod.png', 0), - (4, '{$default_newbie_group}', '', '', 0, '1#icon.png', 0), - (5, '{$default_junior_group}', '', '', 50, '2#icon.png', 0), - (6, '{$default_full_group}', '', '', 100, '3#icon.png', 0), - (7, '{$default_senior_group}', '', '', 250, '4#icon.png', 0), - (8, '{$default_hero_group}', '', '', 500, '5#icon.png', 0); -# -------------------------------------------------------- - -# -# Dumping data for table `message_icons` -# - -# // @todo i18n -INSERT INTO {$db_prefix}message_icons - (filename, title, icon_order) -VALUES ('xx', 'Standard', '0'), - ('thumbup', 'Thumb Up', '1'), - ('thumbdown', 'Thumb Down', '2'), - ('exclamation', 'Exclamation point', '3'), - ('question', 'Question mark', '4'), - ('lamp', 'Lamp', '5'), - ('smiley', 'Smiley', '6'), - ('angry', 'Angry', '7'), - ('cheesy', 'Cheesy', '8'), - ('grin', 'Grin', '9'), - ('sad', 'Sad', '10'), - ('wink', 'Wink', '11'), - ('poll', 'Poll', '12'); -# -------------------------------------------------------- - -# -# Dumping data for table `messages` -# - -INSERT INTO {$db_prefix}messages - (id_msg, id_msg_modified, id_topic, id_board, poster_time, subject, poster_name, poster_email, modified_name, body, icon) -VALUES (1, 1, 1, 1, UNIX_TIMESTAMP(), '{$default_topic_subject}', 'Simple Machines', 'info@simplemachines.org', '', '{$default_topic_message}', 'xx'); -# -------------------------------------------------------- - -# -# Dumping data for table `package_servers` -# - -INSERT INTO {$db_prefix}package_servers - (name, url, validation_url) -VALUES ('Simple Machines Third-party Mod Site', 'https://custom.simplemachines.org/packages/mods', 'https://custom.simplemachines.org/api.php?action=validate;version=v1;smf_version={SMF_VERSION}'), - ('Simple Machines Downloads Site', 'https://download.simplemachines.org/browse.php?api=v1;smf_version={SMF_VERSION}', 'https://download.simplemachines.org/validate.php?api=v1;smf_version={SMF_VERSION}'); -# -------------------------------------------------------- - -# -# Dumping data for table `permission_profiles` -# - -INSERT INTO {$db_prefix}permission_profiles - (id_profile, profile_name) -VALUES (1, 'default'), - (2, 'no_polls'), - (3, 'reply_only'), - (4, 'read_only'); -# -------------------------------------------------------- - -# -# Dumping data for table `permissions` -# - -INSERT INTO {$db_prefix}permissions - (id_group, permission) -VALUES (-1, 'search_posts'), - (-1, 'calendar_view'), - (-1, 'view_stats'), - (0, 'view_mlist'), - (0, 'search_posts'), - (0, 'profile_view'), - (0, 'pm_read'), - (0, 'pm_send'), - (0, 'pm_draft'), - (0, 'calendar_view'), - (0, 'view_stats'), - (0, 'who_view'), - (0, 'profile_identity_own'), - (0, 'profile_password_own'), - (0, 'profile_blurb_own'), - (0, 'profile_displayed_name_own'), - (0, 'profile_signature_own'), - (0, 'profile_website_own'), - (0, 'profile_forum_own'), - (0, 'profile_extra_own'), - (0, 'profile_remove_own'), - (0, 'profile_server_avatar'), - (0, 'profile_upload_avatar'), - (0, 'profile_remote_avatar'), - (0, 'send_email_to_members'), - (2, 'view_mlist'), - (2, 'search_posts'), - (2, 'profile_view'), - (2, 'pm_read'), - (2, 'pm_send'), - (2, 'pm_draft'), - (2, 'calendar_view'), - (2, 'view_stats'), - (2, 'who_view'), - (2, 'profile_identity_own'), - (2, 'profile_password_own'), - (2, 'profile_blurb_own'), - (2, 'profile_displayed_name_own'), - (2, 'profile_signature_own'), - (2, 'profile_website_own'), - (2, 'profile_forum_own'), - (2, 'profile_extra_own'), - (2, 'profile_remove_own'), - (2, 'profile_server_avatar'), - (2, 'profile_upload_avatar'), - (2, 'profile_remote_avatar'), - (2, 'send_email_to_members'), - (2, 'profile_title_own'), - (2, 'calendar_post'), - (2, 'calendar_edit_any'), - (2, 'access_mod_center'); -# -------------------------------------------------------- - -# -# Dumping data for table `scheduled_tasks` -# - -INSERT INTO {$db_prefix}scheduled_tasks - (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task, callable) -VALUES - (3, 0, 60, 1, 'd', 0, 'daily_maintenance', ''), - (5, 0, 0, 1, 'd', 0, 'daily_digest', ''), - (6, 0, 0, 1, 'w', 0, 'weekly_digest', ''), - (7, 0, {$sched_task_offset}, 1, 'd', 0, 'fetchSMfiles', ''), - (8, 0, 0, 1, 'd', 1, 'birthdayemails', ''), - (9, 0, 0, 1, 'w', 0, 'weekly_maintenance', ''), - (10, 0, 120, 1, 'd', 1, 'paid_subscriptions', ''), - (11, 0, 120, 1, 'd', 0, 'remove_temp_attachments', ''), - (12, 0, 180, 1, 'd', 0, 'remove_topic_redirect', ''), - (13, 0, 240, 1, 'd', 0, 'remove_old_drafts', ''), - (14, 0, 0, 1, 'w', 1, 'prune_log_topics', ''); - -# -------------------------------------------------------- - -# -# Dumping data for table `settings` -# - -INSERT INTO {$db_prefix}settings - (variable, value) -VALUES ('smfVersion', '{$smf_version}'), - ('news', '{$default_news}'), - ('compactTopicPagesContiguous', '5'), - ('compactTopicPagesEnable', '1'), - ('todayMod', '1'), - ('enablePreviousNext', '1'), - ('pollMode', '1'), - ('enableCompressedOutput', '{$enableCompressedOutput}'), - ('attachmentSizeLimit', '128'), - ('attachmentPostLimit', '192'), - ('attachmentNumPerPostLimit', '4'), - ('attachmentDirSizeLimit', '10240'), - ('attachmentDirFileLimit', '1000'), - ('attachmentUploadDir', '{$attachdir}'), - ('attachmentExtensions', 'doc,gif,jpg,mpg,pdf,png,txt,zip'), - ('attachmentCheckExtensions', '0'), - ('attachmentShowImages', '1'), - ('attachmentEnable', '1'), - ('attachmentThumbnails', '1'), - ('attachmentThumbWidth', '150'), - ('attachmentThumbHeight', '150'), - ('use_subdirectories_for_attachments', '1'), - ('currentAttachmentUploadDir', 1), - ('censorIgnoreCase', '1'), - ('mostOnline', '1'), - ('mostOnlineToday', '1'), - ('mostDate', UNIX_TIMESTAMP()), - ('trackStats', '1'), - ('userLanguage', '1'), - ('titlesEnable', '1'), - ('topicSummaryPosts', '15'), - ('enableErrorLogging', '1'), - ('max_image_width', '0'), - ('max_image_height', '0'), - ('onlineEnable', '0'), - ('boardindex_max_depth', '5'), - ('cal_enabled', '0'), - ('cal_showInTopic', '1'), - ('cal_maxyear', '2030'), - ('cal_minyear', '2008'), - ('cal_daysaslink', '0'), - ('cal_defaultboard', ''), - ('cal_showholidays', '1'), - ('cal_showbdays', '1'), - ('cal_showevents', '1'), - ('cal_maxspan', '0'), - ('cal_disable_prev_next', '0'), - ('cal_display_type', '0'), - ('cal_week_links', '2'), - ('cal_prev_next_links', '1'), - ('cal_short_days', '0'), - ('cal_short_months', '0'), - ('smtp_host', ''), - ('smtp_port', '25'), - ('smtp_username', ''), - ('smtp_password', ''), - ('mail_type', '0'), - ('timeLoadPageEnable', '0'), - ('totalMembers', '0'), - ('totalTopics', '1'), - ('totalMessages', '1'), - ('censor_vulgar', ''), - ('censor_proper', ''), - ('enablePostHTML', '0'), - ('theme_allow', '1'), - ('theme_default', '1'), - ('theme_guests', '1'), - ('xmlnews_enable', '1'), - ('xmlnews_maxlen', '255'), - ('registration_method', '{$registration_method}'), - ('send_validation_onChange', '0'), - ('send_welcomeEmail', '1'), - ('allow_editDisplayName', '1'), - ('allow_hideOnline', '1'), - ('spamWaitTime', '5'), - ('pm_spam_settings', '10,5,20'), - ('reserveWord', '0'), - ('reserveCase', '1'), - ('reserveUser', '1'), - ('reserveName', '1'), - ('reserveNames', '{$default_reserved_names}'), - ('autoLinkUrls', '1'), - ('banLastUpdated', '0'), - ('smileys_dir', '{$boarddir}/Smileys'), - ('smileys_url', '{$boardurl}/Smileys'), - ('custom_avatar_dir', '{$boarddir}/custom_avatar'), - ('custom_avatar_url', '{$boardurl}/custom_avatar'), - ('avatar_directory', '{$boarddir}/avatars'), - ('avatar_url', '{$boardurl}/avatars'), - ('avatar_max_height_external', '65'), - ('avatar_max_width_external', '65'), - ('avatar_action_too_large', 'option_css_resize'), - ('avatar_max_height_upload', '65'), - ('avatar_max_width_upload', '65'), - ('avatar_resize_upload', '1'), - ('avatar_download_png', '1'), - ('failed_login_threshold', '3'), - ('oldTopicDays', '120'), - ('edit_wait_time', '90'), - ('edit_disable_time', '0'), - ('autoFixDatabase', '1'), - ('allow_guestAccess', '1'), - ('time_format', '{$default_time_format}'), - ('number_format', '1234.00'), - ('enableBBC', '1'), - ('max_messageLength', '20000'), - ('signature_settings', '1,300,0,0,0,0,0,0:'), - ('defaultMaxMessages', '15'), - ('defaultMaxTopics', '20'), - ('defaultMaxMembers', '30'), - ('enableParticipation', '1'), - ('recycle_enable', '0'), - ('recycle_board', '0'), - ('maxMsgID', '1'), - ('enableAllMessages', '0'), - ('knownThemes', '1'), - ('enableThemes', '1'), - ('who_enabled', '1'), - ('cookieTime', '3153600'), - ('lastActive', '15'), - ('smiley_sets_known', 'fugue,alienine'), - ('smiley_sets_names', '{$default_fugue_smileyset_name}\n{$default_alienine_smileyset_name}'), - ('smiley_sets_default', 'fugue'), - ('cal_days_for_index', '7'), - ('requireAgreement', '1'), - ('requirePolicyAgreement', '0'), - ('unapprovedMembers', '0'), - ('default_personal_text', ''), - ('package_make_backups', '1'), - ('databaseSession_enable', '{$databaseSession_enable}'), - ('databaseSession_loose', '1'), - ('databaseSession_lifetime', '2880'), - ('search_cache_size', '50'), - ('search_results_per_page', '30'), - ('search_weight_frequency', '30'), - ('search_weight_age', '25'), - ('search_weight_length', '20'), - ('search_weight_subject', '15'), - ('search_weight_first_message', '10'), - ('search_max_results', '1200'), - ('search_floodcontrol_time', '5'), - ('permission_enable_deny', '0'), - ('permission_enable_postgroups', '0'), - ('mail_next_send', '0'), - ('mail_recent', '0000000000|0'), - ('settings_updated', '0'), - ('next_task_time', '1'), - ('warning_settings', '1,20,0'), - ('warning_watch', '10'), - ('warning_moderate', '35'), - ('warning_mute', '60'), - ('last_mod_report_action', '0'), - ('pruningOptions', '30,180,180,180,30,0'), - ('mark_read_beyond', '90'), - ('mark_read_delete_beyond', '365'), - ('mark_read_max_users', '500'), - ('modlog_enabled', '1'), - ('adminlog_enabled', '1'), - ('reg_verification', '1'), - ('visual_verification_type', '3'), - ('enable_buddylist', '1'), - ('birthday_email', 'happy_birthday'), - ('dont_repeat_theme_core', '1'), - ('dont_repeat_smileys_20', '1'), - ('dont_repeat_buddylists', '1'), - ('attachment_image_reencode', '1'), - ('attachment_image_paranoid', '0'), - ('attachment_thumb_png', '1'), - ('avatar_reencode', '1'), - ('avatar_paranoid', '0'), - ('drafts_post_enabled', '1'), - ('drafts_pm_enabled', '1'), - ('drafts_autosave_enabled', '1'), - ('drafts_show_saved_enabled', '1'), - ('drafts_keep_days', '7'), - ('topic_move_any', '0'), - ('mail_limit', '5'), - ('mail_quantity', '5'), - ('additional_options_collapsable', '1'), - ('show_modify', '1'), - ('show_user_images', '1'), - ('show_blurb', '1'), - ('show_profile_buttons', '1'), - ('enable_ajax_alerts', '1'), - ('alerts_auto_purge', '30'), - ('gravatarEnabled', '1'), - ('gravatarOverride', '0'), - ('gravatarAllowExtraEmail', '1'), - ('gravatarMaxRating', 'PG'), - ('defaultMaxListItems', '15'), - ('loginHistoryDays', '30'), - ('httponlyCookies', '1'), - ('samesiteCookies', 'lax'), - ('tfa_mode', '1'), - ('export_dir', '{$boarddir}/exports'), - ('export_expiry', '7'), - ('export_min_diskspace_pct', '5'), - ('export_rate', '250'), - ('allow_expire_redirect', '1'), - ('json_done', '1'), - ('attachments_21_done', '1'), - ('displayFields', '[{"col_name":"cust_icq","title":"ICQ","type":"text","order":"1","bbc":"0","placement":"1","enclose":"\\"ICQ<\\/a>","mlist":"0"},{"col_name":"cust_skype","title":"Skype","type":"text","order":"2","bbc":"0","placement":"1","enclose":"\\"{INPUT}\\"<\\/a> ","mlist":"0"},{"col_name":"cust_loca","title":"Location","type":"text","order":"4","bbc":"0","placement":"0","enclose":"","mlist":"0"},{"col_name":"cust_gender","title":"Gender","type":"radio","order":"5","bbc":"0","placement":"1","enclose":"<\\/span>","mlist":"0","options":["None","Male","Female"]}]'), - ('minimize_files', '1'), - ('securityDisable_moderate', '1'); - -# -------------------------------------------------------- - -# -# Dumping data for table `smileys` -# - -INSERT INTO {$db_prefix}smileys - (code, description, smiley_order, hidden) -VALUES (':)', '{$default_smiley_smiley}', 0, 0), - (';)', '{$default_wink_smiley}', 1, 0), - (':D', '{$default_cheesy_smiley}', 2, 0), - (';D', '{$default_grin_smiley}', 3, 0), - ('>:(', '{$default_angry_smiley}', 4, 0), - (':(', '{$default_sad_smiley}', 5, 0), - (':o', '{$default_shocked_smiley}', 6, 0), - ('8)', '{$default_cool_smiley}', 7, 0), - ('???', '{$default_huh_smiley}', 8, 0), - ('::)', '{$default_roll_eyes_smiley}', 9, 0), - (':P', '{$default_tongue_smiley}', 10, 0), - (':-[', '{$default_embarrassed_smiley}', 11, 0), - (':-X', '{$default_lips_sealed_smiley}', 12, 0), - (':-\\', '{$default_undecided_smiley}', 13, 0), - (':-*', '{$default_kiss_smiley}', 14, 0), - (':''(', '{$default_cry_smiley}', 15, 0), - ('>:D', '{$default_evil_smiley}', 16, 1), - ('^-^', '{$default_azn_smiley}', 17, 1), - ('O0', '{$default_afro_smiley}', 18, 1), - (':))', '{$default_laugh_smiley}', 19, 1), - ('C:-)', '{$default_police_smiley}', 20, 1), - ('O:-)', '{$default_angel_smiley}', 21, 1); -# -------------------------------------------------------- - -# -# Dumping data for table `spiders` -# - -INSERT INTO {$db_prefix}spiders - (spider_name, user_agent, ip_info) -VALUES ('Google', 'googlebot', ''), - ('Yahoo!', 'slurp', ''), - ('Bing', 'bingbot', ''), - ('Google (Mobile)', 'Googlebot-Mobile', ''), - ('Google (Image)', 'Googlebot-Image', ''), - ('Google (AdSense)', 'Mediapartners-Google', ''), - ('Google (Adwords)', 'AdsBot-Google', ''), - ('Yahoo! (Mobile)', 'YahooSeeker/M1A1-R2D2', ''), - ('Yahoo! (Image)', 'Yahoo-MMCrawler', ''), - ('Bing (Preview)', 'BingPreview', ''), - ('Bing (Ads)', 'adidxbot', ''), - ('Bing (MSNBot)', 'msnbot', ''), - ('Bing (Media)', 'msnbot-media', ''), - ('Cuil', 'twiceler', ''), - ('Ask', 'Teoma', ''), - ('Baidu', 'Baiduspider', ''), - ('Gigablast', 'Gigabot', ''), - ('InternetArchive', 'ia_archiver-web.archive.org', ''), - ('Alexa', 'ia_archiver', ''), - ('Omgili', 'omgilibot', ''), - ('EntireWeb', 'Speedy Spider', ''), - ('Yandex', 'yandex', ''); -#--------------------------------------------------------- - -# -# Dumping data for table `themes` -# - -INSERT INTO {$db_prefix}themes - (id_theme, variable, value) -VALUES (1, 'name', '{$default_theme_name}'), - (1, 'theme_url', '{$boardurl}/Themes/default'), - (1, 'images_url', '{$boardurl}/Themes/default/images'), - (1, 'theme_dir', '{$boarddir}/Themes/default'), - (1, 'show_latest_member', '1'), - (1, 'show_newsfader', '0'), - (1, 'number_recent_posts', '0'), - (1, 'show_stats_index', '1'), - (1, 'newsfader_time', '3000'), - (1, 'use_image_buttons', '1'), - (1, 'enable_news', '1'); - -INSERT INTO {$db_prefix}themes - (id_member, id_theme, variable, value) -VALUES (-1, 1, 'posts_apply_ignore_list', '1'), - (-1, 1, 'drafts_show_saved_enabled', '1'), - (-1, 1, 'return_to_post', '1'); -# -------------------------------------------------------- - -# -# Dumping data for table `topics` -# - -INSERT INTO {$db_prefix}topics - (id_topic, id_board, id_first_msg, id_last_msg, id_member_started, id_member_updated) -VALUES (1, 1, 1, 1, 0, 0); -# -------------------------------------------------------- - -# -# Dumping data for table `user_alerts_prefs` -# - -INSERT INTO {$db_prefix}user_alerts_prefs - (id_member, alert_pref, alert_value) -VALUES (0, 'alert_timeout', 10), - (0, 'announcements', 0), - (0, 'birthday', 2), - (0, 'board_notify', 1), - (0, 'buddy_request', 1), - (0, 'groupr_approved', 3), - (0, 'groupr_rejected', 3), - (0, 'member_group_request', 1), - (0, 'member_register', 1), - (0, 'member_report', 3), - (0, 'member_report_reply', 3), - (0, 'msg_auto_notify', 0), - (0, 'msg_like', 1), - (0, 'msg_mention', 1), - (0, 'msg_notify_pref', 1), - (0, 'msg_notify_type', 1), - (0, 'msg_quote', 1), - (0, 'msg_receive_body', 0), - (0, 'msg_report', 1), - (0, 'msg_report_reply', 1), - (0, 'pm_new', 1), - (0, 'pm_notify', 1), - (0, 'pm_reply', 1), - (0, 'request_group', 1), - (0, 'topic_notify', 1), - (0, 'unapproved_attachment', 1), - (0, 'unapproved_reply', 3), - (0, 'unapproved_post', 1), - (0, 'warn_any', 1); -# -------------------------------------------------------- - -COMMIT; \ No newline at end of file diff --git a/other/install_3-0_PostgreSQL.sql b/other/install_3-0_PostgreSQL.sql deleted file mode 100644 index 86b7340766..0000000000 --- a/other/install_3-0_PostgreSQL.sql +++ /dev/null @@ -1,2852 +0,0 @@ -#### ATTENTION: You do not need to run or use this file! The install.php script does everything for you! -#### Install script for PostgreSQL 8.0.1 - -# -# Create PostgreSQL functions. -# Some taken from http://www.xach.com/aolserver/mysql-functions.sql and http://pgfoundry.org/projects/mysqlcompat/. -# IP Regex in inet_aton from https://www.mkyong.com/database/regular-expression-in-postgresql/. - -CREATE OR REPLACE FUNCTION FROM_UNIXTIME(bigint) RETURNS timestamp AS - 'SELECT timestamp ''epoch'' + $1 * interval ''1 second'' AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION FIND_IN_SET(needle text, haystack text) RETURNS integer AS ' - SELECT i AS result - FROM generate_series(1, array_upper(string_to_array($2,'',''), 1)) AS g(i) - WHERE (string_to_array($2,'',''))[i] = $1 - UNION ALL - SELECT 0 - LIMIT 1' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION FIND_IN_SET(needle integer, haystack text) RETURNS integer AS ' - SELECT i AS result - FROM generate_series(1, array_upper(string_to_array($2,'',''), 1)) AS g(i) - WHERE (string_to_array($2,'',''))[i] = CAST($1 AS text) - UNION ALL - SELECT 0 - LIMIT 1' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION FIND_IN_SET(needle smallint, haystack text) RETURNS integer AS ' - SELECT i AS result - FROM generate_series(1, array_upper(string_to_array($2,'',''), 1)) AS g(i) - WHERE (string_to_array($2,'',''))[i] = CAST($1 AS text) - UNION ALL - SELECT 0 - LIMIT 1' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION add_num_text (text, integer) RETURNS text AS - 'SELECT CAST ((CAST($1 AS integer) + $2) AS text) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION YEAR (timestamp) RETURNS integer AS - 'SELECT CAST (EXTRACT(YEAR FROM $1) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION MONTH (timestamp) RETURNS integer AS - 'SELECT CAST (EXTRACT(MONTH FROM $1) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION MONTH (bigint) RETURNS integer AS - 'SELECT CAST (EXTRACT(MONTH FROM TO_TIMESTAMP($1)) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION day(date) RETURNS integer AS - 'SELECT EXTRACT(DAY FROM DATE($1))::integer AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION DAYOFMONTH (timestamp) RETURNS integer AS - 'SELECT CAST (EXTRACT(DAY FROM $1) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION DAYOFMONTH (bigint) RETURNS integer AS - 'SELECT CAST (EXTRACT(DAY FROM TO_TIMESTAMP($1)) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION HOUR (timestamp) RETURNS integer AS - 'SELECT CAST (EXTRACT(HOUR FROM $1) AS integer) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION DATE_FORMAT (timestamp, text) RETURNS text AS ' - SELECT - REPLACE( - REPLACE($2, ''%m'', to_char($1, ''MM'')), - ''%d'', to_char($1, ''DD'')) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION TO_DAYS (timestamp) RETURNS integer AS - 'SELECT DATE_PART(''DAY'', $1 - ''0001-01-01bc'')::integer AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION INSTR (text, text) RETURNS integer AS - 'SELECT POSITION($2 in $1) AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION bool_not_eq_int (boolean, integer) RETURNS boolean AS - 'SELECT CAST($1 AS integer) != $2 AS result' -LANGUAGE 'sql'; - -CREATE OR REPLACE FUNCTION indexable_month_day(date) RETURNS TEXT as ' - SELECT to_char($1, ''MM-DD'');' -LANGUAGE 'sql' IMMUTABLE STRICT; - -# -# Create PostgreSQL operators. -# - -CREATE OPERATOR + (PROCEDURE = add_num_text, LEFTARG = text, RIGHTARG = integer); -CREATE OPERATOR != (PROCEDURE = bool_not_eq_int, LEFTARG = boolean, RIGHTARG = integer); - -# -# Sequence for table `admin_info_files` -# - -CREATE SEQUENCE {$db_prefix}admin_info_files_seq START WITH 8; - -# -# Table structure for table `admin_info_files` -# - -CREATE TABLE {$db_prefix}admin_info_files ( - id_file smallint DEFAULT nextval('{$db_prefix}admin_info_files_seq'), - filename varchar(255) NOT NULL DEFAULT '', - path varchar(255) NOT NULL DEFAULT '', - parameters varchar(255) NOT NULL DEFAULT '', - data text NOT NULL, - filetype varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_file) -); - -# -# Indexes for table `admin_info_files` -# - -CREATE INDEX {$db_prefix}admin_info_files_filename ON {$db_prefix}admin_info_files (filename varchar_pattern_ops); - -# -# Table structure for table `approval_queue` -# - -CREATE TABLE {$db_prefix}approval_queue ( - id_msg bigint NOT NULL DEFAULT '0', - id_attach bigint NOT NULL DEFAULT '0', - id_event smallint NOT NULL DEFAULT '0' -); - -# -# Sequence for table `attachments` -# - -CREATE SEQUENCE {$db_prefix}attachments_seq; - -# -# Table structure for table `attachments` -# - -CREATE TABLE {$db_prefix}attachments ( - id_attach bigint DEFAULT nextval('{$db_prefix}attachments_seq'), - id_thumb bigint NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - id_folder smallint NOT NULL DEFAULT '1', - attachment_type smallint NOT NULL DEFAULT '0', - filename varchar(255) NOT NULL DEFAULT '', - file_hash varchar(40) NOT NULL DEFAULT '', - fileext varchar(8) NOT NULL DEFAULT '', - size int NOT NULL DEFAULT '0', - downloads int NOT NULL DEFAULT '0', - width int NOT NULL DEFAULT '0', - height int NOT NULL DEFAULT '0', - mime_type varchar(128) NOT NULL DEFAULT '', - approved smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_attach) -); - -# -# Indexes for table `attachments` -# - -CREATE UNIQUE INDEX {$db_prefix}attachments_id_member ON {$db_prefix}attachments (id_member, id_attach); -CREATE INDEX {$db_prefix}attachments_id_msg ON {$db_prefix}attachments (id_msg); -CREATE INDEX {$db_prefix}attachments_attachment_type ON {$db_prefix}attachments (attachment_type); -CREATE INDEX {$db_prefix}attachments_id_thumb ON {$db_prefix}attachments (id_thumb); - -# -# Sequence for table `background_tasks` -# - -CREATE SEQUENCE {$db_prefix}background_tasks_seq; - -# -# Table structure for table `background_tasks` -# - -CREATE TABLE {$db_prefix}background_tasks ( - id_task bigint DEFAULT nextval('{$db_prefix}background_tasks_seq'), - task_file varchar(255) NOT NULL DEFAULT '', - task_class varchar(255) NOT NULL DEFAULT '', - task_data text NOT NULL, - claimed_time int NOT NULL DEFAULT '0', - PRIMARY KEY (id_task) -); - -# -# Sequence for table `ban_groups` -# - -CREATE SEQUENCE {$db_prefix}ban_groups_seq; - -# -# Table structure for table `ban_groups` -# - -CREATE TABLE {$db_prefix}ban_groups ( - id_ban_group int DEFAULT nextval('{$db_prefix}ban_groups_seq'), - name varchar(20) NOT NULL DEFAULT '', - ban_time bigint NOT NULL DEFAULT '0', - expire_time bigint, - cannot_access smallint NOT NULL DEFAULT '0', - cannot_register smallint NOT NULL DEFAULT '0', - cannot_post smallint NOT NULL DEFAULT '0', - cannot_login smallint NOT NULL DEFAULT '0', - reason varchar(255) NOT NULL, - notes text NOT NULL, - PRIMARY KEY (id_ban_group) -); - -# -# Sequence for table `ban_items` -# - -CREATE SEQUENCE {$db_prefix}ban_items_seq; - -# -# Table structure for table `ban_items` -# - -CREATE TABLE {$db_prefix}ban_items ( - id_ban int DEFAULT nextval('{$db_prefix}ban_items_seq'), - id_ban_group smallint NOT NULL DEFAULT '0', - ip_low inet, - ip_high inet, - hostname varchar(255) NOT NULL DEFAULT '', - email_address varchar(255) NOT NULL DEFAULT '', - id_member int NOT NULL DEFAULT '0', - hits bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_ban) -); - -# -# Indexes for table `ban_items` -# - -CREATE INDEX {$db_prefix}ban_items_id_ban_group ON {$db_prefix}ban_items (id_ban_group); -CREATE INDEX {$db_prefix}ban_items_id_ban_ip ON {$db_prefix}ban_items (ip_low,ip_high); - -# -# Table structure for table `board_permissions` -# - -CREATE TABLE {$db_prefix}board_permissions ( - id_group smallint NOT NULL DEFAULT '0', - id_profile smallint NOT NULL DEFAULT '0', - permission varchar(30) NOT NULL DEFAULT '', - add_deny smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_group, id_profile, permission) -); - -# -# Sequence for table `boards` -# - -CREATE SEQUENCE {$db_prefix}boards_seq START WITH 2; - -# -# Table structure for table `boards` -# - -CREATE TABLE {$db_prefix}boards ( - id_board smallint DEFAULT nextval('{$db_prefix}boards_seq'), - id_cat smallint NOT NULL DEFAULT '0', - child_level smallint NOT NULL DEFAULT '0', - id_parent smallint NOT NULL DEFAULT '0', - board_order smallint NOT NULL DEFAULT '0', - id_last_msg bigint NOT NULL DEFAULT '0', - id_msg_updated bigint NOT NULL DEFAULT '0', - member_groups varchar(255) NOT NULL DEFAULT '-1,0', - id_profile smallint NOT NULL DEFAULT '1', - name varchar(255) NOT NULL DEFAULT '', - description text NOT NULL, - num_topics int NOT NULL DEFAULT '0', - num_posts int NOT NULL DEFAULT '0', - count_posts smallint NOT NULL DEFAULT '0', - id_theme smallint NOT NULL DEFAULT '0', - override_theme smallint NOT NULL DEFAULT '0', - unapproved_posts smallint NOT NULL DEFAULT '0', - unapproved_topics smallint NOT NULL DEFAULT '0', - redirect varchar(255) NOT NULL DEFAULT '', - deny_member_groups varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_board) -); - -# -# Indexes for table `ban_items` -# - -CREATE UNIQUE INDEX {$db_prefix}boards_categories ON {$db_prefix}boards (id_cat, id_board); -CREATE INDEX {$db_prefix}boards_id_parent ON {$db_prefix}boards (id_parent); -CREATE INDEX {$db_prefix}boards_id_msg_updated ON {$db_prefix}boards (id_msg_updated); -CREATE INDEX {$db_prefix}boards_member_groups ON {$db_prefix}boards (member_groups varchar_pattern_ops); - -# -# Table structure for table `board_permissions_view` -# - -CREATE TABLE {$db_prefix}board_permissions_view -( - id_group smallint NOT NULL DEFAULT '0', - id_board smallint NOT NULL, - deny smallint NOT NULL, - PRIMARY KEY (id_group, id_board, deny) -); - -# -# Sequence for table `calendar` -# - -CREATE SEQUENCE {$db_prefix}calendar_seq; - -# -# Table structure for table `calendar` -# - -CREATE TABLE {$db_prefix}calendar ( - id_event smallint DEFAULT nextval('{$db_prefix}calendar_seq'), - start_date date NOT NULL DEFAULT '1004-01-01', - end_date date NOT NULL DEFAULT '1004-01-01', - id_board smallint NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - title varchar(255) NOT NULL DEFAULT '', - id_member int NOT NULL DEFAULT '0', - start_time time, - end_time time, - timezone varchar(80), - location VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_event) -); - -# -# Indexes for table `calendar` -# - -CREATE INDEX {$db_prefix}calendar_start_date ON {$db_prefix}calendar (start_date); -CREATE INDEX {$db_prefix}calendar_end_date ON {$db_prefix}calendar (end_date); -CREATE INDEX {$db_prefix}calendar_topic ON {$db_prefix}calendar (id_topic, id_member); - -# -# Sequence for table `calendar_holidays` -# - -CREATE SEQUENCE {$db_prefix}calendar_holidays_seq; - -# -# Table structure for table `calendar_holidays` -# - -CREATE TABLE {$db_prefix}calendar_holidays ( - id_holiday smallint DEFAULT nextval('{$db_prefix}calendar_holidays_seq'), - event_date date NOT NULL DEFAULT '1004-01-01', - title varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_holiday) -); - -# -# Indexes for table `calendar_holidays` -# - -CREATE INDEX {$db_prefix}calendar_holidays_event_date ON {$db_prefix}calendar_holidays (event_date); - -# -# Sequence for table `categories` -# - -CREATE SEQUENCE {$db_prefix}categories_seq START WITH 2; - -# -# Table structure for table `categories` -# - -CREATE TABLE {$db_prefix}categories ( - id_cat smallint DEFAULT nextval('{$db_prefix}categories_seq'), - cat_order smallint NOT NULL DEFAULT '0', - name varchar(255) NOT NULL DEFAULT '', - description text NOT NULL, - can_collapse smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_cat) -); - -# -# Sequence for table `custom_fields` -# - -CREATE SEQUENCE {$db_prefix}custom_fields_seq; - -# -# Table structure for table `custom_fields` -# - -CREATE TABLE {$db_prefix}custom_fields ( - id_field smallint DEFAULT nextval('{$db_prefix}custom_fields_seq'), - col_name varchar(12) NOT NULL DEFAULT '', - field_name varchar(40) NOT NULL DEFAULT '', - field_desc varchar(255) NOT NULL DEFAULT '', - field_type varchar(8) NOT NULL DEFAULT 'text', - field_length smallint NOT NULL DEFAULT '255', - field_options text NOT NULL, - field_order smallint NOT NULL DEFAULT '0', - mask varchar(255) NOT NULL DEFAULT '', - show_reg smallint NOT NULL DEFAULT '0', - show_display smallint NOT NULL DEFAULT '0', - show_mlist smallint NOT NULL DEFAULT '0', - show_profile varchar(20) NOT NULL DEFAULT 'forumprofile', - private smallint NOT NULL DEFAULT '0', - active smallint NOT NULL DEFAULT '1', - bbc smallint NOT NULL DEFAULT '0', - can_search smallint NOT NULL DEFAULT '0', - default_value varchar(255) NOT NULL DEFAULT '', - enclose text NOT NULL, - placement smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_field) -); - -# -# Indexes for table `custom_fields` -# - -CREATE UNIQUE INDEX {$db_prefix}custom_fields_col_name ON {$db_prefix}custom_fields (col_name); - -# -# Table structure for table `group_moderators` -# - -CREATE TABLE {$db_prefix}group_moderators ( - id_group smallint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - PRIMARY KEY (id_group, id_member) -); - -# -# Sequence for table `log_actions` -# - -CREATE SEQUENCE {$db_prefix}log_actions_seq; - -# -# Table structure for table `log_actions` -# - -CREATE TABLE {$db_prefix}log_actions ( - id_action bigint DEFAULT nextval('{$db_prefix}log_actions_seq'), - id_log smallint NOT NULL DEFAULT '1', - log_time bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - ip inet, - action varchar(30) NOT NULL DEFAULT '', - id_board smallint NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - extra text NOT NULL, - PRIMARY KEY (id_action) -); - -# -# Indexes for table `log_actions` -# - -CREATE INDEX {$db_prefix}log_actions_log_time ON {$db_prefix}log_actions (log_time); -CREATE INDEX {$db_prefix}log_actions_id_member ON {$db_prefix}log_actions (id_member); -CREATE INDEX {$db_prefix}log_actions_id_board ON {$db_prefix}log_actions (id_board); -CREATE INDEX {$db_prefix}log_actions_id_msg ON {$db_prefix}log_actions (id_msg); -CREATE INDEX {$db_prefix}log_actions_id_log ON {$db_prefix}log_actions (id_log); -CREATE INDEX {$db_prefix}log_actions_id_topic_id_log ON {$db_prefix}log_actions (id_topic, id_log); - -# -# Table structure for table `log_activity` -# - -CREATE TABLE {$db_prefix}log_activity ( - date date NOT NULL, - hits int NOT NULL DEFAULT '0', - topics smallint NOT NULL DEFAULT '0', - posts smallint NOT NULL DEFAULT '0', - registers smallint NOT NULL DEFAULT '0', - most_on smallint NOT NULL DEFAULT '0', - PRIMARY KEY (date) -); - -# -# Sequence for table `log_banned` -# - -CREATE SEQUENCE {$db_prefix}log_banned_seq; - -# -# Table structure for table `log_banned` -# - -CREATE TABLE {$db_prefix}log_banned ( - id_ban_log int DEFAULT nextval('{$db_prefix}log_banned_seq'), - id_member int NOT NULL DEFAULT '0', - ip inet, - email varchar(255) NOT NULL DEFAULT '', - log_time bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_ban_log) -); - -# -# Indexes for table `log_banned` -# - -CREATE INDEX {$db_prefix}log_banned_log_time ON {$db_prefix}log_banned (log_time); - -# -# Table structure for table `log_boards` -# - -CREATE TABLE {$db_prefix}log_boards ( - id_member int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_board) -); - -# -# Sequence for table `log_comments` -# - -CREATE SEQUENCE {$db_prefix}log_comments_seq; - -# -# Table structure for table `log_comments` -# - -CREATE TABLE {$db_prefix}log_comments ( - id_comment int DEFAULT nextval('{$db_prefix}log_comments_seq'), - id_member int NOT NULL DEFAULT '0', - member_name varchar(80) NOT NULL DEFAULT '', - comment_type varchar(8) NOT NULL DEFAULT 'warning', - id_recipient int NOT NULL DEFAULT '0', - recipient_name varchar(255) NOT NULL DEFAULT '', - log_time bigint NOT NULL DEFAULT '0', - id_notice int NOT NULL DEFAULT '0', - counter smallint NOT NULL DEFAULT '0', - body text NOT NULL, - PRIMARY KEY (id_comment) -); - -# -# Indexes for table `log_comments` -# - -CREATE INDEX {$db_prefix}log_comments_id_recipient ON {$db_prefix}log_comments (id_recipient); -CREATE INDEX {$db_prefix}log_comments_log_time ON {$db_prefix}log_comments (log_time); -CREATE INDEX {$db_prefix}log_comments_comment_type ON {$db_prefix}log_comments (comment_type varchar_pattern_ops); - -# -# Table structure for table `log_digest` -# - -CREATE TABLE {$db_prefix}log_digest ( - id_topic int NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - note_type varchar(10) NOT NULL DEFAULT 'post', - daily smallint NOT NULL DEFAULT '0', - exclude int NOT NULL DEFAULT '0' -); - -# -# Sequence for table `log_errors` -# - -CREATE SEQUENCE {$db_prefix}log_errors_seq; - -# -# Table structure for table `log_errors` -# - -CREATE TABLE {$db_prefix}log_errors ( - id_error int DEFAULT nextval('{$db_prefix}log_errors_seq'), - log_time bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - ip inet, - url text NOT NULL, - message text NOT NULL, - session varchar(128) NOT NULL DEFAULT ' ', - error_type varchar(15) NOT NULL DEFAULT 'general', - file varchar(255) NOT NULL DEFAULT '', - line int NOT NULL DEFAULT '0', - backtrace text NOT NULL DEFAULT '', - PRIMARY KEY (id_error) -); - -# -# Indexes for table `log_errors` -# - -CREATE INDEX {$db_prefix}log_errors_log_time ON {$db_prefix}log_errors (log_time); -CREATE INDEX {$db_prefix}log_errors_id_member ON {$db_prefix}log_errors (id_member); -CREATE INDEX {$db_prefix}log_errors_ip ON {$db_prefix}log_errors (ip); - -# -# Table structure for table `log_floodcontrol` -# - -CREATE UNLOGGED TABLE {$db_prefix}log_floodcontrol ( - ip inet, - log_time bigint NOT NULL DEFAULT '0', - log_type varchar(30) NOT NULL DEFAULT 'post', - PRIMARY KEY (ip, log_type) -); - -# -# Sequence for table `log_group_requests` -# - -CREATE SEQUENCE {$db_prefix}log_group_requests_seq; - -# -# Table structure for table `log_group_requests` -# - -CREATE TABLE {$db_prefix}log_group_requests ( - id_request int DEFAULT nextval('{$db_prefix}log_group_requests_seq'), - id_member int NOT NULL DEFAULT '0', - id_group smallint NOT NULL DEFAULT '0', - time_applied bigint NOT NULL DEFAULT '0', - reason text NOT NULL, - status smallint NOT NULL DEFAULT '0', - id_member_acted int NOT NULL DEFAULT '0', - member_name_acted varchar(255) NOT NULL DEFAULT '', - time_acted bigint NOT NULL DEFAULT '0', - act_reason text NOT NULL, - PRIMARY KEY (id_request) -); - -# -# Indexes for table `log_group_requests` -# - -CREATE INDEX {$db_prefix}log_group_requests_id_member ON {$db_prefix}log_group_requests (id_member, id_group); - -# -# Table structure for table `log_mark_read` -# - -CREATE TABLE {$db_prefix}log_mark_read ( - id_member int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_board) -); - -# -# Sequence for table `log_member_notices` -# - -CREATE SEQUENCE {$db_prefix}log_member_notices_seq; - -# -# Table structure for table `log_member_notices` -# - -CREATE TABLE {$db_prefix}log_member_notices ( - id_notice int DEFAULT nextval('{$db_prefix}log_member_notices_seq'), - subject varchar(255) NOT NULL DEFAULT '', - body text NOT NULL, - PRIMARY KEY (id_notice) -); - -# -# Table structure for table `log_notify` -# - -CREATE TABLE {$db_prefix}log_notify ( - id_member int NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - sent smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_topic, id_board) -); - -# -# Indexes for table `log_notify` -# - -CREATE INDEX {$db_prefix}log_notify_id_topic ON {$db_prefix}log_notify (id_topic, id_member); - -# -# Table structure for table `log_online` -# - -CREATE UNLOGGED TABLE {$db_prefix}log_online ( - session varchar(128) NOT NULL DEFAULT '', - log_time bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - id_spider smallint NOT NULL DEFAULT '0', - ip inet, - url varchar(2048) NOT NULL DEFAULT '', - PRIMARY KEY (session) -); - -# -# Indexes for table `log_online` -# - -CREATE INDEX {$db_prefix}log_online_log_time ON {$db_prefix}log_online (log_time); -CREATE INDEX {$db_prefix}log_online_id_member ON {$db_prefix}log_online (id_member); - -# -# Sequence for table `log_packages` -# - -CREATE SEQUENCE {$db_prefix}log_packages_seq; - -# -# Table structure for table `log_packages` -# - -CREATE TABLE {$db_prefix}log_packages ( - id_install int DEFAULT nextval('{$db_prefix}log_packages_seq'), - filename varchar(255) NOT NULL DEFAULT '', - package_id varchar(255) NOT NULL DEFAULT '', - name varchar(255) NOT NULL DEFAULT '', - version varchar(255) NOT NULL DEFAULT '', - id_member_installed int NOT NULL DEFAULT '0', - member_installed varchar(255) NOT NULL, - time_installed int NOT NULL DEFAULT '0', - id_member_removed int NOT NULL DEFAULT '0', - member_removed varchar(255) NOT NULL, - time_removed int NOT NULL DEFAULT '0', - install_state smallint NOT NULL DEFAULT '1', - failed_steps text NOT NULL, - themes_installed varchar(255) NOT NULL DEFAULT '', - db_changes text NOT NULL, - credits text NOT NULL, - sha256_hash TEXT, - PRIMARY KEY (id_install) -); - -# -# Indexes for table `log_packages` -# - -CREATE INDEX {$db_prefix}log_packages_filename ON {$db_prefix}log_packages (filename varchar_pattern_ops); - -# -# Table structure for table `log_polls` -# - -CREATE TABLE {$db_prefix}log_polls ( - id_poll int NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - id_choice smallint NOT NULL DEFAULT '0' -); - -# -# Indexes for table `log_polls` -# - -CREATE INDEX {$db_prefix}log_polls_id_poll ON {$db_prefix}log_polls (id_poll, id_member, id_choice); - -# -# Sequence for table `log_reported` -# - -CREATE SEQUENCE {$db_prefix}log_reported_seq; - -# -# Table structure for table `log_reported` -# - -CREATE TABLE {$db_prefix}log_reported ( - id_report int DEFAULT nextval('{$db_prefix}log_reported_seq'), - id_msg bigint NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - membername varchar(255) NOT NULL DEFAULT '', - subject varchar(255) NOT NULL DEFAULT '', - body text NOT NULL, - time_started int NOT NULL DEFAULT '0', - time_updated int NOT NULL DEFAULT '0', - num_reports int NOT NULL DEFAULT '0', - closed smallint NOT NULL DEFAULT '0', - ignore_all smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_report) -); - -# -# Indexes for table `log_reported` -# - -CREATE INDEX {$db_prefix}log_reported_id_member ON {$db_prefix}log_reported (id_member); -CREATE INDEX {$db_prefix}log_reported_id_topic ON {$db_prefix}log_reported (id_topic); -CREATE INDEX {$db_prefix}log_reported_closed ON {$db_prefix}log_reported (closed); -CREATE INDEX {$db_prefix}log_reported_time_started ON {$db_prefix}log_reported (time_started); -CREATE INDEX {$db_prefix}log_reported_id_msg ON {$db_prefix}log_reported (id_msg); - -# -# Sequence for table `log_reported_comments` -# - -CREATE SEQUENCE {$db_prefix}log_reported_comments_seq; - -# -# Table structure for table `log_reported_comments` -# - -CREATE TABLE {$db_prefix}log_reported_comments ( - id_comment int DEFAULT nextval('{$db_prefix}log_reported_comments_seq'), - id_report int NOT NULL DEFAULT '0', - id_member int NOT NULL, - membername varchar(255) NOT NULL DEFAULT '', - member_ip inet, - comment varchar(255) NOT NULL DEFAULT '', - time_sent int NOT NULL, - PRIMARY KEY (id_comment) -); - -# -# Indexes for table `log_reported_comments` -# - -CREATE INDEX {$db_prefix}log_reported_comments_id_report ON {$db_prefix}log_reported_comments (id_report); -CREATE INDEX {$db_prefix}log_reported_comments_id_member ON {$db_prefix}log_reported_comments (id_member); -CREATE INDEX {$db_prefix}log_reported_comments_time_sent ON {$db_prefix}log_reported_comments (time_sent); - -# -# Sequence for table `log_scheduled_tasks` -# - -CREATE SEQUENCE {$db_prefix}log_scheduled_tasks_seq; - -# -# Table structure for table `log_scheduled_tasks` -# - -CREATE TABLE {$db_prefix}log_scheduled_tasks ( - id_log int DEFAULT nextval('{$db_prefix}log_scheduled_tasks_seq'), - id_task smallint NOT NULL DEFAULT '0', - time_run int NOT NULL DEFAULT '0', - time_taken float NOT NULL DEFAULT '0', - PRIMARY KEY (id_log) -); - -# -# Table structure for table `log_search_messages` -# - -CREATE TABLE {$db_prefix}log_search_messages ( - id_search smallint NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_search, id_msg) -); - -# -# Table structure for table `log_search_results` -# - -CREATE TABLE {$db_prefix}log_search_results ( - id_search smallint NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - relevance smallint NOT NULL DEFAULT '0', - num_matches smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_search, id_topic) -); - -# -# Table structure for table `log_search_subjects` -# - -CREATE TABLE {$db_prefix}log_search_subjects ( - word varchar(20) NOT NULL DEFAULT '', - id_topic int NOT NULL DEFAULT '0', - PRIMARY KEY (word, id_topic) -); - -# -# Indexes for table `log_search_subjects` -# - -CREATE INDEX {$db_prefix}log_search_subjects_id_topic ON {$db_prefix}log_search_subjects (id_topic); - -# -# Table structure for table `log_search_topics` -# - -CREATE TABLE {$db_prefix}log_search_topics ( - id_search smallint NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - PRIMARY KEY (id_search, id_topic) -); - -# -# Sequence for table `log_spider_hits` -# - -CREATE SEQUENCE {$db_prefix}log_spider_hits_seq; - -# -# Table structure for table `log_spider_hits` -# - -CREATE TABLE {$db_prefix}log_spider_hits ( - id_hit bigint DEFAULT nextval('{$db_prefix}log_spider_hits_seq'), - id_spider smallint NOT NULL DEFAULT '0', - log_time bigint NOT NULL DEFAULT '0', - url varchar(1024) NOT NULL DEFAULT '', - processed smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_hit) -); - -# -# Indexes for table `log_spider_hits` -# - -CREATE INDEX {$db_prefix}log_spider_hits_id_spider ON {$db_prefix}log_spider_hits (id_spider); -CREATE INDEX {$db_prefix}log_spider_hits_log_time ON {$db_prefix}log_spider_hits (log_time); -CREATE INDEX {$db_prefix}log_spider_hits_processed ON {$db_prefix}log_spider_hits (processed); - -# -# Table structure for table `log_spider_stats` -# - -CREATE TABLE {$db_prefix}log_spider_stats ( - id_spider smallint NOT NULL DEFAULT '0', - page_hits int NOT NULL DEFAULT '0', - last_seen bigint NOT NULL DEFAULT '0', - stat_date date NOT NULL DEFAULT '1004-01-01', - PRIMARY KEY (stat_date, id_spider) -); - -# -# Sequence for table `log_subscribed` -# - -CREATE SEQUENCE {$db_prefix}log_subscribed_seq; - -# -# Table structure for table `log_subscribed` -# - -CREATE TABLE {$db_prefix}log_subscribed ( - id_sublog bigint DEFAULT nextval('{$db_prefix}log_subscribed_seq'), - id_subscribe smallint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - old_id_group int NOT NULL DEFAULT '0', - start_time int NOT NULL DEFAULT '0', - end_time int NOT NULL DEFAULT '0', - payments_pending smallint NOT NULL DEFAULT '0', - status smallint NOT NULL DEFAULT '0', - pending_details text NOT NULL, - reminder_sent smallint NOT NULL DEFAULT '0', - vendor_ref varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_sublog) -); - -# -# Indexes for table `log_subscribed` -# - -CREATE INDEX {$db_prefix}log_subscribed_id_subscribe ON {$db_prefix}log_subscribed (id_subscribe, id_member); -CREATE INDEX {$db_prefix}log_subscribed_end_time ON {$db_prefix}log_subscribed (end_time); -CREATE INDEX {$db_prefix}log_subscribed_reminder_sent ON {$db_prefix}log_subscribed (reminder_sent); -CREATE INDEX {$db_prefix}log_subscribed_payments_pending ON {$db_prefix}log_subscribed (payments_pending); -CREATE INDEX {$db_prefix}log_subscribed_status ON {$db_prefix}log_subscribed (status); -CREATE INDEX {$db_prefix}log_subscribed_id_member ON {$db_prefix}log_subscribed (id_member); - -# -# Table structure for table `log_topics` -# - -CREATE TABLE {$db_prefix}log_topics ( - id_member int NOT NULL DEFAULT '0', - id_topic int NOT NULL DEFAULT '0', - id_msg bigint NOT NULL DEFAULT '0', - unwatched int NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, id_topic) -); - -# -# Indexes for table `log_topics` -# - -CREATE INDEX {$db_prefix}log_topics_id_topic ON {$db_prefix}log_topics (id_topic); - -# -# Sequence for table `mail_queue` -# - -CREATE SEQUENCE {$db_prefix}mail_queue_seq; - -# -# Table structure for table `mail_queue` -# - -CREATE TABLE {$db_prefix}mail_queue ( - id_mail bigint DEFAULT nextval('{$db_prefix}mail_queue_seq'), - time_sent int NOT NULL DEFAULT '0', - recipient varchar(255) NOT NULL DEFAULT '', - body text NOT NULL, - subject varchar(255) NOT NULL DEFAULT '', - headers text NOT NULL, - send_html smallint NOT NULL DEFAULT '0', - priority smallint NOT NULL DEFAULT '1', - private smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_mail) -); - -# -# Indexes for table `mail_queue` -# - -CREATE INDEX {$db_prefix}mail_queue_time_sent ON {$db_prefix}mail_queue (time_sent); -CREATE INDEX {$db_prefix}mail_queue_mail_priority ON {$db_prefix}mail_queue (priority, id_mail); - -# -# Sequence for table `membergroups` -# - -CREATE SEQUENCE {$db_prefix}membergroups_seq START WITH 9; - -# -# Table structure for table `membergroups` -# - -CREATE TABLE {$db_prefix}membergroups ( - id_group smallint DEFAULT nextval('{$db_prefix}membergroups_seq'), - group_name varchar(80) NOT NULL DEFAULT '', - description text NOT NULL, - online_color varchar(20) NOT NULL DEFAULT '', - min_posts int NOT NULL DEFAULT '-1', - max_messages smallint NOT NULL DEFAULT '0', - icons varchar(255) NOT NULL DEFAULT '', - group_type smallint NOT NULL DEFAULT '0', - hidden smallint NOT NULL DEFAULT '0', - id_parent smallint NOT NULL DEFAULT '-2', - tfa_required smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_group) -); - -# -# Indexes for table `membergroups` -# - -CREATE INDEX {$db_prefix}membergroups_min_posts ON {$db_prefix}membergroups (min_posts); - -# -# Sequence for table `members` -# - -CREATE SEQUENCE {$db_prefix}members_seq; - -# -# Table structure for table `members` -# - -CREATE TABLE {$db_prefix}members ( - id_member int DEFAULT nextval('{$db_prefix}members_seq'), - member_name varchar(80) NOT NULL DEFAULT '', - date_registered bigint NOT NULL DEFAULT '0', - posts int NOT NULL DEFAULT '0', - id_group smallint NOT NULL DEFAULT '0', - lngfile varchar(255) NOT NULL DEFAULT '', - last_login bigint NOT NULL DEFAULT '0', - real_name varchar(255) NOT NULL DEFAULT '', - instant_messages smallint NOT NULL DEFAULT 0, - unread_messages smallint NOT NULL DEFAULT 0, - new_pm smallint NOT NULL DEFAULT '0', - alerts bigint NOT NULL DEFAULT '0', - buddy_list text NOT NULL, - pm_ignore_list TEXT NULL, - pm_prefs int NOT NULL DEFAULT '0', - mod_prefs varchar(20) NOT NULL DEFAULT '', - passwd varchar(64) NOT NULL DEFAULT '', - email_address varchar(255) NOT NULL DEFAULT '', - personal_text varchar(255) NOT NULL DEFAULT '', - birthdate date NOT NULL DEFAULT '1004-01-01', - website_title varchar(255) NOT NULL DEFAULT '', - website_url varchar(255) NOT NULL DEFAULT '', - show_online smallint NOT NULL DEFAULT '1', - time_format varchar(80) NOT NULL DEFAULT '', - signature text NOT NULL, - time_offset float NOT NULL DEFAULT '0', - avatar varchar(255) NOT NULL DEFAULT '', - usertitle varchar(255) NOT NULL DEFAULT '', - member_ip inet, - member_ip2 inet, - secret_question varchar(255) NOT NULL DEFAULT '', - secret_answer varchar(64) NOT NULL DEFAULT '', - id_theme smallint NOT NULL DEFAULT '0', - is_activated smallint NOT NULL DEFAULT '1', - validation_code varchar(10) NOT NULL DEFAULT '', - id_msg_last_visit int NOT NULL DEFAULT '0', - additional_groups varchar(255) NOT NULL DEFAULT '', - smiley_set varchar(48) NOT NULL DEFAULT '', - id_post_group smallint NOT NULL DEFAULT '0', - total_time_logged_in bigint NOT NULL DEFAULT '0', - password_salt varchar(255) NOT NULL DEFAULT '', - ignore_boards text NOT NULL, - warning smallint NOT NULL DEFAULT '0', - passwd_flood varchar(12) NOT NULL DEFAULT '', - pm_receive_from smallint NOT NULL DEFAULT '1', - timezone varchar(80) NOT NULL DEFAULT '', - tfa_secret varchar(24) NOT NULL DEFAULT '', - tfa_backup varchar(64) NOT NULL DEFAULT '', - PRIMARY KEY (id_member) -); - -# -# Indexes for table `members` -# - -CREATE INDEX {$db_prefix}members_member_name ON {$db_prefix}members (member_name varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_real_name ON {$db_prefix}members (real_name varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_email_address ON {$db_prefix}members (email_address varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_date_registered ON {$db_prefix}members (date_registered); -CREATE INDEX {$db_prefix}members_id_group ON {$db_prefix}members (id_group); -CREATE INDEX {$db_prefix}members_birthdate ON {$db_prefix}members (birthdate); -CREATE INDEX {$db_prefix}members_birthdate2 ON {$db_prefix}members (indexable_month_day(birthdate)); -CREATE INDEX {$db_prefix}members_posts ON {$db_prefix}members (posts); -CREATE INDEX {$db_prefix}members_last_login ON {$db_prefix}members (last_login); -CREATE INDEX {$db_prefix}members_lngfile ON {$db_prefix}members (lngfile varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_id_post_group ON {$db_prefix}members (id_post_group); -CREATE INDEX {$db_prefix}members_warning ON {$db_prefix}members (warning); -CREATE INDEX {$db_prefix}members_total_time_logged_in ON {$db_prefix}members (total_time_logged_in); -CREATE INDEX {$db_prefix}members_id_theme ON {$db_prefix}members (id_theme); -CREATE INDEX {$db_prefix}members_member_name_low ON {$db_prefix}members (LOWER(member_name) varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_real_name_low ON {$db_prefix}members (LOWER(real_name) varchar_pattern_ops); -CREATE INDEX {$db_prefix}members_active_real_name ON {$db_prefix}members (is_activated, real_name); - -# -# Sequence for table `member_logins` -# - -CREATE SEQUENCE {$db_prefix}member_logins_seq; - -# -# Table structure for table `member_logins` -# - -CREATE TABLE {$db_prefix}member_logins ( - id_login int DEFAULT nextval('{$db_prefix}member_logins_seq'), - id_member int NOT NULL DEFAULT '0', - time int NOT NULL DEFAULT '0', - ip inet, - ip2 inet, - PRIMARY KEY (id_login) -); - -# -# Indexes for table `member_logins` -# -CREATE INDEX {$db_prefix}member_logins_id_member ON {$db_prefix}member_logins (id_member); -CREATE INDEX {$db_prefix}member_logins_time ON {$db_prefix}member_logins (time); - - -# -# Sequence for table `message_icons` -# - -CREATE SEQUENCE {$db_prefix}message_icons_seq; - -# -# Table structure for table `message_icons` -# - -CREATE TABLE {$db_prefix}message_icons ( - id_icon smallint DEFAULT nextval('{$db_prefix}message_icons_seq'), - title varchar(80) NOT NULL DEFAULT '', - filename varchar(80) NOT NULL DEFAULT '', - id_board smallint NOT NULL DEFAULT '0', - icon_order smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_icon) -); - -# -# Indexes for table `message_icons` -# - -CREATE INDEX {$db_prefix}message_icons_id_board ON {$db_prefix}message_icons (id_board); - -# -# Sequence for table `messages` -# - -CREATE SEQUENCE {$db_prefix}messages_seq START WITH 2; - -# -# Table structure for table `messages` -# - -CREATE TABLE {$db_prefix}messages ( - id_msg bigint DEFAULT nextval('{$db_prefix}messages_seq'), - id_topic int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - poster_time bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - id_msg_modified int NOT NULL DEFAULT '0', - subject varchar(255) NOT NULL DEFAULT '', - poster_name varchar(255) NOT NULL DEFAULT '', - poster_email varchar(255) NOT NULL DEFAULT '', - poster_ip inet, - smileys_enabled smallint NOT NULL DEFAULT '1', - modified_time int NOT NULL DEFAULT '0', - modified_name varchar(255) NOT NULL, - modified_reason varchar(255) NOT NULL DEFAULT '', - body text NOT NULL, - icon varchar(16) NOT NULL DEFAULT 'xx', - approved smallint NOT NULL DEFAULT '1', - likes smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_msg) -); - -# -# Indexes for table `messages` -# - -CREATE UNIQUE INDEX {$db_prefix}messages_id_board ON {$db_prefix}messages (id_board, id_msg, approved); -CREATE UNIQUE INDEX {$db_prefix}messages_id_member ON {$db_prefix}messages (id_member, id_msg); -CREATE INDEX {$db_prefix}messages_ip_index ON {$db_prefix}messages (poster_ip, id_topic); -CREATE INDEX {$db_prefix}messages_participation ON {$db_prefix}messages (id_member, id_topic); -CREATE INDEX {$db_prefix}messages_show_posts ON {$db_prefix}messages (id_member, id_board); -CREATE INDEX {$db_prefix}messages_id_member_msg ON {$db_prefix}messages (id_member, approved, id_msg); -CREATE INDEX {$db_prefix}messages_current_topic ON {$db_prefix}messages (id_topic, id_msg, id_member, approved); -CREATE INDEX {$db_prefix}messages_related_ip ON {$db_prefix}messages (id_member, poster_ip, id_msg); -CREATE INDEX {$db_prefix}messages_likes ON {$db_prefix}messages (likes); -# -# Table structure for table `moderators` -# - -CREATE TABLE {$db_prefix}moderators ( - id_board smallint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - PRIMARY KEY (id_board, id_member) -); - -# -# Table structure for table `moderator_groups` -# - -CREATE TABLE {$db_prefix}moderator_groups ( - id_board smallint NOT NULL DEFAULT '0', - id_group smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_board, id_group) -); - -# -# Sequence for table `package_servers` -# - -CREATE SEQUENCE {$db_prefix}package_servers_seq; - -# -# Table structure for table `package_servers` -# - -CREATE TABLE {$db_prefix}package_servers ( - id_server smallint DEFAULT nextval('{$db_prefix}package_servers_seq'), - name varchar(255) NOT NULL DEFAULT '', - url varchar(255) NOT NULL DEFAULT '', - validation_url varchar(255) NOT NULL DEFAULT '', - extra text, - PRIMARY KEY (id_server) -); - - -# -# Sequence for table `permission_profiles` -# - -CREATE SEQUENCE {$db_prefix}permission_profiles_seq START WITH 5; - -# -# Table structure for table `permission_profiles` -# - -CREATE TABLE {$db_prefix}permission_profiles ( - id_profile smallint DEFAULT nextval('{$db_prefix}permission_profiles_seq'), - profile_name varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_profile) -); - -# -# Table structure for table `permissions` -# - -CREATE TABLE {$db_prefix}permissions ( - id_group smallint NOT NULL DEFAULT '0', - permission varchar(30) NOT NULL DEFAULT '', - add_deny smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_group, permission) -); - -# -# Sequence for table `personal_messages` -# - -CREATE SEQUENCE {$db_prefix}personal_messages_seq; - -# -# Table structure for table `personal_messages` -# - -CREATE TABLE {$db_prefix}personal_messages ( - id_pm bigint DEFAULT nextval('{$db_prefix}personal_messages_seq'), - id_pm_head bigint NOT NULL DEFAULT '0', - id_member_from int NOT NULL DEFAULT '0', - deleted_by_sender smallint NOT NULL DEFAULT '0', - from_name varchar(255) NOT NULL, - msgtime bigint NOT NULL DEFAULT '0', - subject varchar(255) NOT NULL DEFAULT '', - body text NOT NULL, - PRIMARY KEY (id_pm) -); - -# -# Indexes for table `personal_messages` -# - -CREATE INDEX {$db_prefix}personal_messages_id_member ON {$db_prefix}personal_messages (id_member_from, deleted_by_sender); -CREATE INDEX {$db_prefix}personal_messages_msgtime ON {$db_prefix}personal_messages (msgtime); -CREATE INDEX {$db_prefix}personal_messages_id_pm_head ON {$db_prefix}personal_messages (id_pm_head); - -# -# Sequence for table `pm_labels` -# - -CREATE SEQUENCE {$db_prefix}pm_labels_seq; - -# -# Table structure for table `pm_labels` -# - -CREATE TABLE {$db_prefix}pm_labels ( - id_label bigint NOT NULL DEFAULT nextval('{$db_prefix}pm_labels_seq'), - id_member int NOT NULL DEFAULT '0', - name varchar(30) NOT NULL DEFAULT '', - PRIMARY KEY (id_label) -); - -# -# Table structure for table `pm_labeled_messages` -# - -CREATE TABLE {$db_prefix}pm_labeled_messages ( - id_label bigint NOT NULL DEFAULT '0', - id_pm bigint NOT NULL DEFAULT '0', - PRIMARY KEY (id_label, id_pm) -); - -# -# Table structure for table `pm_recipients` -# - -CREATE TABLE {$db_prefix}pm_recipients ( - id_pm bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - bcc smallint NOT NULL DEFAULT '0', - is_read smallint NOT NULL DEFAULT '0', - is_new smallint NOT NULL DEFAULT '0', - deleted smallint NOT NULL DEFAULT '0', - in_inbox smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_pm, id_member) -); - -# -# Indexes for table `pm_recipients` -# - -CREATE UNIQUE INDEX {$db_prefix}pm_recipients_id_member ON {$db_prefix}pm_recipients (id_member, deleted, id_pm); - -# -# Sequence for table `pm_rules` -# - -CREATE SEQUENCE {$db_prefix}pm_rules_seq; - -# -# Table structure for table `pm_rules` -# - -CREATE TABLE {$db_prefix}pm_rules ( - id_rule bigint DEFAULT nextval('{$db_prefix}pm_rules_seq'), - id_member int NOT NULL DEFAULT '0', - rule_name varchar(60) NOT NULL, - criteria text NOT NULL, - actions text NOT NULL, - delete_pm smallint NOT NULL DEFAULT '0', - is_or smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_rule) -); - -# -# Indexes for table `pm_rules` -# - -CREATE INDEX {$db_prefix}pm_rules_id_member ON {$db_prefix}pm_rules (id_member); -CREATE INDEX {$db_prefix}pm_rules_delete_pm ON {$db_prefix}pm_rules (delete_pm); - -# -# Sequence for table `polls` -# - -CREATE SEQUENCE {$db_prefix}polls_seq; - -# -# Table structure for table `polls` -# - -CREATE TABLE {$db_prefix}polls ( - id_poll int DEFAULT nextval('{$db_prefix}polls_seq'), - question varchar(255) NOT NULL DEFAULT '', - voting_locked smallint NOT NULL DEFAULT '0', - max_votes smallint NOT NULL DEFAULT '1', - expire_time int NOT NULL DEFAULT '0', - hide_results smallint NOT NULL DEFAULT '0', - change_vote smallint NOT NULL DEFAULT '0', - guest_vote smallint NOT NULL DEFAULT '0', - num_guest_voters int NOT NULL DEFAULT '0', - reset_poll int NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - poster_name varchar(255) NOT NULL, - PRIMARY KEY (id_poll) -); - -# -# Table structure for table `poll_choices` -# - -CREATE TABLE {$db_prefix}poll_choices ( - id_poll int NOT NULL DEFAULT '0', - id_choice smallint NOT NULL DEFAULT '0', - label varchar(255) NOT NULL DEFAULT '', - votes smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_poll, id_choice) -); - -# -# Sequence for table `qanda` -# - -CREATE SEQUENCE {$db_prefix}qanda_seq; - -# -# Table structure for table `qanda` -# - -CREATE TABLE {$db_prefix}qanda ( - id_question smallint DEFAULT nextval('{$db_prefix}qanda_seq'), - lngfile varchar(255) NOT NULL DEFAULT '', - question varchar(255) NOT NULL DEFAULT '', - answers text NOT NULL, - PRIMARY KEY (id_question) -); - -# -# Indexes for table `qanda` -# - -CREATE INDEX {$db_prefix}qanda_lngfile ON {$db_prefix}qanda (lngfile varchar_pattern_ops); - -# -# Sequence for table `scheduled_tasks` -# - -CREATE SEQUENCE {$db_prefix}scheduled_tasks_seq START WITH 14; - -# -# Table structure for table `scheduled_tasks` -# - -CREATE TABLE {$db_prefix}scheduled_tasks ( - id_task smallint DEFAULT nextval('{$db_prefix}scheduled_tasks_seq'), - next_time int NOT NULL DEFAULT '0', - time_offset int NOT NULL DEFAULT '0', - time_regularity smallint NOT NULL DEFAULT '0', - time_unit varchar(1) NOT NULL DEFAULT 'h', - disabled smallint NOT NULL DEFAULT '0', - task varchar(24) NOT NULL DEFAULT '', - callable varchar(60) NOT NULL DEFAULT '', - PRIMARY KEY (id_task) -); - -# -# Indexes for table `scheduled_tasks` -# - -CREATE INDEX {$db_prefix}scheduled_tasks_next_time ON {$db_prefix}scheduled_tasks (next_time); -CREATE INDEX {$db_prefix}scheduled_tasks_disabled ON {$db_prefix}scheduled_tasks (disabled); -CREATE UNIQUE INDEX {$db_prefix}scheduled_tasks_task ON {$db_prefix}scheduled_tasks (task varchar_pattern_ops); - -# -# Table structure for table `settings` -# - -CREATE TABLE {$db_prefix}settings ( - variable varchar(255) NOT NULL DEFAULT '', - value text NOT NULL, - PRIMARY KEY (variable) -); - -# -# Table structure for table `sessions` -# - -CREATE UNLOGGED TABLE {$db_prefix}sessions ( - session_id varchar(128) NOT NULL DEFAULT '', - last_update bigint NOT NULL DEFAULT '0', - data text NOT NULL, - PRIMARY KEY (session_id) -); - -# -# Sequence for table `smileys` -# - -CREATE SEQUENCE {$db_prefix}smileys_seq; - -# -# Table structure for table `smileys` -# - -CREATE TABLE {$db_prefix}smileys ( - id_smiley smallint DEFAULT nextval('{$db_prefix}smileys_seq'), - code varchar(30) NOT NULL DEFAULT '', - description varchar(80) NOT NULL DEFAULT '', - smiley_row smallint NOT NULL DEFAULT '0', - smiley_order smallint NOT NULL DEFAULT '0', - hidden smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_smiley) -); - -# -# Table structure for table `smiley_files` -# - -CREATE TABLE {$db_prefix}smiley_files -( - id_smiley SMALLINT NOT NULL DEFAULT '0', - smiley_set VARCHAR(48) NOT NULL DEFAULT '', - filename VARCHAR(48) NOT NULL DEFAULT '', - PRIMARY KEY (id_smiley, smiley_set) -); - -# -# Sequence for table `spiders` -# - -CREATE SEQUENCE {$db_prefix}spiders_seq; - -# -# Table structure for table `spiders` -# - -CREATE TABLE {$db_prefix}spiders ( - id_spider smallint NOT NULL DEFAULT nextval('{$db_prefix}spiders_seq'), - spider_name varchar(255) NOT NULL DEFAULT '', - user_agent varchar(255) NOT NULL DEFAULT '', - ip_info varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_spider) -); - -# -# Sequence for table `subscriptions` -# - -CREATE SEQUENCE {$db_prefix}subscriptions_seq; - -# -# Table structure for table `subscriptions` -# - -CREATE TABLE {$db_prefix}subscriptions( - id_subscribe int NOT NULL DEFAULT nextval('{$db_prefix}subscriptions_seq'), - name varchar(60) NOT NULL DEFAULT '', - description varchar(255) NOT NULL DEFAULT '', - cost text NOT NULL, - length varchar(6) NOT NULL DEFAULT '', - id_group int NOT NULL DEFAULT '0', - add_groups varchar(40) NOT NULL DEFAULT '', - active smallint NOT NULL DEFAULT '1', - repeatable smallint NOT NULL DEFAULT '0', - allow_partial smallint NOT NULL DEFAULT '0', - reminder smallint NOT NULL DEFAULT '0', - email_complete text NOT NULL, - PRIMARY KEY (id_subscribe) -); - -# -# Indexes for table `subscriptions` -# - -CREATE INDEX {$db_prefix}subscriptions_active ON {$db_prefix}subscriptions (active); - -# -# Table structure for table `themes` -# - -CREATE TABLE {$db_prefix}themes ( - id_member int DEFAULT '0', - id_theme smallint DEFAULT '1', - variable varchar(255) DEFAULT '', - value text NOT NULL, - PRIMARY KEY (id_theme, id_member, variable) -); - -# -# Indexes for table `themes` -# - -CREATE INDEX {$db_prefix}themes_id_member ON {$db_prefix}themes (id_member); - -# -# Sequence for table `topics` -# - -CREATE SEQUENCE {$db_prefix}topics_seq START WITH 2; - -# -# Table structure for table `topics` -# - -CREATE TABLE {$db_prefix}topics ( - id_topic int DEFAULT nextval('{$db_prefix}topics_seq'), - is_sticky smallint NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - id_first_msg int NOT NULL DEFAULT '0', - id_last_msg bigint NOT NULL DEFAULT '0', - id_member_started int NOT NULL DEFAULT '0', - id_member_updated int NOT NULL DEFAULT '0', - id_poll int NOT NULL DEFAULT '0', - id_previous_board smallint NOT NULL DEFAULT '0', - id_previous_topic int NOT NULL DEFAULT '0', - num_replies bigint NOT NULL DEFAULT '0', - num_views bigint NOT NULL DEFAULT '0', - locked smallint NOT NULL DEFAULT '0', - redirect_expires int NOT NULL DEFAULT '0', - id_redirect_topic bigint NOT NULL DEFAULT '0', - unapproved_posts smallint NOT NULL DEFAULT '0', - approved smallint NOT NULL DEFAULT '1', - PRIMARY KEY (id_topic) -); - -# -# Indexes for table `topics` -# - -CREATE UNIQUE INDEX {$db_prefix}topics_last_message ON {$db_prefix}topics (id_last_msg, id_board); -CREATE UNIQUE INDEX {$db_prefix}topics_first_message ON {$db_prefix}topics (id_first_msg, id_board); -CREATE UNIQUE INDEX {$db_prefix}topics_poll ON {$db_prefix}topics (id_poll, id_topic); -CREATE INDEX {$db_prefix}topics_is_sticky ON {$db_prefix}topics (is_sticky); -CREATE INDEX {$db_prefix}topics_approved ON {$db_prefix}topics (approved); -CREATE INDEX {$db_prefix}topics_member_started ON {$db_prefix}topics (id_member_started, id_board); -CREATE INDEX {$db_prefix}topics_last_message_sticky ON {$db_prefix}topics (id_board, is_sticky, id_last_msg); -CREATE INDEX {$db_prefix}topics_board_news ON {$db_prefix}topics (id_board, id_first_msg); - -# -# Sequence for table `user_alerts` -# - -CREATE SEQUENCE {$db_prefix}user_alerts_seq; - -# -# Table structure for table `user_alerts` -# - -CREATE TABLE {$db_prefix}user_alerts ( - id_alert bigint DEFAULT nextval('{$db_prefix}user_alerts_seq'), - alert_time bigint NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - id_member_started bigint NOT NULL DEFAULT '0', - member_name varchar(255) NOT NULL DEFAULT '', - content_type varchar(255) NOT NULL DEFAULT '', - content_id bigint NOT NULL DEFAULT '0', - content_action varchar(255) NOT NULL DEFAULT '', - is_read bigint NOT NULL DEFAULT '0', - extra text NOT NULL, - PRIMARY KEY (id_alert) -); - -# -# Indexes for table `user_alerts` -# - -CREATE INDEX {$db_prefix}user_alerts_id_member ON {$db_prefix}user_alerts (id_member); -CREATE INDEX {$db_prefix}user_alerts_alert_time ON {$db_prefix}user_alerts (alert_time); - -# -# Table structure for table `user_alerts_prefs` -# - -CREATE TABLE {$db_prefix}user_alerts_prefs ( - id_member int NOT NULL DEFAULT '0', - alert_pref varchar(32) NOT NULL DEFAULT '', - alert_value smallint NOT NULL DEFAULT '0', - PRIMARY KEY (id_member, alert_pref) -); - -# -# Sequence for table `user_drafts` -# - -CREATE SEQUENCE {$db_prefix}user_drafts_seq; - -# -# Table structure for table `user_drafts` -# - -CREATE TABLE {$db_prefix}user_drafts ( - id_draft bigint DEFAULT nextval('{$db_prefix}user_drafts_seq'), - id_topic int NOT NULL DEFAULT '0', - id_board smallint NOT NULL DEFAULT '0', - id_reply bigint NOT NULL DEFAULT '0', - type smallint NOT NULL DEFAULT '0', - poster_time int NOT NULL DEFAULT '0', - id_member int NOT NULL DEFAULT '0', - subject varchar(255) NOT NULL DEFAULT '', - smileys_enabled smallint NOT NULL DEFAULT '1', - body text NOT NULL, - icon varchar(16) NOT NULL DEFAULT 'xx', - locked smallint NOT NULL DEFAULT '0', - is_sticky smallint NOT NULL DEFAULT '0', - to_list varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id_draft) -); - -# -# Indexes for table `user_drafts` -# - -CREATE UNIQUE INDEX {$db_prefix}user_drafts_id_member ON {$db_prefix}user_drafts (id_member, id_draft, type); - -# -# Table structure for table `user_likes` -# - -CREATE TABLE {$db_prefix}user_likes ( - id_member int NOT NULL DEFAULT '0', - content_type char(6) DEFAULT '', - content_id int NOT NULL DEFAULT '0', - like_time int NOT NULL DEFAULT '0', - PRIMARY KEY (content_id, content_type, id_member) -); - -# -# Indexes for table `user_likes` -# - -CREATE INDEX {$db_prefix}user_likes_content ON {$db_prefix}user_likes (content_id, content_type); -CREATE INDEX {$db_prefix}user_likes_liker ON {$db_prefix}user_likes (id_member); - -# -# Table structure for `mentions` -# -CREATE TABLE {$db_prefix}mentions ( - content_id int DEFAULT '0', - content_type varchar(10) DEFAULT '', - id_mentioned int DEFAULT 0, - id_member int NOT NULL DEFAULT 0, - time int NOT NULL DEFAULT 0, - PRIMARY KEY (content_id, content_type, id_mentioned) -); - -# -# Indexes for table `mentions` -# -CREATE INDEX {$db_prefix}mentions_content ON {$db_prefix}mentions (content_id, content_type); -CREATE INDEX {$db_prefix}mentions_mentionee ON {$db_prefix}mentions (id_member); - -# -# Yay for transactions... -# -BEGIN; - -# -# Dumping data for table `admin_info_files` -# - -INSERT INTO {$db_prefix}admin_info_files - (id_file, filename, path, parameters, data, filetype) -VALUES - (1, 'current-version.js', '/smf/', 'version=%3$s', '', 'text/javascript'), - (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', '', 'text/javascript'), - (3, 'latest-news.js', '/smf/', 'language=%1$s&format=%2$s', '', 'text/javascript'), - (4, 'latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'); -# -------------------------------------------------------- - -# -# Dumping data for table `board_permissions` -# - -INSERT INTO {$db_prefix}board_permissions - (id_group, id_profile, permission) -VALUES (-1, 1, 'poll_view'), - (0, 1, 'remove_own'), - (0, 1, 'lock_own'), - (0, 1, 'modify_own'), - (0, 1, 'poll_add_own'), - (0, 1, 'poll_edit_own'), - (0, 1, 'poll_lock_own'), - (0, 1, 'poll_post'), - (0, 1, 'poll_view'), - (0, 1, 'poll_vote'), - (0, 1, 'post_attachment'), - (0, 1, 'post_new'), - (0, 1, 'post_draft'), - (0, 1, 'post_reply_any'), - (0, 1, 'post_reply_own'), - (0, 1, 'post_unapproved_topics'), - (0, 1, 'post_unapproved_replies_any'), - (0, 1, 'post_unapproved_replies_own'), - (0, 1, 'post_unapproved_attachments'), - (0, 1, 'delete_own'), - (0, 1, 'report_any'), - (0, 1, 'view_attachments'), - (2, 1, 'moderate_board'), - (2, 1, 'post_new'), - (2, 1, 'post_draft'), - (2, 1, 'post_reply_own'), - (2, 1, 'post_reply_any'), - (2, 1, 'post_unapproved_topics'), - (2, 1, 'post_unapproved_replies_any'), - (2, 1, 'post_unapproved_replies_own'), - (2, 1, 'post_unapproved_attachments'), - (2, 1, 'poll_post'), - (2, 1, 'poll_add_any'), - (2, 1, 'poll_remove_any'), - (2, 1, 'poll_view'), - (2, 1, 'poll_vote'), - (2, 1, 'poll_lock_any'), - (2, 1, 'poll_edit_any'), - (2, 1, 'report_any'), - (2, 1, 'lock_own'), - (2, 1, 'delete_own'), - (2, 1, 'modify_own'), - (2, 1, 'make_sticky'), - (2, 1, 'lock_any'), - (2, 1, 'remove_any'), - (2, 1, 'move_any'), - (2, 1, 'merge_any'), - (2, 1, 'split_any'), - (2, 1, 'delete_any'), - (2, 1, 'modify_any'), - (2, 1, 'approve_posts'), - (2, 1, 'post_attachment'), - (2, 1, 'view_attachments'), - (3, 1, 'moderate_board'), - (3, 1, 'post_new'), - (3, 1, 'post_draft'), - (3, 1, 'post_reply_own'), - (3, 1, 'post_reply_any'), - (3, 1, 'post_unapproved_topics'), - (3, 1, 'post_unapproved_replies_any'), - (3, 1, 'post_unapproved_replies_own'), - (3, 1, 'post_unapproved_attachments'), - (3, 1, 'poll_post'), - (3, 1, 'poll_add_any'), - (3, 1, 'poll_remove_any'), - (3, 1, 'poll_view'), - (3, 1, 'poll_vote'), - (3, 1, 'poll_lock_any'), - (3, 1, 'poll_edit_any'), - (3, 1, 'report_any'), - (3, 1, 'lock_own'), - (3, 1, 'delete_own'), - (3, 1, 'modify_own'), - (3, 1, 'make_sticky'), - (3, 1, 'lock_any'), - (3, 1, 'remove_any'), - (3, 1, 'move_any'), - (3, 1, 'merge_any'), - (3, 1, 'split_any'), - (3, 1, 'delete_any'), - (3, 1, 'modify_any'), - (3, 1, 'approve_posts'), - (3, 1, 'post_attachment'), - (3, 1, 'view_attachments'), - (-1, 2, 'poll_view'), - (0, 2, 'remove_own'), - (0, 2, 'lock_own'), - (0, 2, 'modify_own'), - (0, 2, 'poll_view'), - (0, 2, 'poll_vote'), - (0, 2, 'post_attachment'), - (0, 2, 'post_new'), - (0, 2, 'post_draft'), - (0, 2, 'post_reply_any'), - (0, 2, 'post_reply_own'), - (0, 2, 'post_unapproved_topics'), - (0, 2, 'post_unapproved_replies_any'), - (0, 2, 'post_unapproved_replies_own'), - (0, 2, 'post_unapproved_attachments'), - (0, 2, 'delete_own'), - (0, 2, 'report_any'), - (0, 2, 'view_attachments'), - (2, 2, 'moderate_board'), - (2, 2, 'post_new'), - (2, 2, 'post_draft'), - (2, 2, 'post_reply_own'), - (2, 2, 'post_reply_any'), - (2, 2, 'post_unapproved_topics'), - (2, 2, 'post_unapproved_replies_any'), - (2, 2, 'post_unapproved_replies_own'), - (2, 2, 'post_unapproved_attachments'), - (2, 2, 'poll_post'), - (2, 2, 'poll_add_any'), - (2, 2, 'poll_remove_any'), - (2, 2, 'poll_view'), - (2, 2, 'poll_vote'), - (2, 2, 'poll_lock_any'), - (2, 2, 'poll_edit_any'), - (2, 2, 'report_any'), - (2, 2, 'lock_own'), - (2, 2, 'delete_own'), - (2, 2, 'modify_own'), - (2, 2, 'make_sticky'), - (2, 2, 'lock_any'), - (2, 2, 'remove_any'), - (2, 2, 'move_any'), - (2, 2, 'merge_any'), - (2, 2, 'split_any'), - (2, 2, 'delete_any'), - (2, 2, 'modify_any'), - (2, 2, 'approve_posts'), - (2, 2, 'post_attachment'), - (2, 2, 'view_attachments'), - (3, 2, 'moderate_board'), - (3, 2, 'post_new'), - (3, 2, 'post_draft'), - (3, 2, 'post_reply_own'), - (3, 2, 'post_reply_any'), - (3, 2, 'post_unapproved_topics'), - (3, 2, 'post_unapproved_replies_any'), - (3, 2, 'post_unapproved_replies_own'), - (3, 2, 'post_unapproved_attachments'), - (3, 2, 'poll_post'), - (3, 2, 'poll_add_any'), - (3, 2, 'poll_remove_any'), - (3, 2, 'poll_view'), - (3, 2, 'poll_vote'), - (3, 2, 'poll_lock_any'), - (3, 2, 'poll_edit_any'), - (3, 2, 'report_any'), - (3, 2, 'lock_own'), - (3, 2, 'delete_own'), - (3, 2, 'modify_own'), - (3, 2, 'make_sticky'), - (3, 2, 'lock_any'), - (3, 2, 'remove_any'), - (3, 2, 'move_any'), - (3, 2, 'merge_any'), - (3, 2, 'split_any'), - (3, 2, 'delete_any'), - (3, 2, 'modify_any'), - (3, 2, 'approve_posts'), - (3, 2, 'post_attachment'), - (3, 2, 'view_attachments'), - (-1, 3, 'poll_view'), - (0, 3, 'remove_own'), - (0, 3, 'lock_own'), - (0, 3, 'modify_own'), - (0, 3, 'poll_view'), - (0, 3, 'poll_vote'), - (0, 3, 'post_attachment'), - (0, 3, 'post_reply_any'), - (0, 3, 'post_reply_own'), - (0, 3, 'post_unapproved_replies_any'), - (0, 3, 'post_unapproved_replies_own'), - (0, 3, 'post_unapproved_attachments'), - (0, 3, 'delete_own'), - (0, 3, 'report_any'), - (0, 3, 'view_attachments'), - (2, 3, 'moderate_board'), - (2, 3, 'post_new'), - (2, 3, 'post_draft'), - (2, 3, 'post_reply_own'), - (2, 3, 'post_reply_any'), - (2, 3, 'post_unapproved_topics'), - (2, 3, 'post_unapproved_replies_any'), - (2, 3, 'post_unapproved_replies_own'), - (2, 3, 'post_unapproved_attachments'), - (2, 3, 'poll_post'), - (2, 3, 'poll_add_any'), - (2, 3, 'poll_remove_any'), - (2, 3, 'poll_view'), - (2, 3, 'poll_vote'), - (2, 3, 'poll_lock_any'), - (2, 3, 'poll_edit_any'), - (2, 3, 'report_any'), - (2, 3, 'lock_own'), - (2, 3, 'delete_own'), - (2, 3, 'modify_own'), - (2, 3, 'make_sticky'), - (2, 3, 'lock_any'), - (2, 3, 'remove_any'), - (2, 3, 'move_any'), - (2, 3, 'merge_any'), - (2, 3, 'split_any'), - (2, 3, 'delete_any'), - (2, 3, 'modify_any'), - (2, 3, 'approve_posts'), - (2, 3, 'post_attachment'), - (2, 3, 'view_attachments'), - (3, 3, 'moderate_board'), - (3, 3, 'post_new'), - (3, 3, 'post_draft'), - (3, 3, 'post_reply_own'), - (3, 3, 'post_reply_any'), - (3, 3, 'post_unapproved_topics'), - (3, 3, 'post_unapproved_replies_any'), - (3, 3, 'post_unapproved_replies_own'), - (3, 3, 'post_unapproved_attachments'), - (3, 3, 'poll_post'), - (3, 3, 'poll_add_any'), - (3, 3, 'poll_remove_any'), - (3, 3, 'poll_view'), - (3, 3, 'poll_vote'), - (3, 3, 'poll_lock_any'), - (3, 3, 'poll_edit_any'), - (3, 3, 'report_any'), - (3, 3, 'lock_own'), - (3, 3, 'delete_own'), - (3, 3, 'modify_own'), - (3, 3, 'make_sticky'), - (3, 3, 'lock_any'), - (3, 3, 'remove_any'), - (3, 3, 'move_any'), - (3, 3, 'merge_any'), - (3, 3, 'split_any'), - (3, 3, 'delete_any'), - (3, 3, 'modify_any'), - (3, 3, 'approve_posts'), - (3, 3, 'post_attachment'), - (3, 3, 'view_attachments'), - (-1, 4, 'poll_view'), - (0, 4, 'poll_view'), - (0, 4, 'poll_vote'), - (0, 4, 'report_any'), - (0, 4, 'view_attachments'), - (2, 4, 'moderate_board'), - (2, 4, 'post_new'), - (2, 4, 'post_draft'), - (2, 4, 'post_reply_own'), - (2, 4, 'post_reply_any'), - (2, 4, 'post_unapproved_topics'), - (2, 4, 'post_unapproved_replies_any'), - (2, 4, 'post_unapproved_replies_own'), - (2, 4, 'post_unapproved_attachments'), - (2, 4, 'poll_post'), - (2, 4, 'poll_add_any'), - (2, 4, 'poll_remove_any'), - (2, 4, 'poll_view'), - (2, 4, 'poll_vote'), - (2, 4, 'poll_lock_any'), - (2, 4, 'poll_edit_any'), - (2, 4, 'report_any'), - (2, 4, 'lock_own'), - (2, 4, 'delete_own'), - (2, 4, 'modify_own'), - (2, 4, 'make_sticky'), - (2, 4, 'lock_any'), - (2, 4, 'remove_any'), - (2, 4, 'move_any'), - (2, 4, 'merge_any'), - (2, 4, 'split_any'), - (2, 4, 'delete_any'), - (2, 4, 'modify_any'), - (2, 4, 'approve_posts'), - (2, 4, 'post_attachment'), - (2, 4, 'view_attachments'), - (3, 4, 'moderate_board'), - (3, 4, 'post_new'), - (3, 4, 'post_draft'), - (3, 4, 'post_reply_own'), - (3, 4, 'post_reply_any'), - (3, 4, 'post_unapproved_topics'), - (3, 4, 'post_unapproved_replies_any'), - (3, 4, 'post_unapproved_replies_own'), - (3, 4, 'post_unapproved_attachments'), - (3, 4, 'poll_post'), - (3, 4, 'poll_add_any'), - (3, 4, 'poll_remove_any'), - (3, 4, 'poll_view'), - (3, 4, 'poll_vote'), - (3, 4, 'poll_lock_any'), - (3, 4, 'poll_edit_any'), - (3, 4, 'report_any'), - (3, 4, 'lock_own'), - (3, 4, 'delete_own'), - (3, 4, 'modify_own'), - (3, 4, 'make_sticky'), - (3, 4, 'lock_any'), - (3, 4, 'remove_any'), - (3, 4, 'move_any'), - (3, 4, 'merge_any'), - (3, 4, 'split_any'), - (3, 4, 'delete_any'), - (3, 4, 'modify_any'), - (3, 4, 'approve_posts'), - (3, 4, 'post_attachment'), - (3, 4, 'view_attachments'); -# -------------------------------------------------------- - -# -# Dumping data for table `boards` -# - -INSERT INTO {$db_prefix}boards - (id_board, id_cat, board_order, id_last_msg, id_msg_updated, name, description, num_topics, num_posts, member_groups) -VALUES (1, 1, 1, 1, 1, '{$default_board_name}', '{$default_board_description}', 1, 1, '-1,0,2'); -# -------------------------------------------------------- - -# -# Dumping data for table `board_permissions_view` -# - -INSERT INTO {$db_prefix}board_permissions_view - (id_group, id_board, deny) -VALUES (-1,1,0), (0,1,0), (2,1,0); -# -------------------------------------------------------- - -# -# Dumping data for table `calendar_holidays` -# - -INSERT INTO {$db_prefix}calendar_holidays - (title, event_date) -VALUES ('New Year''s', '1004-01-01'), - ('Christmas', '1004-12-25'), - ('Valentine''s Day', '1004-02-14'), - ('St. Patrick''s Day', '1004-03-17'), - ('April Fools', '1004-04-01'), - ('Earth Day', '1004-04-22'), - ('United Nations Day', '1004-10-24'), - ('Halloween', '1004-10-31'), - ('Mother''s Day', '2010-05-09'), - ('Mother''s Day', '2011-05-08'), - ('Mother''s Day', '2012-05-13'), - ('Mother''s Day', '2013-05-12'), - ('Mother''s Day', '2014-05-11'), - ('Mother''s Day', '2015-05-10'), - ('Mother''s Day', '2016-05-08'), - ('Mother''s Day', '2017-05-14'), - ('Mother''s Day', '2018-05-13'), - ('Mother''s Day', '2019-05-12'), - ('Mother''s Day', '2020-05-10'), - ('Mother''s Day', '2021-05-09'), - ('Mother''s Day', '2022-05-08'), - ('Mother''s Day', '2023-05-14'), - ('Mother''s Day', '2024-05-12'), - ('Mother''s Day', '2025-05-11'), - ('Mother''s Day', '2026-05-10'), - ('Mother''s Day', '2027-05-09'), - ('Mother''s Day', '2028-05-14'), - ('Mother''s Day', '2029-05-13'), - ('Mother''s Day', '2030-05-12'), - ('Father''s Day', '2010-06-20'), - ('Father''s Day', '2011-06-19'), - ('Father''s Day', '2012-06-17'), - ('Father''s Day', '2013-06-16'), - ('Father''s Day', '2014-06-15'), - ('Father''s Day', '2015-06-21'), - ('Father''s Day', '2016-06-19'), - ('Father''s Day', '2017-06-18'), - ('Father''s Day', '2018-06-17'), - ('Father''s Day', '2019-06-16'), - ('Father''s Day', '2020-06-21'), - ('Father''s Day', '2021-06-20'), - ('Father''s Day', '2022-06-19'), - ('Father''s Day', '2023-06-18'), - ('Father''s Day', '2024-06-16'), - ('Father''s Day', '2025-06-15'), - ('Father''s Day', '2026-06-21'), - ('Father''s Day', '2027-06-20'), - ('Father''s Day', '2028-06-18'), - ('Father''s Day', '2029-06-17'), - ('Father''s Day', '2030-06-16'), - ('Summer Solstice', '2010-06-21'), - ('Summer Solstice', '2011-06-21'), - ('Summer Solstice', '2012-06-20'), - ('Summer Solstice', '2013-06-21'), - ('Summer Solstice', '2014-06-21'), - ('Summer Solstice', '2015-06-21'), - ('Summer Solstice', '2016-06-20'), - ('Summer Solstice', '2017-06-20'), - ('Summer Solstice', '2018-06-21'), - ('Summer Solstice', '2019-06-21'), - ('Summer Solstice', '2020-06-20'), - ('Summer Solstice', '2021-06-21'), - ('Summer Solstice', '2022-06-21'), - ('Summer Solstice', '2023-06-21'), - ('Summer Solstice', '2024-06-20'), - ('Summer Solstice', '2025-06-21'), - ('Summer Solstice', '2026-06-21'), - ('Summer Solstice', '2027-06-21'), - ('Summer Solstice', '2028-06-20'), - ('Summer Solstice', '2029-06-21'), - ('Summer Solstice', '2030-06-21'), - ('Vernal Equinox', '2010-03-20'), - ('Vernal Equinox', '2011-03-20'), - ('Vernal Equinox', '2012-03-20'), - ('Vernal Equinox', '2013-03-20'), - ('Vernal Equinox', '2014-03-20'), - ('Vernal Equinox', '2015-03-20'), - ('Vernal Equinox', '2016-03-20'), - ('Vernal Equinox', '2017-03-20'), - ('Vernal Equinox', '2018-03-20'), - ('Vernal Equinox', '2019-03-20'), - ('Vernal Equinox', '2020-03-20'), - ('Vernal Equinox', '2021-03-20'), - ('Vernal Equinox', '2022-03-20'), - ('Vernal Equinox', '2023-03-20'), - ('Vernal Equinox', '2024-03-20'), - ('Vernal Equinox', '2025-03-20'), - ('Vernal Equinox', '2026-03-20'), - ('Vernal Equinox', '2027-03-20'), - ('Vernal Equinox', '2028-03-20'), - ('Vernal Equinox', '2029-03-20'), - ('Vernal Equinox', '2030-03-20'), - ('Winter Solstice', '2010-12-21'), - ('Winter Solstice', '2011-12-22'), - ('Winter Solstice', '2012-12-21'), - ('Winter Solstice', '2013-12-21'), - ('Winter Solstice', '2014-12-21'), - ('Winter Solstice', '2015-12-22'), - ('Winter Solstice', '2016-12-21'), - ('Winter Solstice', '2017-12-21'), - ('Winter Solstice', '2018-12-21'), - ('Winter Solstice', '2019-12-22'), - ('Winter Solstice', '2020-12-21'), - ('Winter Solstice', '2021-12-21'), - ('Winter Solstice', '2022-12-21'), - ('Winter Solstice', '2023-12-22'), - ('Winter Solstice', '2024-12-21'), - ('Winter Solstice', '2025-12-21'), - ('Winter Solstice', '2026-12-21'), - ('Winter Solstice', '2027-12-22'), - ('Winter Solstice', '2028-12-21'), - ('Winter Solstice', '2029-12-21'), - ('Winter Solstice', '2030-12-21'), - ('Autumnal Equinox', '2010-09-23'), - ('Autumnal Equinox', '2011-09-23'), - ('Autumnal Equinox', '2012-09-22'), - ('Autumnal Equinox', '2013-09-22'), - ('Autumnal Equinox', '2014-09-23'), - ('Autumnal Equinox', '2015-09-23'), - ('Autumnal Equinox', '2016-09-22'), - ('Autumnal Equinox', '2017-09-22'), - ('Autumnal Equinox', '2018-09-23'), - ('Autumnal Equinox', '2019-09-23'), - ('Autumnal Equinox', '2020-09-22'), - ('Autumnal Equinox', '2021-09-22'), - ('Autumnal Equinox', '2022-09-23'), - ('Autumnal Equinox', '2023-09-23'), - ('Autumnal Equinox', '2024-09-22'), - ('Autumnal Equinox', '2025-09-22'), - ('Autumnal Equinox', '2026-09-23'), - ('Autumnal Equinox', '2027-09-23'), - ('Autumnal Equinox', '2028-09-22'), - ('Autumnal Equinox', '2029-09-22'), - ('Autumnal Equinox', '2030-09-22'); - -INSERT INTO {$db_prefix}calendar_holidays - (title, event_date) -VALUES ('Independence Day', '1004-07-04'), - ('Cinco de Mayo', '1004-05-05'), - ('Flag Day', '1004-06-14'), - ('Veterans Day', '1004-11-11'), - ('Groundhog Day', '1004-02-02'), - ('Thanksgiving', '2010-11-25'), - ('Thanksgiving', '2011-11-24'), - ('Thanksgiving', '2012-11-22'), - ('Thanksgiving', '2013-11-28'), - ('Thanksgiving', '2014-11-27'), - ('Thanksgiving', '2015-11-26'), - ('Thanksgiving', '2016-11-24'), - ('Thanksgiving', '2017-11-23'), - ('Thanksgiving', '2018-11-22'), - ('Thanksgiving', '2019-11-28'), - ('Thanksgiving', '2020-11-26'), - ('Thanksgiving', '2021-11-25'), - ('Thanksgiving', '2022-11-24'), - ('Thanksgiving', '2023-11-23'), - ('Thanksgiving', '2024-11-28'), - ('Thanksgiving', '2025-11-27'), - ('Thanksgiving', '2026-11-26'), - ('Thanksgiving', '2027-11-25'), - ('Thanksgiving', '2028-11-23'), - ('Thanksgiving', '2029-11-22'), - ('Thanksgiving', '2030-11-28'), - ('Memorial Day', '2010-05-31'), - ('Memorial Day', '2011-05-30'), - ('Memorial Day', '2012-05-28'), - ('Memorial Day', '2013-05-27'), - ('Memorial Day', '2014-05-26'), - ('Memorial Day', '2015-05-25'), - ('Memorial Day', '2016-05-30'), - ('Memorial Day', '2017-05-29'), - ('Memorial Day', '2018-05-28'), - ('Memorial Day', '2019-05-27'), - ('Memorial Day', '2020-05-25'), - ('Memorial Day', '2021-05-31'), - ('Memorial Day', '2022-05-30'), - ('Memorial Day', '2023-05-29'), - ('Memorial Day', '2024-05-27'), - ('Memorial Day', '2025-05-26'), - ('Memorial Day', '2026-05-25'), - ('Memorial Day', '2027-05-31'), - ('Memorial Day', '2028-05-29'), - ('Memorial Day', '2029-05-28'), - ('Memorial Day', '2030-05-27'), - ('Labor Day', '2010-09-06'), - ('Labor Day', '2011-09-05'), - ('Labor Day', '2012-09-03'), - ('Labor Day', '2013-09-02'), - ('Labor Day', '2014-09-01'), - ('Labor Day', '2015-09-07'), - ('Labor Day', '2016-09-05'), - ('Labor Day', '2017-09-04'), - ('Labor Day', '2018-09-03'), - ('Labor Day', '2019-09-02'), - ('Labor Day', '2020-09-07'), - ('Labor Day', '2021-09-06'), - ('Labor Day', '2022-09-05'), - ('Labor Day', '2023-09-04'), - ('Labor Day', '2024-09-02'), - ('Labor Day', '2025-09-01'), - ('Labor Day', '2026-09-07'), - ('Labor Day', '2027-09-06'), - ('Labor Day', '2028-09-04'), - ('Labor Day', '2029-09-03'), - ('Labor Day', '2030-09-02'), - ('D-Day', '1004-06-06'); -# -------------------------------------------------------- - -# -# Dumping data for table `categories` -# - -INSERT INTO {$db_prefix}categories -VALUES (1, 0, '{$default_category_name}', '', 1); -# -------------------------------------------------------- - -# -# Dumping data for table `custom_fields` -# - -INSERT INTO {$db_prefix}custom_fields - (col_name, field_name, field_desc, field_type, field_length, field_options, field_order, mask, show_reg, show_display, show_mlist, show_profile, private, active, bbc, can_search, default_value, enclose, placement) -VALUES ('cust_icq', '{icq}', '{icq_desc}', 'text', 12, '', 1, 'regex~[1-9][0-9]{4,9}~i', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', 'ICQ - {INPUT}', 1), - ('cust_skype', '{skype}', '{skype_desc}', 'text', 32, '', 2, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '{INPUT} ', 1), - ('cust_loca', '{location}', '{location_desc}', 'text', 50, '', 4, 'nohtml', 0, 1, 0, 'forumprofile', 0, 1, 0, 0, '', '', 0), - ('cust_gender', '{gender}', '{gender_desc}', 'radio', 255, '{gender_0},{gender_1},{gender_2}', 5, 'nohtml', 1, 1, 0, 'forumprofile', 0, 1, 0, 0, '{gender_0}', '', 1); - -# -------------------------------------------------------- - -# -# Dumping data for table `membergroups` -# - -INSERT INTO {$db_prefix}membergroups - (id_group, group_name, description, online_color, min_posts, icons, group_type) -VALUES (1, '{$default_administrator_group}', '', '#FF0000', -1, '5#iconadmin.png', 1), - (2, '{$default_global_moderator_group}', '', '#0000FF', -1, '5#icongmod.png', 0), - (3, '{$default_moderator_group}', '', '', -1, '5#iconmod.png', 0), - (4, '{$default_newbie_group}', '', '', 0, '1#icon.png', 0), - (5, '{$default_junior_group}', '', '', 50, '2#icon.png', 0), - (6, '{$default_full_group}', '', '', 100, '3#icon.png', 0), - (7, '{$default_senior_group}', '', '', 250, '4#icon.png', 0), - (8, '{$default_hero_group}', '', '', 500, '5#icon.png', 0); -# -------------------------------------------------------- - -# -# Dumping data for table `message_icons` -# - -# // !!! i18n -INSERT INTO {$db_prefix}message_icons - (filename, title, icon_order) -VALUES ('xx', 'Standard', '0'), - ('thumbup', 'Thumb Up', '1'), - ('thumbdown', 'Thumb Down', '2'), - ('exclamation', 'Exclamation point', '3'), - ('question', 'Question mark', '4'), - ('lamp', 'Lamp', '5'), - ('smiley', 'Smiley', '6'), - ('angry', 'Angry', '7'), - ('cheesy', 'Cheesy', '8'), - ('grin', 'Grin', '9'), - ('sad', 'Sad', '10'), - ('wink', 'Wink', '11'), - ('poll', 'Poll', '12'); -# -------------------------------------------------------- - -# -# Dumping data for table `messages` -# - -INSERT INTO {$db_prefix}messages - (id_msg, id_msg_modified, id_topic, id_board, poster_time, subject, poster_name, poster_email, modified_name, body, icon) -VALUES (1, 1, 1, 1, {$current_time}, '{$default_topic_subject}', 'Simple Machines', 'info@simplemachines.org', '', '{$default_topic_message}', 'xx'); -# -------------------------------------------------------- - -# -# Dumping data for table `package_servers` -# - -INSERT INTO {$db_prefix}package_servers - (name, url, validation_url) -VALUES ('Simple Machines Third-party Mod Site', 'https://custom.simplemachines.org/packages/mods', 'https://custom.simplemachines.org/api.php?action=validate;version=v1;smf_version={SMF_VERSION}'), - ('Simple Machines Downloads Site', 'https://download.simplemachines.org/browse.php?api=v1;smf_version={SMF_VERSION}', 'https://download.simplemachines.org/validate.php?api=v1;smf_version={SMF_VERSION}'); -# -------------------------------------------------------- - -# -# Dumping data for table `permission_profiles` -# - -INSERT INTO {$db_prefix}permission_profiles - (id_profile, profile_name) -VALUES (1, 'default'), (2, 'no_polls'), (3, 'reply_only'), (4, 'read_only'); -# -------------------------------------------------------- - -# -# Dumping data for table `permissions` -# - -INSERT INTO {$db_prefix}permissions - (id_group, permission) -VALUES (-1, 'search_posts'), - (-1, 'calendar_view'), - (-1, 'view_stats'), - (0, 'view_mlist'), - (0, 'search_posts'), - (0, 'profile_view'), - (0, 'pm_read'), - (0, 'pm_send'), - (0, 'pm_draft'), - (0, 'calendar_view'), - (0, 'view_stats'), - (0, 'who_view'), - (0, 'profile_identity_own'), - (0, 'profile_password_own'), - (0, 'profile_blurb_own'), - (0, 'profile_displayed_name_own'), - (0, 'profile_signature_own'), - (0, 'profile_website_own'), - (0, 'profile_forum_own'), - (0, 'profile_extra_own'), - (0, 'profile_remove_own'), - (0, 'profile_server_avatar'), - (0, 'profile_upload_avatar'), - (0, 'profile_remote_avatar'), - (0, 'send_email_to_members'), - (2, 'view_mlist'), - (2, 'search_posts'), - (2, 'profile_view'), - (2, 'pm_read'), - (2, 'pm_send'), - (2, 'pm_draft'), - (2, 'calendar_view'), - (2, 'view_stats'), - (2, 'who_view'), - (2, 'profile_identity_own'), - (2, 'profile_password_own'), - (2, 'profile_blurb_own'), - (2, 'profile_displayed_name_own'), - (2, 'profile_signature_own'), - (2, 'profile_website_own'), - (2, 'profile_forum_own'), - (2, 'profile_extra_own'), - (2, 'profile_remove_own'), - (2, 'profile_server_avatar'), - (2, 'profile_upload_avatar'), - (2, 'profile_remote_avatar'), - (2, 'send_email_to_members'), - (2, 'profile_title_own'), - (2, 'calendar_post'), - (2, 'calendar_edit_any'), - (2, 'access_mod_center'); -# -------------------------------------------------------- - -# -# Dumping data for table `scheduled_tasks` -# - -INSERT INTO {$db_prefix}scheduled_tasks - (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task, callable) -VALUES - (3, 0, 60, 1, 'd', 0, 'daily_maintenance', ''), - (5, 0, 0, 1, 'd', 0, 'daily_digest', ''), - (6, 0, 0, 1, 'w', 0, 'weekly_digest', ''), - (7, 0, {$sched_task_offset}, 1, 'd', 0, 'fetchSMfiles', ''), - (8, 0, 0, 1, 'd', 1, 'birthdayemails', ''), - (9, 0, 0, 1, 'w', 0, 'weekly_maintenance', ''), - (10, 0, 120, 1, 'd', 1, 'paid_subscriptions', ''), - (11, 0, 120, 1, 'd', 0, 'remove_temp_attachments', ''), - (12, 0, 180, 1, 'd', 0, 'remove_topic_redirect', ''), - (13, 0, 240, 1, 'd', 0, 'remove_old_drafts', ''), - (14, 0, 0, 1, 'w', 1, 'prune_log_topics', ''); - -# -------------------------------------------------------- - -# -# Dumping data for table `settings` -# - -INSERT INTO {$db_prefix}settings - (variable, value) -VALUES ('smfVersion', '{$smf_version}'), - ('news', '{$default_news}'), - ('compactTopicPagesContiguous', '5'), - ('compactTopicPagesEnable', '1'), - ('todayMod', '1'), - ('enablePreviousNext', '1'), - ('pollMode', '1'), - ('enableCompressedOutput', '{$enableCompressedOutput}'), - ('attachmentSizeLimit', '128'), - ('attachmentPostLimit', '192'), - ('attachmentNumPerPostLimit', '4'), - ('attachmentDirSizeLimit', '10240'), - ('attachmentDirFileLimit', '1000'), - ('attachmentUploadDir', '{$attachdir}'), - ('attachmentExtensions', 'doc,gif,jpg,mpg,pdf,png,txt,zip'), - ('attachmentCheckExtensions', '0'), - ('attachmentShowImages', '1'), - ('attachmentEnable', '1'), - ('attachmentThumbnails', '1'), - ('attachmentThumbWidth', '150'), - ('attachmentThumbHeight', '150'), - ('use_subdirectories_for_attachments', '1'), - ('currentAttachmentUploadDir', 1), - ('censorIgnoreCase', '1'), - ('mostOnline', '1'), - ('mostOnlineToday', '1'), - ('mostDate', {$current_time}), - ('trackStats', '1'), - ('userLanguage', '1'), - ('titlesEnable', '1'), - ('topicSummaryPosts', '15'), - ('enableErrorLogging', '1'), - ('max_image_width', '0'), - ('max_image_height', '0'), - ('onlineEnable', '0'), - ('boardindex_max_depth', '5'), - ('cal_enabled', '0'), - ('cal_showInTopic', '1'), - ('cal_maxyear', '2030'), - ('cal_minyear', '2008'), - ('cal_daysaslink', '0'), - ('cal_defaultboard', ''), - ('cal_showholidays', '1'), - ('cal_showbdays', '1'), - ('cal_showevents', '1'), - ('cal_maxspan', '0'), - ('cal_disable_prev_next', '0'), - ('cal_display_type', '0'), - ('cal_week_links', '2'), - ('cal_prev_next_links', '1'), - ('cal_short_days', '0'), - ('cal_short_months', '0'), - ('smtp_host', ''), - ('smtp_port', '25'), - ('smtp_username', ''), - ('smtp_password', ''), - ('mail_type', '0'), - ('timeLoadPageEnable', '0'), - ('totalMembers', '0'), - ('totalTopics', '1'), - ('totalMessages', '1'), - ('censor_vulgar', ''), - ('censor_proper', ''), - ('enablePostHTML', '0'), - ('theme_allow', '1'), - ('theme_default', '1'), - ('theme_guests', '1'), - ('xmlnews_enable', '1'), - ('xmlnews_maxlen', '255'), - ('registration_method', '{$registration_method}'), - ('send_validation_onChange', '0'), - ('send_welcomeEmail', '1'), - ('allow_editDisplayName', '1'), - ('allow_hideOnline', '1'), - ('spamWaitTime', '5'), - ('pm_spam_settings', '10,5,20'), - ('reserveWord', '0'), - ('reserveCase', '1'), - ('reserveUser', '1'), - ('reserveName', '1'), - ('reserveNames', E'{$default_reserved_names}'), - ('autoLinkUrls', '1'), - ('banLastUpdated', '0'), - ('smileys_dir', '{$boarddir}/Smileys'), - ('smileys_url', '{$boardurl}/Smileys'), - ('custom_avatar_dir', '{$boarddir}/custom_avatar'), - ('custom_avatar_url', '{$boardurl}/custom_avatar'), - ('avatar_directory', '{$boarddir}/avatars'), - ('avatar_url', '{$boardurl}/avatars'), - ('avatar_max_height_external', '65'), - ('avatar_max_width_external', '65'), - ('avatar_action_too_large', 'option_css_resize'), - ('avatar_max_height_upload', '65'), - ('avatar_max_width_upload', '65'), - ('avatar_resize_upload', '1'), - ('avatar_download_png', '1'), - ('failed_login_threshold', '3'), - ('oldTopicDays', '120'), - ('edit_wait_time', '90'), - ('edit_disable_time', '0'), - ('autoFixDatabase', '1'), - ('allow_guestAccess', '1'), - ('time_format', '{$default_time_format}'), - ('number_format', '1234.00'), - ('enableBBC', '1'), - ('max_messageLength', '20000'), - ('signature_settings', '1,300,0,0,0,0,0,0:'), - ('defaultMaxMessages', '15'), - ('defaultMaxTopics', '20'), - ('defaultMaxMembers', '30'), - ('enableParticipation', '1'), - ('recycle_enable', '0'), - ('recycle_board', '0'), - ('maxMsgID', '1'), - ('enableAllMessages', '0'), - ('knownThemes', '1'), - ('enableThemes', '1'), - ('who_enabled', '1'), - ('cookieTime', '3153600'), - ('lastActive', '15'), - ('smiley_sets_known', 'fugue,alienine'), - ('smiley_sets_names', '{$default_fugue_smileyset_name}'||E'\n'||'{$default_alienine_smileyset_name}'), - ('smiley_sets_default', 'fugue'), - ('cal_days_for_index', '7'), - ('requireAgreement', '1'), - ('requirePolicyAgreement', '0'), - ('unapprovedMembers', '0'), - ('default_personal_text', ''), - ('package_make_backups', '1'), - ('databaseSession_enable', '{$databaseSession_enable}'), - ('databaseSession_loose', '1'), - ('databaseSession_lifetime', '2880'), - ('search_cache_size', '50'), - ('search_results_per_page', '30'), - ('search_weight_frequency', '30'), - ('search_weight_age', '25'), - ('search_weight_length', '20'), - ('search_weight_subject', '15'), - ('search_weight_first_message', '10'), - ('search_max_results', '1200'), - ('search_floodcontrol_time', '5'), - ('permission_enable_deny', '0'), - ('permission_enable_postgroups', '0'), - ('mail_next_send', '0'), - ('mail_recent', '0000000000|0'), - ('settings_updated', '0'), - ('next_task_time', '1'), - ('warning_settings', '1,20,0'), - ('warning_watch', '10'), - ('warning_moderate', '35'), - ('warning_mute', '60'), - ('last_mod_report_action', '0'), - ('pruningOptions', '30,180,180,180,30,0'), - ('mark_read_beyond', '90'), - ('mark_read_delete_beyond', '365'), - ('mark_read_max_users', '500'), - ('modlog_enabled', '1'), - ('adminlog_enabled', '1'), - ('reg_verification', '1'), - ('visual_verification_type', '3'), - ('enable_buddylist', '1'), - ('birthday_email', 'happy_birthday'), - ('dont_repeat_theme_core', '1'), - ('dont_repeat_smileys_20', '1'), - ('dont_repeat_buddylists', '1'), - ('attachment_image_reencode', '1'), - ('attachment_image_paranoid', '0'), - ('attachment_thumb_png', '1'), - ('avatar_reencode', '1'), - ('avatar_paranoid', '0'), - ('drafts_post_enabled', '1'), - ('drafts_pm_enabled', '1'), - ('drafts_autosave_enabled', '1'), - ('drafts_show_saved_enabled', '1'), - ('drafts_keep_days', '7'), - ('topic_move_any', '0'), - ('mail_limit', '5'), - ('mail_quantity', '5'), - ('additional_options_collapsable', '1'), - ('show_modify', '1'), - ('show_user_images', '1'), - ('show_blurb', '1'), - ('show_profile_buttons', '1'), - ('enable_ajax_alerts', '1'), - ('alerts_auto_purge', '30'), - ('gravatarEnabled', '1'), - ('gravatarOverride', '0'), - ('gravatarAllowExtraEmail', '1'), - ('gravatarMaxRating', 'PG'), - ('defaultMaxListItems', '15'), - ('loginHistoryDays', '30'), - ('httponlyCookies', '1'), - ('samesiteCookies', 'lax'), - ('tfa_mode', '1'), - ('export_dir', '{$boarddir}/exports'), - ('export_expiry', '7'), - ('export_min_diskspace_pct', '5'), - ('export_rate', '250'), - ('allow_expire_redirect', '1'), - ('json_done', '1'), - ('attachments_21_done', '1'), - ('displayFields', '[{"col_name":"cust_icq","title":"ICQ","type":"text","order":"1","bbc":"0","placement":"1","enclose":"\"ICQ<\/a>","mlist":"0"},{"col_name":"cust_skype","title":"Skype","type":"text","order":"2","bbc":"0","placement":"1","enclose":"\"{INPUT}\"<\/a> ","mlist":"0"},{"col_name":"cust_loca","title":"Location","type":"text","order":"4","bbc":"0","placement":"0","enclose":"","mlist":"0"},{"col_name":"cust_gender","title":"Gender","type":"radio","order":"5","bbc":"0","placement":"1","enclose":"<\/span>","mlist":"0","options":["None","Male","Female"]}]'), - ('minimize_files', '1'), - ('securityDisable_moderate', '1'); -# -------------------------------------------------------- - -# -# Dumping data for table `smileys` -# - -INSERT INTO {$db_prefix}smileys - (code, description, smiley_order, hidden) -VALUES (':)', '{$default_smiley_smiley}', 0, 0), - (';)', '{$default_wink_smiley}', 1, 0), - (':D', '{$default_cheesy_smiley}', 2, 0), - (';D', '{$default_grin_smiley}', 3, 0), - ('>:(', '{$default_angry_smiley}', 4, 0), - (':(', '{$default_sad_smiley}', 5, 0), - (':o', '{$default_shocked_smiley}', 6, 0), - ('8)', '{$default_cool_smiley}', 7, 0), - ('???', '{$default_huh_smiley}', 8, 0), - ('::)', '{$default_roll_eyes_smiley}', 9, 0), - (':P', '{$default_tongue_smiley}', 10, 0), - (':-[', '{$default_embarrassed_smiley}', 11, 0), - (':-X', '{$default_lips_sealed_smiley}', 12, 0), - (':-\', '{$default_undecided_smiley}', 13, 0), - (':-*', '{$default_kiss_smiley}', 14, 0), - (':''(', '{$default_cry_smiley}', 15, 0), - ('>:D', '{$default_evil_smiley}', 16, 1), - ('^-^', '{$default_azn_smiley}', 17, 1), - ('O0', '{$default_afro_smiley}', 18, 1), - (':))', '{$default_laugh_smiley}', 19, 1), - ('C:-)', '{$default_police_smiley}', 20, 1), - ('O:-)', '{$default_angel_smiley}', 21, 1); -# -------------------------------------------------------- - -# -# Dumping data for table `spiders` -# - -INSERT INTO {$db_prefix}spiders - (spider_name, user_agent, ip_info) -VALUES ('Google', 'googlebot', ''), - ('Yahoo!', 'slurp', ''), - ('Bing', 'bingbot', ''), - ('Google (Mobile)', 'Googlebot-Mobile', ''), - ('Google (Image)', 'Googlebot-Image', ''), - ('Google (AdSense)', 'Mediapartners-Google', ''), - ('Google (Adwords)', 'AdsBot-Google', ''), - ('Yahoo! (Mobile)', 'YahooSeeker/M1A1-R2D2', ''), - ('Yahoo! (Image)', 'Yahoo-MMCrawler', ''), - ('Bing (Preview)', 'BingPreview', ''), - ('Bing (Ads)', 'adidxbot', ''), - ('Bing (MSNBot)', 'msnbot', ''), - ('Bing (Media)', 'msnbot-media', ''), - ('Cuil', 'twiceler', ''), - ('Ask', 'Teoma', ''), - ('Baidu', 'Baiduspider', ''), - ('Gigablast', 'Gigabot', ''), - ('InternetArchive', 'ia_archiver-web.archive.org', ''), - ('Alexa', 'ia_archiver', ''), - ('Omgili', 'omgilibot', ''), - ('EntireWeb', 'Speedy Spider', ''), - ('Yandex', 'yandex', ''); -#--------------------------------------------------------- - -# -# Dumping data for table `themes` -# - -INSERT INTO {$db_prefix}themes - (id_theme, variable, value) -VALUES (1, 'name', '{$default_theme_name}'), - (1, 'theme_url', '{$boardurl}/Themes/default'), - (1, 'images_url', '{$boardurl}/Themes/default/images'), - (1, 'theme_dir', '{$boarddir}/Themes/default'), - (1, 'show_latest_member', '1'), - (1, 'show_newsfader', '0'), - (1, 'number_recent_posts', '0'), - (1, 'show_stats_index', '1'), - (1, 'newsfader_time', '3000'), - (1, 'use_image_buttons', '1'), - (1, 'enable_news', '1'); - -INSERT INTO {$db_prefix}themes - (id_member, id_theme, variable, value) -VALUES (-1, 1, 'posts_apply_ignore_list', '1'), - (-1, 1, 'drafts_show_saved_enabled', '1'), - (-1, 1, 'return_to_post', '1'); -# -------------------------------------------------------- - -# -# Dumping data for table `topics` -# - -INSERT INTO {$db_prefix}topics - (id_topic, id_board, id_first_msg, id_last_msg, id_member_started, id_member_updated) -VALUES (1, 1, 1, 1, 0, 0); -# -------------------------------------------------------- - -# -# Dumping data for table `user_alerts_prefs` -# - -INSERT INTO {$db_prefix}user_alerts_prefs - (id_member, alert_pref, alert_value) -VALUES (0, 'alert_timeout', 10), - (0, 'announcements', 0), - (0, 'birthday', 2), - (0, 'board_notify', 1), - (0, 'buddy_request', 1), - (0, 'groupr_approved', 3), - (0, 'groupr_rejected', 3), - (0, 'member_group_request', 1), - (0, 'member_register', 1), - (0, 'member_report', 3), - (0, 'member_report_reply', 3), - (0, 'msg_auto_notify', 0), - (0, 'msg_like', 1), - (0, 'msg_mention', 1), - (0, 'msg_notify_pref', 1), - (0, 'msg_notify_type', 1), - (0, 'msg_quote', 1), - (0, 'msg_receive_body', 0), - (0, 'msg_report', 1), - (0, 'msg_report_reply', 1), - (0, 'pm_new', 1), - (0, 'pm_notify', 1), - (0, 'pm_reply', 1), - (0, 'request_group', 1), - (0, 'topic_notify', 1), - (0, 'unapproved_attachment', 1), - (0, 'unapproved_reply', 3), - (0, 'unapproved_post', 1), - (0, 'warn_any', 1); -# -------------------------------------------------------- - -# -# Now we push all this through... -# -COMMIT; \ No newline at end of file From 682dfc66ae1ae76612fd7fd087de0d7bee888a70 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Thu, 8 Feb 2024 17:37:02 -0700 Subject: [PATCH 004/102] Update Column.php Co-authored-by: John Rayes --- Sources/Db/Schema/Column.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Db/Schema/Column.php b/Sources/Db/Schema/Column.php index 45f0887cd4..877ebd3ea2 100644 --- a/Sources/Db/Schema/Column.php +++ b/Sources/Db/Schema/Column.php @@ -122,7 +122,7 @@ public function __construct( ?int $size = null, ?bool $unsigned = null, ?bool $not_null = null, - mixed $default = null, + string|float|int|bool|null $default = null, ?bool $auto = null, ?string $charset = null, ) { From 6b21c03fa0e610086204c315ec15a3ea15c8981a Mon Sep 17 00:00:00 2001 From: jdarwood007 Date: Thu, 8 Feb 2024 20:35:37 -0800 Subject: [PATCH 005/102] Worked on some phpdoc --- .github/workflows/php-cs-fixer.yml | 3 +- Sources/Db/DatabaseApi.php | 1 + Sources/Db/Schema/v3_0/AdminInfoFiles.php | 2 +- Sources/Db/Schema/v3_0/Categories.php | 2 +- Sources/Db/Schema/v3_0/LogFloodcontrol.php | 2 +- Sources/Db/Schema/v3_0/MessageIcons.php | 2 +- Sources/Db/Schema/v3_0/PermissionProfiles.php | 2 +- Sources/Db/Schema/v3_0/Permissions.php | 2 +- Sources/Db/Schema/v3_0/ScheduledTasks.php | 2 +- Sources/Db/Schema/v3_0/Settings.php | 2 +- Sources/Db/Schema/v3_0/Themes.php | 2 +- Sources/Db/Schema/v3_0/UserAlertsPrefs.php | 2 +- Sources/Maintenance.php | 410 +-- Sources/Maintenance/Database/MySQL.php | 229 +- Sources/Maintenance/Database/PostgreSQL.php | 224 +- Sources/Maintenance/DatabaseInterface.php | 138 +- .../Maintenance/Schema/admin_info_files.php | 77 - Sources/Maintenance/SchemaBase.php | 119 - Sources/Maintenance/SchemaColumn.php | 83 - Sources/Maintenance/SchemaIndex.php | 56 - Sources/Maintenance/SchemaIndexColumn.php | 40 - Sources/Maintenance/SchemaInterface.php | 35 - Sources/Maintenance/Step.php | 70 +- Sources/Maintenance/Template.php | 115 +- Sources/Maintenance/Template/Install.php | 330 ++- Sources/Maintenance/TemplateInterface.php | 8 +- Sources/Maintenance/Tools/Install.php | 2621 +++++++++-------- Sources/Maintenance/ToolsBase.php | 151 +- Sources/Maintenance/ToolsInterface.php | 22 +- 29 files changed, 2300 insertions(+), 2452 deletions(-) delete mode 100644 Sources/Maintenance/Schema/admin_info_files.php delete mode 100644 Sources/Maintenance/SchemaBase.php delete mode 100644 Sources/Maintenance/SchemaColumn.php delete mode 100644 Sources/Maintenance/SchemaIndex.php delete mode 100644 Sources/Maintenance/SchemaIndexColumn.php delete mode 100644 Sources/Maintenance/SchemaInterface.php diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index cf0b21f782..c2ebed8fca 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -19,7 +19,8 @@ jobs: - name: Get extra arguments for PHP-CS-Fixer id: phpcs-intersection run: | - CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | tr ' ' '\n') + CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | grep '.php$' | tr ' ' '\n') + CHANGED_FILES=$(echo -e "${CHANGED_FILES}" | while IFS= read -r file; do echo "$file" | test -f "$file" && echo "$file"; done) if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi echo "PHPCS_EXTRA_ARGS<> $GITHUB_ENV echo "$EXTRA_ARGS" >> $GITHUB_ENV diff --git a/Sources/Db/DatabaseApi.php b/Sources/Db/DatabaseApi.php index da554247aa..ef5eed206f 100644 --- a/Sources/Db/DatabaseApi.php +++ b/Sources/Db/DatabaseApi.php @@ -440,6 +440,7 @@ protected function prefixReservedTables(): void { if (defined('SMF_INSTALLING')) { $this->reservedTables = []; + return; } diff --git a/Sources/Db/Schema/v3_0/AdminInfoFiles.php b/Sources/Db/Schema/v3_0/AdminInfoFiles.php index bfdf868969..1711772ff1 100644 --- a/Sources/Db/Schema/v3_0/AdminInfoFiles.php +++ b/Sources/Db/Schema/v3_0/AdminInfoFiles.php @@ -39,7 +39,7 @@ class AdminInfoFiles extends Table 'path' => 'string', 'parameters' => 'string', 'data' => 'string', - 'filetype' => 'string' + 'filetype' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/Categories.php b/Sources/Db/Schema/v3_0/Categories.php index ceae6ab93f..593a16c3c9 100644 --- a/Sources/Db/Schema/v3_0/Categories.php +++ b/Sources/Db/Schema/v3_0/Categories.php @@ -38,7 +38,7 @@ class Categories extends Table 'cat_order' => 'int', 'name' => 'string', 'description' => 'string', - 'can_collapse' => 'int' + 'can_collapse' => 'int', ]; /** diff --git a/Sources/Db/Schema/v3_0/LogFloodcontrol.php b/Sources/Db/Schema/v3_0/LogFloodcontrol.php index 75d31b864f..380e47966a 100644 --- a/Sources/Db/Schema/v3_0/LogFloodcontrol.php +++ b/Sources/Db/Schema/v3_0/LogFloodcontrol.php @@ -81,7 +81,7 @@ public function __construct() 'ip', 'log_type', ], - ) + ), ]; } } diff --git a/Sources/Db/Schema/v3_0/MessageIcons.php b/Sources/Db/Schema/v3_0/MessageIcons.php index c4c74bd4b5..0c5b522db5 100644 --- a/Sources/Db/Schema/v3_0/MessageIcons.php +++ b/Sources/Db/Schema/v3_0/MessageIcons.php @@ -36,7 +36,7 @@ class MessageIcons extends Table public array $initial_columns = [ 'filename' => 'string', 'title' => 'string', - 'icon_order' => 'int' + 'icon_order' => 'int', ]; /** diff --git a/Sources/Db/Schema/v3_0/PermissionProfiles.php b/Sources/Db/Schema/v3_0/PermissionProfiles.php index d8a759c625..5ced71af98 100644 --- a/Sources/Db/Schema/v3_0/PermissionProfiles.php +++ b/Sources/Db/Schema/v3_0/PermissionProfiles.php @@ -35,7 +35,7 @@ class PermissionProfiles extends Table */ public array $initial_columns = [ 'id_profile' => 'int', - 'profile_name' => 'string' + 'profile_name' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/Permissions.php b/Sources/Db/Schema/v3_0/Permissions.php index 8243d044ed..b58d631086 100644 --- a/Sources/Db/Schema/v3_0/Permissions.php +++ b/Sources/Db/Schema/v3_0/Permissions.php @@ -35,7 +35,7 @@ class Permissions extends Table */ public array $initial_columns = [ 'id_group' => 'int', - 'permission' => 'string' + 'permission' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/ScheduledTasks.php b/Sources/Db/Schema/v3_0/ScheduledTasks.php index a4814037a4..ac00fc63e7 100644 --- a/Sources/Db/Schema/v3_0/ScheduledTasks.php +++ b/Sources/Db/Schema/v3_0/ScheduledTasks.php @@ -41,7 +41,7 @@ class ScheduledTasks extends Table 'time_unit' => 'string', 'disabled' => 'int', 'task' => 'string', - 'callable' => 'string' + 'callable' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/Settings.php b/Sources/Db/Schema/v3_0/Settings.php index 7114c41acd..27d32fcdd6 100644 --- a/Sources/Db/Schema/v3_0/Settings.php +++ b/Sources/Db/Schema/v3_0/Settings.php @@ -35,7 +35,7 @@ class Settings extends Table */ public array $initial_columns = [ 'variable' => 'string', - 'value' => 'string' + 'value' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/Themes.php b/Sources/Db/Schema/v3_0/Themes.php index b1e76bae7e..945f7d42b3 100644 --- a/Sources/Db/Schema/v3_0/Themes.php +++ b/Sources/Db/Schema/v3_0/Themes.php @@ -36,7 +36,7 @@ class Themes extends Table public array $initial_columns = [ 'id_theme' => 'int', 'variable' => 'string', - 'value' => 'string' + 'value' => 'string', ]; /** diff --git a/Sources/Db/Schema/v3_0/UserAlertsPrefs.php b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php index d316cc6fd3..0f65b14b83 100644 --- a/Sources/Db/Schema/v3_0/UserAlertsPrefs.php +++ b/Sources/Db/Schema/v3_0/UserAlertsPrefs.php @@ -36,7 +36,7 @@ class UserAlertsPrefs extends Table public array $initial_columns = [ 'id_member' => 'int', 'alert_pref' => 'string', - 'alert_value' => 'int' + 'alert_value' => 'int', ]; /** diff --git a/Sources/Maintenance.php b/Sources/Maintenance.php index 0dc0a9ac27..d3b1eb710c 100644 --- a/Sources/Maintenance.php +++ b/Sources/Maintenance.php @@ -15,214 +15,220 @@ namespace SMF; -use SMF\Db\DatabaseApi as Db; -use SMF\Maintenance\Tools; -use SMF\Maintenance\ToolsInterface; use SMF\Maintenance\Template; -use SMF\Maintenance\ToolsBase; use SMF\Maintenance\TemplateInterface; +use SMF\Maintenance\ToolsInterface; class Maintenance { - public const INSTALL = 1; - - public const UPGRADE = 2; - - public const CONVERT = 3; - - public const TOOL = 4; - - public const SPECIAL = 99; - - public static array $context = []; - - public static array $languages = []; - public static array $warnings = []; - public static array $errors = []; - public static string $fatal_error = ''; - - - /** @var \SMF\Maintenance\ToolsInterface&\SMF\Maintenance\ToolsBase $tool */ - public static ToolsInterface $tool; - - /** @var \SMF\Maintenance\TemplateInterface $template */ - public static TemplateInterface $template; - public static string $sub_template = ''; - - private static array $valid_tools = [ - self::INSTALL => 'Install', - self::UPGRADE => 'Upgrade', - self::CONVERT => 'Convert', - self::TOOL => 'Tool', - self::SPECIAL => 'Special' - ]; - - public static int $overall_percent = 0; - - public function __construct() - { - Security::frameOptionsHeader('SAMEORIGIN'); - } - - public function execute(int $type): void - { - if (!self::toolIsValid($type)) { - die('Invalid Tool selected'); - } - - /** @var \SMF\Maintenance\ToolsInterface&\SMF\Maintenance\ToolsBase $tool_class */ - $tool_class = '\\SMF\\Maintenance\\Tools\\' . self::$valid_tools[$type]; - require_once Config::$sourcedir . '/Maintenance/Tools/' . self::$valid_tools[$type] . '.php'; - self::$tool = new $tool_class(); - - - /** @var \SMF\Maintenance\TemplateInterface $templ_class */ - $templ_class = '\\SMF\\Maintenance\\Template\\' . self::$valid_tools[$type]; - require_once Config::$sourcedir . '/Maintenance/Template/' . self::$valid_tools[$type] . '.php'; - self::$template = new $templ_class(); - - // This is really quite simple; if ?delete is on the URL, delete the installer... - if (isset($_GET['delete'])) { - self::$tool->deleteTool(); - exit; - } - - /** @var \SMF\Maintenance\Step $step */ - foreach (self::$tool->getSteps() as $num => $step) { - if ($num >= self::getCurrentStep()) { - // The current weight of this step in terms of overall progress. - self::$context['step_weight'] = $step->getProgress(); - - // Make sure we reset the skip button. - self::$context['skip'] = false; - - // Call the step and if it returns false that means pause! - if (method_exists(self::$tool, $step->getFunction()) && self::$tool->{$step->getFunction()}() === false) { - break; - } - - if (method_exists(self::$tool, $step->getFunction())) { - self::setCurrentStep(); - } - - // No warnings pass on. - self::$context['warning'] = ''; - } - self::$overall_percent += (int) $step->getProgress(); - } - - // Last chance to set our template. - if (self::$sub_template === '') { - self::$sub_template = self::$tool->getSteps()[self::getCurrentStep()]->getFunction(); - } - - self::exit(); - } - - public static function getRequiredVersionForPHP(): string - { - return '8.0.1'; - } + public const INSTALL = 1; + + public const UPGRADE = 2; + + public const CONVERT = 3; + + public const TOOL = 4; + + public const SPECIAL = 99; + + public static array $context = []; + + public static array $languages = []; + public static array $warnings = []; + public static array $errors = []; + public static string $fatal_error = ''; + + + /** + * @var \SMF\Maintenance\ToolsInterface&\SMF\Maintenance\ToolsBase + */ + public static ToolsInterface $tool; + + /** + * @var \SMF\Maintenance\TemplateInterface + */ + public static TemplateInterface $template; + public static string $sub_template = ''; + + private static array $valid_tools = [ + self::INSTALL => 'Install', + self::UPGRADE => 'Upgrade', + self::CONVERT => 'Convert', + self::TOOL => 'Tool', + self::SPECIAL => 'Special', + ]; + + public static int $overall_percent = 0; + + public function __construct() + { + Security::frameOptionsHeader('SAMEORIGIN'); + } + + public function execute(int $type): void + { + if (!self::toolIsValid($type)) { + die('Invalid Tool selected'); + } + + /** @var \SMF\Maintenance\ToolsInterface&\SMF\Maintenance\ToolsBase $tool_class */ + $tool_class = '\\SMF\\Maintenance\\Tools\\' . self::$valid_tools[$type]; + + require_once Config::$sourcedir . '/Maintenance/Tools/' . self::$valid_tools[$type] . '.php'; + self::$tool = new $tool_class(); + + + /** @var \SMF\Maintenance\TemplateInterface $templ_class */ + $templ_class = '\\SMF\\Maintenance\\Template\\' . self::$valid_tools[$type]; + + require_once Config::$sourcedir . '/Maintenance/Template/' . self::$valid_tools[$type] . '.php'; + self::$template = new $templ_class(); + + // This is really quite simple; if ?delete is on the URL, delete the installer... + if (isset($_GET['delete'])) { + self::$tool->deleteTool(); + + exit; + } + + /** @var \SMF\Maintenance\Step $step */ + foreach (self::$tool->getSteps() as $num => $step) { + if ($num >= self::getCurrentStep()) { + // The current weight of this step in terms of overall progress. + self::$context['step_weight'] = $step->getProgress(); + + // Make sure we reset the skip button. + self::$context['skip'] = false; + + // Call the step and if it returns false that means pause! + if (method_exists(self::$tool, $step->getFunction()) && self::$tool->{$step->getFunction()}() === false) { + break; + } + + if (method_exists(self::$tool, $step->getFunction())) { + self::setCurrentStep(); + } + + // No warnings pass on. + self::$context['warning'] = ''; + } + self::$overall_percent += (int) $step->getProgress(); + } + + // Last chance to set our template. + if (self::$sub_template === '') { + self::$sub_template = self::$tool->getSteps()[self::getCurrentStep()]->getFunction(); + } + + self::exit(); + } + + public static function getRequiredVersionForPHP(): string + { + return '8.0.1'; + } // See if we think they have already installed it? - public static function isInstalled(): bool - { - if (Config::$image_proxy_secret === 'smfisawesome' && Config::$db_passwd === '' && Config::$boardurl === 'http://127.0.0.1/smf') { - return false; - } - return true; - } - - - public static function getSelf(): string - { - return $_SERVER['PHP_SELF']; - } - - public static function getBaseDir(): string - { - return dirname(SMF_SETTINGS_FILE); - } - - public static function getCurrentStep(): int - { - return isset($_GET['step']) ? (int) $_GET['step'] : 0; - } - - public static function getCurrentSubStep(): int - { - return isset($_GET['substep']) ? (int) $_GET['substep'] : 0; - } - - public static function setCurrentSubStep(?int $substep = null): void - { - $_GET['substep'] = $substep ?? (self::getCurrentSubStep() + 1); - } - - public static function getCurrentStart(): int - { - return isset($_GET['start']) ? (int) $_GET['start'] : 0; - } - - public static function setCurrentStart(?int $start = null): void - { - $_GET['start'] = $start ?? (self::getCurrentStart() + 1); - } - - public static function getRequestedLanguage(): string - { - if (isset($_GET['lang_file'])) { - $_SESSION['lang_file'] = strtr((string) $_GET['lang_file'], './\\:', '____'); - return $_SESSION['lang_file']; - } else if (isset($_SESSION['lang_file'])) { - return $_SESSION['lang_file']; - } else { - return 'en_US'; - } - - } - - public static function setSubTemplate(string $tmpl): void - { - if (method_exists(self::$template, $tmpl)) { - self::$sub_template = $tmpl; - } - } - private static function toolIsValid(int $type): bool - { - return isset(self::$valid_tools[$type]); - } - - private static function setCurrentStep(?int $step = null): void - { - $_GET['step'] = $step ?? (self::getCurrentStep() + 1); - } - - private static function exit(bool $fallThrough = false): void - { - // Send character set. - header('content-type: text/html; charset=' . (Lang::$txt['lang_character_set'] ?? 'UTF-8')); - - // We usually dump our templates out. - if (!$fallThrough) { - // The top bit. - Template::header(); - call_user_func([self::$template, 'upper']); - - // Call the template. - if (self::$sub_template !== '') { - self::$context['form_url'] = self::getSelf() . '?step=' . self::getCurrentStep(); - - call_user_func([self::$template, self::$sub_template]); - } - - // Show the footer. - call_user_func([self::$template, 'lower']); - Template::footer(); - } - - // Bang - gone! - die(); - } + public static function isInstalled(): bool + { + return ! (Config::$image_proxy_secret === 'smfisawesome' && Config::$db_passwd === '' && Config::$boardurl === 'http://127.0.0.1/smf'); + } + + + public static function getSelf(): string + { + return $_SERVER['PHP_SELF']; + } + + public static function getBaseDir(): string + { + return dirname(SMF_SETTINGS_FILE); + } + + public static function getCurrentStep(): int + { + return isset($_GET['step']) ? (int) $_GET['step'] : 0; + } + + public static function getCurrentSubStep(): int + { + return isset($_GET['substep']) ? (int) $_GET['substep'] : 0; + } + + public static function setCurrentSubStep(?int $substep = null): void + { + $_GET['substep'] = $substep ?? (self::getCurrentSubStep() + 1); + } + + public static function getCurrentStart(): int + { + return isset($_GET['start']) ? (int) $_GET['start'] : 0; + } + + public static function setCurrentStart(?int $start = null): void + { + $_GET['start'] = $start ?? (self::getCurrentStart() + 1); + } + + public static function getRequestedLanguage(): string + { + if (isset($_GET['lang_file'])) { + $_SESSION['lang_file'] = strtr((string) $_GET['lang_file'], './\\:', '____'); + + return $_SESSION['lang_file']; + } + + if (isset($_SESSION['lang_file'])) { + return $_SESSION['lang_file']; + } + + return 'en_US'; + + + } + + public static function setSubTemplate(string $tmpl): void + { + if (method_exists(self::$template, $tmpl)) { + self::$sub_template = $tmpl; + } + } + private static function toolIsValid(int $type): bool + { + return isset(self::$valid_tools[$type]); + } + + private static function setCurrentStep(?int $step = null): void + { + $_GET['step'] = $step ?? (self::getCurrentStep() + 1); + } + + private static function exit(bool $fallThrough = false): void + { + // Send character set. + header('content-type: text/html; charset=' . (Lang::$txt['lang_character_set'] ?? 'UTF-8')); + + // We usually dump our templates out. + if (!$fallThrough) { + // The top bit. + Template::header(); + call_user_func([self::$template, 'upper']); + + // Call the template. + if (self::$sub_template !== '') { + self::$context['form_url'] = self::getSelf() . '?step=' . self::getCurrentStep(); + + call_user_func([self::$template, self::$sub_template]); + } + + // Show the footer. + call_user_func([self::$template, 'lower']); + Template::footer(); + } + + // Bang - gone! + die(); + } } +?> \ No newline at end of file diff --git a/Sources/Maintenance/Database/MySQL.php b/Sources/Maintenance/Database/MySQL.php index 17bed88f8e..a6534644b0 100644 --- a/Sources/Maintenance/Database/MySQL.php +++ b/Sources/Maintenance/Database/MySQL.php @@ -15,100 +15,143 @@ namespace SMF\Maintenance\Database; -use SMF\Maintenance\DatabaseInterface; use SMF\Db\DatabaseApi as Db; +use SMF\Maintenance\DatabaseInterface; +/** + * Database Maintenance for MySQL and variants. + */ class MySQL implements DatabaseInterface { - public function getTitle(): string - { - return MYSQL_TITLE; - } - - public function getMinimumVersion(): string - { - return '8.0.35'; - } - - public function getServerVersion(): bool|string - { - if (!function_exists('mysqli_fetch_row')) { - return false; - } - - return mysqli_fetch_row(mysqli_query(Db::$db->connection, 'SELECT VERSION();'))[0]; - } - - public function isSupported(): bool - { - return function_exists('mysqli_connect'); - } - - public function SkipSelectDatabase(): bool - { - return false; - } - - public function getDefaultUser(): string - { - return ini_get('mysql.default_user') === false ? '' : ini_get('mysql.default_user'); - } - - public function getDefaultPassword(): string - { - return ini_get('mysql.default_password') === false ? '' : ini_get('mysql.default_password'); - } - - public function getDefaultHost(): string - { - return ini_get('mysql.default_host') === false ? '' : ini_get('mysql.default_host'); - } - - public function getDefaultPort(): int - { - return ini_get('mysql.default_port') === false ? 3306 : (int) ini_get('mysql.default_port'); - } - - public function getDefaultName(): string - { - return 'smf_'; - } - - public function checkConfiguration(): bool - { - return true; - } - - public function hasPermissions(): bool - { - // Find database user privileges. - $privs = []; - $get_privs = Db::$db->query('', 'SHOW PRIVILEGES', []); - - while ($row = Db::$db->fetch_assoc($get_privs)) { - if ($row['Privilege'] == 'Alter') { - $privs[] = $row['Privilege']; - } - } - Db::$db->free_result($get_privs); - - // Check for the ALTER privilege. - if (!in_array('Alter', $privs)) { - return false; - } - - return true; - } - - public function validatePrefix(&$value): bool - { - $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); - - return true; - } - - public function utf8Configured(): bool - { - return true; - } -} \ No newline at end of file + /** + * {@inheritDoc} + */ + public function getTitle(): string + { + return MYSQL_TITLE; + } + + /** + * {@inheritDoc} + */ + public function getMinimumVersion(): string + { + return '8.0.35'; + } + + /** + * {@inheritDoc} + */ + public function getServerVersion(): bool|string + { + if (!function_exists('mysqli_fetch_row')) { + return false; + } + + return mysqli_fetch_row(mysqli_query(Db::$db->connection, 'SELECT VERSION();'))[0]; + } + + /** + * {@inheritDoc} + */ + public function isSupported(): bool + { + return function_exists('mysqli_connect'); + } + + /** + * {@inheritDoc} + */ + public function SkipSelectDatabase(): bool + { + return false; + } + + /** + * {@inheritDoc} + */ + public function getDefaultUser(): string + { + return ini_get('mysql.default_user') === false ? '' : ini_get('mysql.default_user'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultPassword(): string + { + return ini_get('mysql.default_password') === false ? '' : ini_get('mysql.default_password'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultHost(): string + { + return ini_get('mysql.default_host') === false ? '' : ini_get('mysql.default_host'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultPort(): int + { + return ini_get('mysql.default_port') === false ? 3306 : (int) ini_get('mysql.default_port'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultName(): string + { + return 'smf_'; + } + + /** + * {@inheritDoc} + */ + public function checkConfiguration(): bool + { + return true; + } + + /** + * {@inheritDoc} + */ + public function hasPermissions(): bool + { + // Find database user privileges. + $privs = []; + $get_privs = Db::$db->query('', 'SHOW PRIVILEGES', []); + + while ($row = Db::$db->fetch_assoc($get_privs)) { + if ($row['Privilege'] == 'Alter') { + $privs[] = $row['Privilege']; + } + } + Db::$db->free_result($get_privs); + + // Check for the ALTER privilege. + return ! (!in_array('Alter', $privs)); + } + + /** + * {@inheritDoc} + */ + public function validatePrefix(&$value): bool + { + $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); + + return true; + } + + /** + * {@inheritDoc} + */ + public function utf8Configured(): bool + { + return true; + } +} + +?> \ No newline at end of file diff --git a/Sources/Maintenance/Database/PostgreSQL.php b/Sources/Maintenance/Database/PostgreSQL.php index f6c9c75ea8..ba632e28fa 100644 --- a/Sources/Maintenance/Database/PostgreSQL.php +++ b/Sources/Maintenance/Database/PostgreSQL.php @@ -15,68 +15,101 @@ namespace SMF\Maintenance\Database; +use SMF\Db\DatabaseApi as Db; use SMF\Lang; use SMF\Maintenance\DatabaseInterface; -use SMF\Db\DatabaseApi as Db; +/** + * Database Maintenance for PostgreSQL. + */ class PostgreSQL implements DatabaseInterface { - public function getTitle(): string - { - return POSTGRE_TITLE; - } - - public function getMinimumVersion(): string - { - return '12.17'; - } - - public function getServerVersion(): bool|string - { - $request = pg_query(Db::$db->connection, 'SELECT version()'); - list($version) = pg_fetch_row($request); - list($pgl, $version) = explode(' ', $version); - - return $version; - } - - public function isSupported(): bool - { - return function_exists('pg_connect'); - } - - public function SkipSelectDatabase(): bool - { - return true; - } - - public function getDefaultUser(): string - { - return ''; - } - - public function getDefaultPassword(): string - { - return ''; - } - - public function getDefaultHost(): string - { - return ''; - } - - public function getDefaultPort(): int - { - return 5432; - } - - public function getDefaultName(): string - { - return 'smf_'; - } - - public function checkConfiguration(): bool - { + /** + * {@inheritDoc} + */ + public function getTitle(): string + { + return POSTGRE_TITLE; + } + + /** + * {@inheritDoc} + */ + public function getMinimumVersion(): string + { + return '12.17'; + } + + /** + * {@inheritDoc} + */ + public function getServerVersion(): bool|string + { + $request = pg_query(Db::$db->connection, 'SELECT version()'); + list($version) = pg_fetch_row($request); + list($pgl, $version) = explode(' ', $version); + + return $version; + } + + /** + * {@inheritDoc} + */ + public function isSupported(): bool + { + return function_exists('pg_connect'); + } + + /** + * {@inheritDoc} + */ + public function SkipSelectDatabase(): bool + { + return true; + } + + /** + * {@inheritDoc} + */ + public function getDefaultUser(): string + { + return ''; + } + + /** + * {@inheritDoc} + */ + public function getDefaultPassword(): string + { + return ''; + } + + /** + * {@inheritDoc} + */ + public function getDefaultHost(): string + { + return ''; + } + + /** + * {@inheritDoc} + */ + public function getDefaultPort(): int + { + return 5432; + } + + /** + * {@inheritDoc} + */ + public function getDefaultName(): string + { + return 'smf_'; + } + + public function checkConfiguration(): bool + { $result = Db::$db->query( '', 'show standard_conforming_strings', @@ -89,48 +122,59 @@ public function checkConfiguration(): bool $row = Db::$db->fetch_assoc($result); if ($row['standard_conforming_strings'] !== 'on') { - throw new \Exception(Lang::$txt['error_pg_scs']); - } + throw new \Exception(Lang::$txt['error_pg_scs']); + } Db::$db->free_result($result); } - return true; - } + return true; + } + + /** + * {@inheritDoc} + */ + public function hasPermissions(): bool + { + return true; + } - public function hasPermissions(): bool - { - return true; - } + /** + * {@inheritDoc} + */ + public function validatePrefix(&$value): bool + { + $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); - public function validatePrefix(&$value): bool - { - $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); + // Is it reserved? + if ($value == 'pg_') { + throw new \Exception(Lang::$txt['error_db_prefix_reserved']); + } + + // Is the prefix numeric? + if (preg_match('~^\d~', $value)) { + throw new \Exception(Lang::$txt['error_db_prefix_numeric']); + } - // Is it reserved? - if ($value == 'pg_') { - throw new \Exception(Lang::$txt['error_db_prefix_reserved']); - } - - // Is the prefix numeric? - if (preg_match('~^\d~', $value)) { - throw new \Exception(Lang::$txt['error_db_prefix_numeric']); - } - - return true; - } + return true; + } - public function utf8Configured(): bool - { - $request = pg_query(Db::$db->connection, 'SHOW SERVER_ENCODING'); + /** + * {@inheritDoc} + */ + public function utf8Configured(): bool + { + $request = pg_query(Db::$db->connection, 'SHOW SERVER_ENCODING'); - list($charcode) = pg_fetch_row($request); + list($charcode) = pg_fetch_row($request); + + if ($charcode == 'UTF8') { + return true; + } - if ($charcode == 'UTF8') { - return true; - } + throw new \Exception(sprintf(Lang::$txt['error_utf8_version'], $this->getMinimumVersion())); + } - throw new \Exception(sprintf(Lang::$txt['error_utf8_version'], $this->getMinimumVersion())); - } +} -} \ No newline at end of file +?> \ No newline at end of file diff --git a/Sources/Maintenance/DatabaseInterface.php b/Sources/Maintenance/DatabaseInterface.php index 0e582e1de0..669727e7b9 100644 --- a/Sources/Maintenance/DatabaseInterface.php +++ b/Sources/Maintenance/DatabaseInterface.php @@ -14,35 +14,115 @@ declare(strict_types=1); namespace SMF\Maintenance; -use SMF\Db\DatabaseApi as Db; +/** + * Database Maintenance interface. Additional database logic is performed and set here. + */ interface DatabaseInterface { - public function getTitle(): string; - - public function getMinimumVersion(): string; - - public function getServerVersion(): bool|string; - - public function isSupported(): bool; - - public function SkipSelectDatabase(): bool; - - public function getDefaultUser(): string; - - public function getDefaultPassword(): string; - - public function getDefaultHost(): string; - - public function getDefaultPort(): int; - - public function getDefaultName(): string; - - public function checkConfiguration(): bool; - - public function hasPermissions(): bool; - - public function validatePrefix(&$string): bool; - - public function utf8Configured(): bool; -} \ No newline at end of file + /*********************** + * Public methods + ***********************/ + + /** + * Fetch the database title. + * @return string + */ + public function getTitle(): string; + + /** + * The minimum version that SMF supports for the database. + * @return string + */ + public function getMinimumVersion(): string; + + /** + * Get the server version from the server, we must have Config:$db_* defined. + * + * @return string + * When false, the server connection failed or an error occurred. + * Otehrwise a string is returned containing the server version. + */ + public function getServerVersion(): bool|string; + + /** + * Is this database supported. + * + * @return bool True if we can use this database, false otherwse. + */ + public function isSupported(): bool; + + /** + * Skip issuing a select database command. + * + * @return bool When true, we do not select a database. + */ + public function SkipSelectDatabase(): bool; + + /** + * Default username for a database connection. + * + * @return string + */ + public function getDefaultUser(): string; + + /** + * Default password for a database connection. + * + * @return string + */ + public function getDefaultPassword(): string; + + /** + * Default host for a database connection. + * + * @return string + */ + public function getDefaultHost(): string; + + /** + * Default port for a database connection. + * + * @return int + */ + public function getDefaultPort(): int; + + /** + * Default database name for a database connection. + * + * @return string + */ + public function getDefaultName(): string; + + /** + * Performs checks to ensure the server is in a sane configuration. + * + * @return bool + */ + public function checkConfiguration(): bool; + + /** + * Performs checks to ensure we have proper permissions to the database in order to perform operations. + * + * @return bool + */ + public function hasPermissions(): bool; + + /** + * Validate a database prefix. + * When an error occurs, use throw new exception, this will be captured. + * + * @return bool + */ + public function validatePrefix(&$string): bool; + + /** + * Checks that the server has the proper support for UTF-8 content.. + * When an error occurs, use throw new exception, this will be captured. + * + * @return bool + */ + public function utf8Configured(): bool; +} + +?> \ No newline at end of file diff --git a/Sources/Maintenance/Schema/admin_info_files.php b/Sources/Maintenance/Schema/admin_info_files.php deleted file mode 100644 index 97f07238a3..0000000000 --- a/Sources/Maintenance/Schema/admin_info_files.php +++ /dev/null @@ -1,77 +0,0 @@ -name = 'admin_info_files'; - $this->columns = [ - new SchemaColumn( - name: 'id_file', - type: SchemaColumn::TYPE_TINYINT, - unsigned: true, - auto: true - ), - new SchemaColumn( - name: 'filename', - type: SchemaColumn::TYPE_VARCHAR, - size: 255, - null: false, - default: '' - ), - new SchemaColumn( - name: 'path', - type: SchemaColumn::TYPE_VARCHAR, - size: 255, - null: false, - default: '' - ), - new SchemaColumn( - name: 'parameters', - type: SchemaColumn::TYPE_VARCHAR, - size: 255, - null: false, - default: '' - ), - new SchemaColumn( - name: 'data', - type: SchemaColumn::TYPE_TEXT, - null: false, - ), - new SchemaColumn( - name: 'filetype', - type: SchemaColumn::TYPE_VARCHAR, - size: 255, - null: false, - default: '' - ), - ]; - - $this->indexes = [ - new SchemaIndex( - name: 'PRIMARY', - type: SchemaIndex::TYPE_PRIMARY, - columns: [ - new SchemaIndexColumn('id_file') - ] - ) - ]; - } -} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaBase.php b/Sources/Maintenance/SchemaBase.php deleted file mode 100644 index a2649a0fe6..0000000000 --- a/Sources/Maintenance/SchemaBase.php +++ /dev/null @@ -1,119 +0,0 @@ -name = $name; - $this->columns = $columns; - $this->indexes = $indexes; - } - - public function getName(): string - { - return $this->name; - } - - /** - * - * @return \SMF\Maintenance\SchemaColumn[] - */ - public function getColumns(): array - { - return $this->columns; - } - - /** - * - * @return \SMF\Maintenance\SchemaIndex[] - */ - public function getIndexes(): array - { - return $this->indexes; - } - - public function getDefaultData(): array - { - return []; - } - - final public function getColumnsForCreateTable(): array - { - $columns = []; - - foreach ($this->columns as $col) { - $rt = [ - 'name' => $col->getName(), - 'type' => $col->getType(), - - 'auto' => $col->getAutoIncrement(), - 'null' => $col->getNullable(), - 'unsigned' => $col->getUnsigned(), - ]; - - if ($col->getDefault() !== false) { - $rt['default'] = $col->getDefault(); - } - if ($col->getSize() !== null) { - $rt['size'] = $col->getSize(); - } - - $columns[] = $rt; - } - - return $columns; - } - - final public function getIndexesForCreateTable(): array - { - $indexes = []; - - foreach ($this->indexes as $col) { - $rt = [ - 'name' => $col->getName(), - 'type' => $col->getType(), - 'columns' => [], - ]; - - foreach ($col->getColumns() as $col) { - if ($col->getSize() !== null) { - $rt['columns'][] = [ - 'name' => $col->getName(), - 'size' => $col->getSize() - ]; - } else { - $rt['columns'][] = [ - 'name' => $col->getName(), - ]; - } - } - - $indexes[] = $rt; - } - - return $indexes; - } -} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaColumn.php b/Sources/Maintenance/SchemaColumn.php deleted file mode 100644 index 73923144cd..0000000000 --- a/Sources/Maintenance/SchemaColumn.php +++ /dev/null @@ -1,83 +0,0 @@ -name = $name; - $this->type = $type; - $this->size = $size; - $this->unsigned = $unsigned; - $this->null = $null; - $this->default = $default; - $this->auto = $auto; - } - - public function getName(): string - { - return $this->name; - } - public function getType(): ?string - { - return $this->type; - } - public function getSize(): ?int - { - return $this->size; - } - public function getUnsigned(): bool - { - return $this->unsigned; - } - public function getNullable(): bool - { - return $this->null; - } - public function getAutoIncrement(): bool - { - return $this->auto; - } - public function getDefault(): string|int|float|null|false - { - return $this->default; - } -} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaIndex.php b/Sources/Maintenance/SchemaIndex.php deleted file mode 100644 index 1e1c68ff7e..0000000000 --- a/Sources/Maintenance/SchemaIndex.php +++ /dev/null @@ -1,56 +0,0 @@ -name = $name; - $this->type = $type; - $this->columns = $columns; - } - - public function getName(): string - { - return $this->name; - } - public function getType(): string - { - return $this->type; - } - /** - * - * @return \SMF\Maintenance\SchemaIndexColumn[] - */ - public function getColumns(): array - { - return $this->columns; - } -} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaIndexColumn.php b/Sources/Maintenance/SchemaIndexColumn.php deleted file mode 100644 index 98d75ccdf7..0000000000 --- a/Sources/Maintenance/SchemaIndexColumn.php +++ /dev/null @@ -1,40 +0,0 @@ -name = $name; - $this->size = $size; - } - - public function getName(): string - { - return $this->name; - } - public function getSize(): ?int - { - return $this->size; - } -} \ No newline at end of file diff --git a/Sources/Maintenance/SchemaInterface.php b/Sources/Maintenance/SchemaInterface.php deleted file mode 100644 index eadc113fa8..0000000000 --- a/Sources/Maintenance/SchemaInterface.php +++ /dev/null @@ -1,35 +0,0 @@ -id = $id; - $this->name = $name; - $this->title = $title; - $this->function = $function; - $this->progress = $progres; - } + public function __construct(int $id, string $name, string $function, int $progres, ?string $title = null) + { + $this->id = $id; + $this->name = $name; + $this->title = $title; + $this->function = $function; + $this->progress = $progres; + } - public function getID(): int - { - return $this->id; - } - public function getName(): string - { - return $this->name; - } - public function getTitle(): ?string - { - return $this->title; - } - public function getFunction(): string - { - return $this->function; - } - public function getProgress(): int - { - return $this->progress; - } -} \ No newline at end of file + public function getID(): int + { + return $this->id; + } + public function getName(): string + { + return $this->name; + } + public function getTitle(): ?string + { + return $this->title; + } + public function getFunction(): string + { + return $this->function; + } + public function getProgress(): int + { + return $this->progress; + } +} + +?> \ No newline at end of file diff --git a/Sources/Maintenance/Template.php b/Sources/Maintenance/Template.php index 3dc98f9c09..5f73e9abe2 100644 --- a/Sources/Maintenance/Template.php +++ b/Sources/Maintenance/Template.php @@ -1,14 +1,26 @@ + public static function header(): void + { + echo ' @@ -27,10 +39,10 @@ public static function header(): void
'; - - // Have we got a language drop down - if so do it on the first step only. - if (!empty(Maintenance::$languages) && count(Maintenance::$languages) > 1 && Maintenance::getCurrentStep() == 0) { - echo ' + + // Have we got a language drop down - if so do it on the first step only. + if (!empty(Maintenance::$languages) && count(Maintenance::$languages) > 1 && Maintenance::getCurrentStep() == 0) { + echo '
@@ -38,13 +50,13 @@ public static function header(): void @@ -53,23 +65,23 @@ public static function header(): void
'; - } - - echo ' + } + + echo '

', Lang::$txt['upgrade_progress'], '

    '; - if (Maintenance::$tool->hasSteps()) { - foreach (Maintenance::$tool->getSteps() as $num => $step) { - echo ' + if (Maintenance::$tool->hasSteps()) { + foreach (Maintenance::$tool->getSteps() as $num => $step) { + echo ' ', Lang::$txt['upgrade_step'], ' ', $step->getID(), ': ', $step->getName(), ''; - } - } - - echo ' + } + } + + echo '
@@ -82,12 +94,12 @@ public static function header(): void

', Maintenance::$tool->getStepTitle(), '

'; - - } - public static function footer(): void - { - echo ' + } + + public static function footer(): void + { + echo '
@@ -101,40 +113,39 @@ public static function footer(): void
'; - - } - - public static function warningsAndErrors(): void - { - // Errors are very serious.. - if (!empty(Maintenance::$fatal_error)) { - echo ' + + } + + public static function warningsAndErrors(): void + { + // Errors are very serious.. + if (!empty(Maintenance::$fatal_error)) { + echo '

', Lang::$txt['upgrade_critical_error'], '

', Maintenance::$fatal_error, '
'; - } - else if (!empty(Maintenance::$errors)) { - echo ' + } elseif (!empty(Maintenance::$errors)) { + echo '

', Lang::$txt['upgrade_critical_error'], '

', implode(' ', Maintenance::$errors), '
'; - } - // A warning message? - elseif (!empty(Maintenance::$warnings)) { - echo ' + } + // A warning message? + elseif (!empty(Maintenance::$warnings)) { + echo '

', Lang::$txt['upgrade_warning'], '

', implode(' ', Maintenance::$warnings), '
'; - } - } + } + } - public static function missingLanguages(): void - { + public static function missingLanguages(): void + { // Let's not cache this message, eh? header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); @@ -172,5 +183,7 @@ public static function missingLanguages(): void '; die; - } -} \ No newline at end of file + } +} + +?> \ No newline at end of file diff --git a/Sources/Maintenance/Template/Install.php b/Sources/Maintenance/Template/Install.php index 60a20a2f00..624a219455 100644 --- a/Sources/Maintenance/Template/Install.php +++ b/Sources/Maintenance/Template/Install.php @@ -17,49 +17,62 @@ use SMF\Config; use SMF\Db\DatabaseApi as Db; -use SMF\Maintenance\TemplateInterface; -use SMF\Maintenance; use SMF\Lang; +use SMF\Maintenance; use SMF\Maintenance\Template; +use SMF\Maintenance\TemplateInterface; +/** + * Tempalte for Installer + */ class Install implements TemplateInterface { - public static function upper(): void - { - if (Maintenance::$sub_template) - echo ' + /** + * Upper template for installer. + */ + public static function upper(): void + { + if (Maintenance::$sub_template) { + echo '
'; - } + } + } - public static function lower(): void - { - if (!empty(Maintenance::$context['continue']) || !empty(Maintenance::$context['skip'])) { - echo ' + /** + * Lower template for installer. + */ + public static function lower(): void + { + if (!empty(Maintenance::$context['continue']) || !empty(Maintenance::$context['skip'])) { + echo '
'; - - if (!empty(Maintenance::$context['continue'])) { - echo ' + + if (!empty(Maintenance::$context['continue'])) { + echo ' '; - } - - if (!empty(Maintenance::$context['skip'])) { - echo ' + } + + if (!empty(Maintenance::$context['skip'])) { + echo ' '; - } - echo ' + } + echo '
'; - } - - // Show the closing form tag and other data only if not in the last step - if (count(Maintenance::$tool->getSteps()) - 1 !== (int) Maintenance::getCurrentStep()) { - echo ' + } + + // Show the closing form tag and other data only if not in the last step + if (count(Maintenance::$tool->getSteps()) - 1 !== (int) Maintenance::getCurrentStep()) { + echo '
'; - } - } + } + } - public static function Welcome(): void - { - echo ' + /** + * Welcome page for installer. + */ + public static function Welcome(): void + { + echo '

', sprintf(Lang::$txt['install_welcome_desc'], SMF_VERSION), '

@@ -68,13 +81,13 @@ public static function Welcome(): void ', sprintf(Lang::$txt['error_script_outdated'], '??', '' . SMF_VERSION . ''), '
'; - // Oh no! - if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { - Template::warningsAndErrors(); - } + // Oh no! + if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { + Template::warningsAndErrors(); + } - // For the latest version stuff. - echo ' + // For the latest version stuff. + echo ' '; - } + } - public static function CheckFilesWritable(): void - { - echo ' + /** + * Check Files Writable page for installer. + */ + public static function CheckFilesWritable(): void + { + echo '

', Lang::$txt['ftp_setup_why_info'], '

  • ', implode('
  • ', Maintenance::$context['failed_files']), '
'; - - if (isset(Maintenance::$context['systemos'], Maintenance::$context['detected_path']) && Maintenance::$context['systemos'] == 'linux') { - echo ' + + if (isset(Maintenance::$context['systemos'], Maintenance::$context['detected_path']) && Maintenance::$context['systemos'] == 'linux') { + echo '

', Lang::$txt['chmod_linux_info'], '

# chmod a+w ', implode(' ' . Maintenance::$context['detected_path'] . '/', Maintenance::$context['failed_files']), ''; - } - - // This is serious! - if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { - Template::warningsAndErrors(); - return; - } - - echo ' + } + + // This is serious! + if (!empty(Maintenance::$fatal_error) || count(Maintenance::$errors) > 0 || count(Maintenance::$warnings) > 0) { + Template::warningsAndErrors(); + + return; + } + + echo '

', Lang::$txt['ftp_setup_info'], '

'; - - if (!empty(Maintenance::$context['ftp_errors'])) { - echo ' + + if (!empty(Maintenance::$context['ftp_errors'])) { + echo '
', Lang::$txt['error_ftp_no_connect'], '

', implode('
', Maintenance::$context['ftp_errors']), '
'; - } - - echo ' + } + + echo '
@@ -174,44 +191,47 @@ public static function CheckFilesWritable(): void
', Lang::$txt['error_message_click'], ' ', Lang::$txt['ftp_setup_again']; - } - - public static function DatabaseSettings(): void - { - echo ' + } + + /** + * Database Settings page for installer. + */ + public static function DatabaseSettings(): void + { + echo '

', Lang::$txt['db_settings_info'], '

'; - - Template::warningsAndErrors(); - - echo ' + + Template::warningsAndErrors(); + + echo '
'; - - // More than one database type? - if (count(Maintenance::$context['databases']) > 1) { - echo ' + + // More than one database type? + if (count(Maintenance::$context['databases']) > 1) { + echo '
', Lang::$txt['db_settings_type_info'], '
'; - } else { - echo ' + } else { + echo '
'; - } - - echo ' + } + + echo '
@@ -258,9 +278,9 @@ public static function DatabaseSettings(): void
', Lang::$txt['db_settings_prefix_info'], '
'; - - // Toggles a warning related to db names in PostgreSQL - echo ' + + // Toggles a warning related to db names in PostgreSQL + echo ' '; - } + '; + } - public static function ForumSettings(): void - { - echo ' + /** + * Forum Settings page for installer. + */ + public static function ForumSettings(): void + { + echo '

', Lang::$txt['install_settings_info'], '

'; - - Template::warningsAndErrors(); - - echo ' + + Template::warningsAndErrors(); + + echo '
@@ -331,57 +354,63 @@ public static function ForumSettings(): void
', Lang::$txt['force_ssl'], ':
+ Maintenance::$context['ssl_chkbx_protected'] ? ' disabled' : '', '>
', Lang::$txt['force_ssl_info'], '
'; - - } - public static function DatabasePopulation(): void - { - echo ' + } + + /** + * Database Populate page for installer. + */ + public static function DatabasePopulation(): void + { + echo '

', !empty(Maintenance::$context['was_refresh']) ? Lang::$txt['user_refresh_install_desc'] : Lang::$txt['db_populate_info'], '

'; - - if (!empty(Maintenance::$context['sql_results'])) { - echo ' + + if (!empty(Maintenance::$context['sql_results'])) { + echo '
  • ', implode('
  • ', Maintenance::$context['sql_results']), '
'; - } - - if (!empty(Maintenance::$context['failures'])) { - echo ' + } + + if (!empty(Maintenance::$context['failures'])) { + echo '
', Lang::$txt['error_db_queries'], '
    '; - - foreach (Maintenance::$context['failures'] as $line => $fail) { - echo ' + + foreach (Maintenance::$context['failures'] as $line => $fail) { + echo '
  • ', Lang::$txt['error_db_queries_line'], $line + 1, ': ', nl2br(htmlspecialchars($fail)), '
  • '; - } - - echo ' + } + + echo '
'; - } - - echo ' + } + + echo '

', Lang::$txt['db_populate_info2'], '

'; - - Template::warningsAndErrors(); - - echo ' + + Template::warningsAndErrors(); + + echo ' '; - } + } - public static function AdminAccount(): void - { - echo ' + /** + * Admin Account page for installer. + */ + public static function AdminAccount(): void + { + echo '

', Lang::$txt['user_settings_info'], '

'; - - Template::warningsAndErrors(); - - echo ' + + Template::warningsAndErrors(); + + echo '
@@ -419,34 +448,37 @@ public static function AdminAccount(): void
', Lang::$txt['user_settings_server_email_info'], '
'; - - if (Maintenance::$context['require_db_confirm']) { - echo ' + + if (Maintenance::$context['require_db_confirm']) { + echo '

', Lang::$txt['user_settings_database'], '

', Lang::$txt['user_settings_database_info'], '

'; - } - } + } + } - public static function DeleteInstall(): void - { - echo ' + /** + * Delete Installer page for installer. + */ + public static function DeleteInstall(): void + { + echo '

', Lang::$txt['congratulations_help'], '

'; - Template::warningsAndErrors(); + Template::warningsAndErrors(); - // Install directory still writable? - if (Maintenance::$context['dir_still_writable']) { - echo ' + // Install directory still writable? + if (Maintenance::$context['dir_still_writable']) { + echo '

', Lang::$txt['still_writable'], '

'; - } + } - // Don't show the box if it's like 99% sure it won't work :P. - if (Maintenance::$context['probably_delete_install']) { - echo ' + // Don't show the box if it's like 99% sure it won't work :P. + if (Maintenance::$context['probably_delete_install']) { + echo '