Manual:Wiki family/pt

Em baixo, tem instruções sobre como configurar o MediaWiki para alojar mais do que uma wiki. Múltiplas wikis localizadas no mesmo servidor são chamadas de família de wikis (wiki-family) ou conjunto de wikis (wiki farm). Está disponível uma lista de conjuntos de wiki conhecida em.

Princípios básicos
The most common configuration of a wiki family runs a single version of MediaWiki. The following general steps are required in this scenario:
 * 1) Install a normal MediaWiki site, and create a database template from it. This can either be completely empty (i.e. no rows in any tables) or can have whatever initial pages, users, interwiki links, etc. that you want in any new member of the family.
 * 2) Set up your web server to route traffic from multiple places to the one MediaWiki installation. This can be for multiple domains, subdomains, or subdirectories, and can be done with symlinks, aliases, URL rewriting, or other mechanisms.
 * 3) Configure the family in LocalSettings.php, in four broad sections:
 * 4) Firstly, use $_SERVER['SERVER_NAME'] or $_SERVER['REQUEST_URI'] (or similar), and the   constant (and environment variable) to identify different wikis (e.g. as a variable called  ). The former are for web requests, the latter for maintenance scripts (which you'll pass the   parameter). Don't forget to fail nicely at this point if the wiki can't be identified.
 * 5) Then, set up configuration variables that are based on the wiki ident. These include:
 * 6) Next, set configuration variables that are different for every wiki. These include: These could also be included from a separate file, e.g..
 * 7) Lastly, the rest of LocalSettings.php configures all of the common aspects, such as extensions, skins, etc.
 * 8) Shared resources can be configured, such as users, sessions, media (i.e. uploads), interwiki links, etc.
 * 9) Installing a new wiki in the family is a matter of creating the database and importing the database template, and then running  . Upgrades and other maintenance tasks are similar.

The rest of this page elaborates on (or will do[update required]) the various parts of the above.

Declaração de mudança enorme
Isto irá deixá-lo instalar mais do que uma wiki num único servidor, utilizando o mesmo código fonte.


 * 1) Enviar ficheiros do MediaWiki para a pasta da Web no servidor da Web.
 * 2) Configurar a wiki inicial como normalmente. Para detalhes, consulte.
 * 1) After successful installation, move  into the root directory of your wiki and rename it in such a way to make it easy to track (e.g. LocalSettings_myFirstWiki.php)
 * 1) Repeat step two and three above for each wiki you wish to create, creating a new LocalSettings.php file for each wiki (e.g., LocalSettings_anotherWiki.php, etc.)
 * 1) If two or more separately installed wikis are to be merged to operate out of files of the main wiki, then after renaming and moving each of your LocalSettings.php files to the main wiki folder, change the variable  in each of the LocalSettings.php files to point to the main wiki's folder.
 * 1) Create a LocalSettings.php file for your global settings, then select one from the two possibilities below:


 * If you have different (sub)domains that link to one directory on your server, use this:


 * If your wikis are on the same domain but different paths (e.g.,   etc.), you can use something like this:

It is recommended to use a different DB for each wiki (By setting a different for each wiki). However if you are limited to a single database, you can use a different prefix to separate the different installs.

It may also be useful to simply redirect any unrecognized wiki URL to the "main" url, instead of "This wiki is not available. Check configuration."

Utilizar EXPORT
This method requires the to be present to run maintenance/update.php - which of course it isn't, from the commandline. This can be overcome by setting an environment variable:

If you were using the subdirectory method, you can use:

Utilizar o parâmetro conf
If you are using a separate  file for each wiki in the family, as suggested in Giant switch statement, then you can use the   parameter to tell   which settings file to use. Por exemplo:

Drupal-sites de estilo
Como acima, esta configuração permite-lhe instalar mais do que uma wiki, utilizando bases de dados diferentes num único servidor, utilizando o mesmo código fonte. This setup has the advantage of being completely transparent to users and reasonably secure in terms of the images directory.


 * 1) Create a base directory to contain all your MediaWiki files e.g..

 ServerAdmin me@myserver.com DocumentRoot /home/web/wiki.mysite.com ServerName wiki.mysite.com CustomLog /var/log/apache2/wiki.mysite.log common # Alias for the site to be accessible Alias /mediawiki/code /home/web/mediawiki/code # Alias for Wiki so images work Alias /images /home/web/mediawiki/sites/wiki.mysite.com/images # If you want to password protect your site #  #   AuthType Basic #   AuthName "My protected Wiki" #   AuthUserFile /etc/apache2/htpasswd/users-mywiki #  require valid-user #  
 * 1) Install MediaWiki and additional tools as usual to a version-declaring subdirectory (e.g.,  ).
 * 2) Link the version-declaring directory to a code directory. e.g.,
 * 3) Create a sites directory to contain our images and settings:
 * 4) Setup the wiki as normal from the /code directory.
 * 5) After successful installation, move LocalSettings.php into a sites directory that will be a match when the site is checked. For example, to capture http://mysite.com/mywiki, one would create the directory mysite.com.mywiki. e.g.,  . See the Drupal's settings.php file for more information on this.
 * 6) If you intend to use media files, create an images directory in your site directory. e.g.,  .  Make it writable as necessary.
 * 7) Place the Drupal-style LocalSettings.php file in your main directory:
 * 8) Modify the LocalSettings.php of each subsite to point to the right places:
 * 9) First comment out the code relating to , (lines 16-20 in 1.15.3) as this is set to the code directory by.
 * 10) Next insert the following two lines to ensure that image files are accessible, e.g.:   and  . These need to be put somewhere after the call to   (line 25 in 1.15.3), as the variables will otherwise be reset.
 * 11) Make further modifications as required.
 * 12) Prepare your Apache 2 installation. Example site: wiki.mysite.com
 * 13) Create a link to the code directory, if required e.g.
 * 14) Create an appropriate VHost configuration:
 * 11. If you are setting the sites up locally, update your  file with the site names. The site should now work.

In my case, I made another copy of the code from which to install and update my LocalSettings.php and databases. Note that  in the companion Drupal code is undefined when running maintenance scripts from the command line, so this solution does not permit the use of maintenance scripts without some modification.

Drupal Modificado-método de estilo para o Ubuntu
A simplified method for multiple wikis and multiple (or nested) subwikis on Ubuntu/Kubuntu that is loosely based on the above method can be found at:
 * Ubuntuguide.org MediaWiki tips

Múltiplas wikis a partilhar recursos comuns
Se deseja ter algumas wikis em idiomas diferentes, partilhando os mesmos ficheiros mediateca em outra wiki única.

Por exemplo:


 * en.yourwiki.org -
 * fr.yourwiki.org -
 * de.yourwiki.org -
 * pool.yourwiki.org - ficheiros mediateca para todas estas wikis (como a Commons).
 *  As there is already an Interwikilink named  for Wikimedia Commons, we name our media-files-wiki "pool". 
 * Think before being creative; if you call your media-files-wiki something like "media" (e.g. media.example.com), it might collide with internal namespaces and nomenclature for embedded media files ( [[media:file.ext]] ).

No seu sistema de ficheiros, crie uma pasta para cada wiki. Execute o ficheiro de instalação para cada wiki.

Esta solução duplica o código fonte. To reduce this duplication and improve cache performance, you may wish to replace the  (≤ MW 1.20.x), ,  ,  ,  ,  ,   (≤ MW 1.17.x),  ,  ,  ,   and   (≥ MW 1.22.x ) directories for non-pool installations with symbolic links to the pool's directories:

THIS WILL NOT WORK. For example, enter  and then enter''

To do the same in Windows, use

Interwiki
Agora tem de definir as Interligações entre wikis entre todas as wikis, editando as suas base de dados MySQL (se preferir, instale e utilize )
 * Tabela da Interwiki
 *  iw_prefix - enter the language-code of the wikis, "de" for German, "en" for English, "fr" for French and "pool" for the mediapoolwiki
 *  iw_url - this is the place for the complete URL to the wikis, e.g. " http://de.yourwiki.org/index.php/$1 " for the German wiki (don't forget the "$1" !).

Enter as many records into table Interwiki than you have different wiki (so one record for German, one for English, one for media for example).

Now you can link an article to the same in another languages. Adding Hauptseite on your English Main_Page will create the link "Deutsch" (under the Navigation bar) which leads to the Main_Page of the German wiki (Hauptseite). Para mais informação, visite

Note to page Special:Interwiki: (you will see a long table) Add in the German wiki the prefix 'en' and the url http://en.yourwiki.org/index.php/$1 and set the checkbox 'Als lokales Wiki definiert'. Do it in the English wiki vice versa with checkbox 'Forward'. And in both wikis enter a second prefix 'pool' and http://pool.yourwiki.org/index.php/$1 and check the checkbox 'Forward'.

Envio
Certifique-se que a pasta "images" da wiki pool é gravável.

Isto é útil para alterar "Enviar ficheiro"-Hiperligação das wikis de idioma para apontar para o site de envio poolwiki. Abra "LocalSettings.php" de cada wiki de idioma e adicione:

Na versão 1.17, também irá ter de definir $wgUploadMissingFileUrl para ser redirecionado para wiki pool nas hiperligações a vermelho.

Utilizar ficheiros partilhados
To use poolwiki's files in the languagewikis, open "LocalSettings.php" for each languagewiki and add:

Now you can integrate pool's files with (e.g. ) in the languagewikis.

Descrição da imagem
Em cada languagewiki, abra (como uma aministrador) a mensagem MediaWiki:Sharedupload-desc-here.

Altere o texto para qualquer coisa, como:

Este ficheiro é guardado na nossa pool de dados. Para informação e descrição, por favor, visite a

descrição aqui.

(And note the ':' at the beginning of the line, which stops 'pool' from being included in the interwiki list at the left of the page.)

If you want to output the media-description, stored in the PoolWiki, too, add to the "LocalSettings.php" of the languagewikis:

Configurações Partilhadas
If you have multiple wikis, you'll probably want to share similar settings across them all. Here is how to do that. We recommend that you separate your Extension settings into a different file than your other settings, as detailed below. They can be all put into one large file, but it's not as flexible depending upon your specific needs.

Here is an example directory structure if you do all of the following:

en/ es/ pl/ ja/ pool/ ExtensionSettings.php WikiFamilySettings.php SharedMediaSettings.php

Configurações de Extensão

 * Passo 1
 * Create a file called ExtensionSettings.php with the following contents, and place it in a location similar to the example above.


 * Passo 2
 * Edit the LocalSettings.php file of each wiki that you want to use the shared settings, and add the following.
 * Passo 3
 * Now just add all the references to your various extensions

Configurações da Família Wiki
These are settings that you want to apply to the entire wiki family. For example, maybe you want to be able to easily put all the wikis into read-only mode at the same time. You can also store the username/password for the database(s), if they are all the same. Additionally, you could control user permissions across your entire wiki from this one file.

Tabelas da base de dados partilhada
Consulte Manual:Base de dados partilhada para instruções sobre a configuração das tabelas da base dados partilhada.

Symlink method
The symlinks method was formerly a method that eliminated the need to have redundant copies of MediaWiki on your filesystem while providing flexibility and customization for each wiki. WARNING: As of recent MediaWiki versions, this doesn't work anymore. If you try this, your MediaWiki will break. Instead, it's highly recommended to follow its spiritual successor, the method used by the Wikimedia Foundation (and the method that's used to power Wikipedia, this wiki, and many more!).

$ ls -og lrwxrwxrwx 1 16 2008-11-03 06:29 aaa.example.org -> mediawiki lrwxrwxrwx 1 16 2008-11-03 06:29 bbb.example.org -> mediawiki lrwxrwxrwx 1 16 2008-11-03 06:29 ccc.example.org -> mediawiki

Let's see a real example of. In real life we must deal with the slight differences in the names and databases of the sites we manage.

Note we still individually do database related tasks, e.g.,  (The above code should detect which wiki's update.php you are referring to.) Atualizar é simples, se transferir do Git. (Hopefully there is no more code that assumes there is only one wiki on the disk...)

Imagens
Unless you do not allow uploads or allow them only for your pool wiki, you will need to create separate image directories and alias them in your vhost configuration: , and in aaa.example.org's vhost: . Same for bbb and ccc.

However you may instead just prefer, where *.example.org/images/ just point to the same single directory. Or one could use e.g., *.example.org/$wgDBname/images/.

Adicionar novas wikis
Para adicionar uma wiki para a criação de
 * 1) add its configuration to your web server
 * 1) temporarily comment out the  check of config/index.php and then run it
 * 1) merge the config/LocalSettings.php produced into LocalSettings.php
 * 1) add some pages

Remover wikis antigas
Para remover uma wiki de uma criação de


 * 1) remove its configuration from
 * 1) web server
 * 1) LocalSettings.php
 * 1) DROP DATABASE

Método da Wikimedia
Another option is using the method that the Wikimedia Foundation uses. This uses only one single MediaWiki directory to provide the backbone for all sites, with the specific wiki being served dynamically determined at page load depending on the value of  being sent from the webserver (in WMF's case, Apache) to PHP. The rough steps are listed below. This method isn't for the faint of heart, but it has fairly good results, as can be seen by the success the Wikimedia Foundation has had by using this :-)   Configure a template copy of MediaWiki through the online configuration wizard, or use the install.php maintenance script. Edit the Main Page if you want a default main page for every wiki you create on your farm.   After that, export your database with mysqldump, phpMyAdmin, etc. This database export can also be structure-only (e.g. ), in which case you'll have to create the first user with . Save this on your server in the maintenance/ directory as something like  .   Now, write up a few quick scripts to create a new wiki. In summary, you'll need to duplicate the database for a list of wikis (the list can be flat-file based or MySQL/SQLite based). First export the template wiki, then import the template database dump back into the database under the name of each new wiki. Use a standard suffix after the new database name (i.e. if the wiki is cat.example-farm.org, then you might choose catwiki as the database name).   In your configuration file, add something like this, fixing the database prefix and your domain as necessary:   Configure your DNS with a wildcard A record, and apache with a server alias (like ) and you should be in business.  

The script maintenance/update.php, as well as every other maintenace script, takes a  parameter that is exported as   constant. Your LocalSettings.php file needs to set it as the correct $wgDBname. (This is because on the command-line, there is no HTTP request, and therefore "SERVER_NAME" isn't set.) For instance:

Your unique LocalSettings.php (which usually consists in a few lines including a CommonSettings.php not directly accessible from the server) uses the $wgDBname variable to initialise the wiki-specific settings. See for how.

You'll also need to fix the upload directories unless you want every wiki to use the same files. If you require the upload directories to be different, consider a more sophisticated setup by modifying $wgLocalFileRepo and/or $wgForeignFileRepos. You may also want to consider a remote server solution. The Wikimedia Foundation uses OpenStack Swift. Furthermore, extensions exist to enable your wiki to use AWS S3 and Azure Storage for remote file storage as well. As said above, this is probably one of the hardest methods to do, and it requires more technical experience, but it can give really good, clean results. For more details on how the Wikimedia Foundation configures their wikis, visit the Wikitech wiki's explanation of the Wikimedia Foundation's MediaWiki architecture.

Extensões da Wiki Farm
There are several MediaWiki extensions that attempt to simplify hosting of several wikis by using just one code base, however only one is currently noteworthy:


 * - beta

Ver também

 * Base de dados da configuração
 * Grupos e utilizadores de Farmers do MediaWiki e Wikifarm
 * Grupos e utilizadores de Farmers do MediaWiki e Wikifarm
 * Grupos e utilizadores de Farmers do MediaWiki e Wikifarm
 * Grupos e utilizadores de Farmers do MediaWiki e Wikifarm
 * — the mechanism by which user accounts can have an extra 'central' identifier.