Manual:Sites table
↑ Manual:Contents | MediaWiki database layout | sites table |
The sites table, introduced in MediaWiki 1.21 in May 2013, holds all the sites known to the wiki.
Contents
Fields[edit | edit source]
site_id[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Numeric id of the site. This is an auto-incrementing primary key.
site_global_key[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Global identifier for the site, ie 'enwiktionary'
site_type[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Type of the site, ie 'mediawiki'
site_group[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Group of the site, ie 'wikipedia'
site_source[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Source of the site data, ie 'local', 'wikidata', 'my-magical-repo'
site_language[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Language code of the sites primary language.
site_protocol[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Protocol of the site, ie 'http://', 'irc://', '//'. This field is an index for lookups and is build from type specific data in site_data.
site_domain[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Domain of the site in reverse order, ie 'org.mediawiki.www.'. This field is an index for lookups and is build from type specific data in site_data.
site_data[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Type dependent site data.
site_forward[edit | edit source]
MediaWiki version: | ≥ 1.21 |
If site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.
site_config[edit | edit source]
MediaWiki version: | ≥ 1.21 |
Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.
Schema summary[edit | edit source]
MediaWiki version: | 1.22 |
DESCRIBE sites; in MediaWiki 1.22alpha (2a2e9e6) results in:
+-----------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+------------------+------+-----+---------+----------------+ | site_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | site_global_key | varbinary(32) | NO | UNI | NULL | | | site_type | varbinary(32) | NO | MUL | NULL | | | site_group | varbinary(32) | NO | MUL | NULL | | | site_source | varbinary(32) | NO | MUL | NULL | | | site_language | varbinary(32) | NO | MUL | NULL | | | site_protocol | varbinary(32) | NO | MUL | NULL | | | site_domain | varbinary(255) | NO | MUL | NULL | | | site_data | blob | NO | | NULL | | | site_forward | tinyint(1) | NO | MUL | NULL | | | site_config | blob | NO | | NULL | | +-----------------+------------------+------+-----+---------+----------------+
Scripts[edit | edit source]
Insert wiki family[edit | edit source]
Sometimes, you have to add your wikis in this table. You can use this code:
$sites = array(); foreach ( array( 'en', 'fr' ) as $langCode ) { $site = new MediaWikiSite(); $site->setGlobalId( $langCode . 'mywiki' ); $site->setGroup( 'mywiki' ); $site->setLanguageCode( $langCode ); $site->addInterwikiId( $langCode ); $site->addNavigationId( $langCode ); $site->setPath( MediaWikiSite::PATH_PAGE, "http://$langCode.mywiki.org/wiki/$1" ); $site->setPath( MediaWikiSite::PATH_FILE, "http://$langCode.mywiki.org/w/$1" ); $sites[] = $site; } $sitesTable = SiteSQLStore::newInstance(); $sitesTable->clear(); $sitesTable->saveSites( $sites );
![]() |
Engines: MySQL – Oracle – PostgreSQL – SQLite Technical documentation: Schema (tables) – API property associations – Field prefixes – Primary key storage in other fields – Wikimedia extension tables Configuration: Settings – Sharing Development: Access – Optimization – Policy – Updater – Extension schema updates – Patch file Core tables: archive – category – categorylinks – change_tag – config – externallinks – filearchive – hitcounter – image – imagelinks – interwiki – iwlinks – ipblocks – job – l10n_cache – langlinks – logging – log_search – msg_resource – msg_resource_links – module_deps – objectcache – oldimage – page – pagelinks – page_props – page_restrictions – protected_titles – querycache – querycachetwo – querycache_info – recentchanges – redirect – revision – searchindex – sites – site_stats – tag_summary – templatelinks – text – transcache – updatelog – uploadstash – user – user_former_groups – user_groups – user_newtalk – user_properties – valid_tag – watchlist |
---|