Files and licenses concept

to distinguish words from tables, the mw_ prefix is used

= Current situation / Introduction = Every page has an entry in the  table, primarily uniquely identified by. Special properties about this page are stored in  per page.

Every revision of every page has an entry in the  table. A revision is made when the page is created, edited, renamed, or protected.

Every text version of every page has an entry in the  table. If a revision didn't change the text, it keeps referring to the same  row.

Licenses allowed to be chosen during upload are defined at MediaWiki:Licenses. That page is kept as a list the piped part describes the license, everything before that is wrapped between 🇦🇩 on the File-page under a.

Information about the file is stored in the Information-template.

Viewing a file:
 * Page namespace/title is looked up in, and.
 * mw_page.page_id is used to get info from other tables (like )

= Goal =

Table structure
Licenses have their own table, (say mw_licenses). With columns like: lc_id		PRI UNIQ AI, lc_abbrev	VARCHAR 255, lc_attribution	tinyint(1) unsigned, lc_fulltext	tinyint(1) unsigned, lc_sharealike	tinyint(1) unsigned Example: lc_abbrev		TASL lc_attribution	1 lc_fulltext		0 lc_sharealike		0 MediaWiki:License-TASL-text	This file by $1 is licensed under $3. Please attribute the author as: $2 MediaWiki:License-TASL-title	The Awesome Something License Example: lc_abbrev		CC-BY-SA-3.0 lc_attribution	1 lc_fulltext		0 lc_sharealike		1 MediaWiki:License-CC-BY-SA-3.0-text MediaWiki:License-CC-BY-SA-3.0-title	Creative Commons Attribution Share-Alike 3.0 License //reason for title being separated from database is to allow easier translation, example: MediaWiki:License-CC-BY-SA-3.0-title/nl	Creative Commons Naamsvermelding Gelijk-Delen 3.0 licentie
 * The text of the licenses are stored in [[ MediaWiki:License-{lc_abbrev}-text] ] which contains wikitext.
 * $1: author (mw_file_props.fp_author)
 * $2: attribution (mw_file_props.fp_attribution, if NULL, same as author)
 * $3: title
 * The title of the licenses are stored in [ [MediaWiki:License-{lc_abbrev}-title] ] which is plain-text.

Management


would be a good recommendation for an extension installation. If this concept is built into core though, it's be good as a default.
 * Lists all licenses, allow editing them on pages like Special:LicenseManager/12 (by id, like AbuseFilter)
 * Since the actual text is stored in UI messages, they can contain a template if it is desired to allow non-sysops edit them. Since properties like whether or not attribution is required are rarely altered and can only be performed by users with the licensemanager-modify. By core nobody has this right, something like:
 * Changes, creations and removals of licenses are publically logged at Special:Log/licenseman.
 * Removal only possible if not in use. In the event a file previously using it would be reverted to a state where it uses this one again, it would display  or perhaps )

Drop-down menu
During upload a license must be chosen from the drop-down menu. The drop-down menu is populated by MediaWiki:Uploader-licenses. The list would render by fetching the titles from [ [MediaWiki:License-{lc_abbrev}-title] ] (kinda like MediaWiki:Sidebar does) as 's, optionally a different description could be given by piping it:
 * GFDL|GNU Free Documentation License (Version 1.2 or later)
 * CC-BY-SA-3.0

File
Specific information about the file itself is still kept in the mw_image table. Page content information is still kept in mw_page and mw_revision.

Information about the file as a whole is kept as a property either in the existing mw_page_props or in a new mw_file_props (will refer to this as 'mw_file_props' for now). The mw_file_props is similar to the mw_text table in that it is kept per revision and only updated when needed.

A reference to the current file props is kept in the appropriate mw_revision rows, just like it keeps a reference to mw_text. When either doesn't change the reference is kept and no duplicate rows will be made. mw_file_props contains: fp_id		PRI UNIQ AI, (mw_revision.rev_props_id is a key to this column) fp_license	INT (key to mw_licenses.lc_id) fp_author	mediumblob (comma separated plain text list of author(s)) fp_attribution	mediumblob (may be empty or contain wikitext for attribution)
 * < Why keep different versions of file properties ?
 * > Since they contain text and can be edited by many users keeping it all in the Log would get messy (if it fits at all) and doesn't allow rollbacking. By keeping it seperate a change could easily be reverted to the previous revision just like is done for mw_text in mw_revision (null-edit, only setting rev_props_id back to the previous one). And, when viewing a previous revision of a page the proper info from then is displayed.