Manual:Tabla de sites

Jump to navigation Jump to search
This page is a translated version of the page Manual:Sites table and the translation is 32% complete.
Outdated translations are marked like this.
Other languages:
English • ‎español • ‎русский • ‎中文 • ‎日本語 • ‎한국어
Manual:Contenido MediaWiki database layout sites table/es

Versión de MediaWiki: 1.21

La tabla de sitios, introducida en MediaWiki 1.21 en mayo de 2013, contiene todos los sitios que conoce el wiki.



Versión de MediaWiki: 1.21

Numeric id of the site. This is an auto-incrementing primary key.


Versión de MediaWiki: 1.21

Identificador global del sitio. Por ejemplo: 'enwiktionary'


Versión de MediaWiki: 1.21

Tipo del sitio. Por ejemplo: 'mediawiki'


Versión de MediaWiki: 1.21

Grupo del sitio. Por ejemplo: 'wikipedia'


Versión de MediaWiki: 1.21

Fuente de datos del sitio. Por ejemplo: 'local', 'wikidata', 'mi-repositorio'


Versión de MediaWiki: 1.21

Código del idioma principal de los sitios.


Versión de MediaWiki: 1.21

Protocolo del sitio. Por ejemplo: 'http://', 'irc://', '//'.

This field is an index for lookups and is built from type specific data in site_data.


Versión de MediaWiki: 1.21

Domain of the site in reverse order, ie 'gro.ikiwaidem.www.'.

This field is an index for lookups and is built from type specific data in site_data.


Versión de MediaWiki: 1.21

Type dependent site data.


Versión de MediaWiki: 1.21

If site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.


Versión de MediaWiki: 1.21

Type dependent site config. For instance if template transclusion should be allowed if it's a MediaWiki.

Managing the sites table

The sites table is shipped without data for a new MediaWiki installation.

Importing sites table from another wiki

There're two ways of populating the sites table using another wiki as a source. If you've access to the other wikis server, you can run the exportSite.php maintenance script and import the data using the importSites.php maintenance script of your MediaWiki installation.

If you don't have access to the other wikis server but the other MediaWiki installation has the SiteMatrix extension installed, you can use a maintenance script from the Wikibase extension (populateSitesTable.php) to import all sites from the other wiki.

Adding a new site

If you want to add a new site into your MediaWiki's site table, you can use the maintenance script addSite.php.

Additionally, the above mentioned importSites.php maintenance script can be used to add an arbitrary group of wikis from custom made XML file in the following format:

<sites version="1.0" xmlns="">
	<site type="mediawiki">
		<path type="file_path">$1</path>
		<path type="page_path">$1</path>
	<site type="mediawiki">
		<path type="file_path">$1</path>
		<path type="page_path">$1</path>

Each <site> element representing a site.

file_path and page_path can be inferred from Special:Version page of the intended wiki.

Insert wiki family (using Script)

A veces debes añadir tus wikis en esta tabla. Puedes usar este código:

$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://$$1" );
     $site->setPath( MediaWikiSite::PATH_FILE, "http://$$1" );           
     $sites[] = $site;
$sitesTable = SiteSQLStore::newInstance();
$sitesTable->clear(); // This will remove all previous entries from the table. Remove this call if you want to keep them.
$sitesTable->saveSites( $sites );

Schema summary

Versión de MediaWiki: 1.21


| 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    |                |