ProleWiki:Maintenance/Adding languages: Difference between revisions
More languages
More actions
(Updated procedure) Tag: Visual edit |
No edit summary |
||
Line 71: | Line 71: | ||
<code>php maintenance/run.php ./maintenance/addSite.php aa prolewiki --wiki shared --pagepath=<nowiki>https://aa.prolewiki.org/wiki/\$1</nowiki> --filepath=<nowiki>https://aa.prolewiki.org/\$1</nowiki> --language aa --interwiki-id aa</code> | <code>php maintenance/run.php ./maintenance/addSite.php aa prolewiki --wiki shared --pagepath=<nowiki>https://aa.prolewiki.org/wiki/\$1</nowiki> --filepath=<nowiki>https://aa.prolewiki.org/\$1</nowiki> --language aa --interwiki-id aa</code> | ||
=== Notes === | |||
<references group="lower-alpha"/> |
Revision as of 22:13, 28 March 2024
The following is a step-by-step tutorial on how to add new languages to ProleWiki. The tutorial assumes that the website subdomain, language code and database name[a] follow the same pattern. As an example, a non-existent "aa" language code will be used, but it should be changed to the language that is being included (e.g.: en
for English, fr
for French, ru
for Russian, etc.). We can check the existing language on Wikipedia as a reference for its language code.
Step 1: Create new A Record for the site
- Go to our Namecheap account and add new A Record for the site, using the same configuration as the others, changing only the language code.
Step 2: Add site domain to Apache vHost directive & reissue certificate
The new language subdomain must be explicitly added to Apache for Let's Encrypt to detect it and issue the certificate with the correct SANs.
- Open
/etc/apache2/sites-enabled/prolewiki.conf
for editing. There are 3 places to add the new subdomain:- The 1st and 2nd
ServerAlias
lines in theVirtualHost
blocks for port :80 and :443. - The
RewriteCond
lines in approximately the middle of the file.
- The 1st and 2nd
- Add entries for the new subdomain so that the placemet, formatting, etc, match the existing entries.
- Run
apache -t
and look for anything worse than awarn
, or anything likely to cause problems - Run
certbot
Step 3: Create new database for the site
- Open command
mysql
- Type in
CREATE DATABASE prole_aa;
- Give permission to database user by typing
GRANT ALL PRIVILEGES ON prole_aa.* TO 'proledbuser'@'localhost';
- Exit mysql by typing
exit
Step 4: Add basic schema to database
- Input the command
mysql prole_aa < /var/www/prolewiki/maintenance/tables-generated.sql
After that, we probably have to add additional extension tables. Check the errors given and find clues for what extension is crashing and what tables they are using. Most extensions which require additional database tables will feature an sql/
folder inside. You'll need to run
mysql prole_aa < /var/www/prolewiki/extensions/[Extension]/sql/table_name_usually.sql
so you can manually add those tables. (MediaWiki pls fix)
Step 5: Add new site to server registry configuration
- Edit
/var/www/prolewiki/pw-conf/ServerRegistry.php
- In our wiki, we use an array to define wiki codes. Just add the new language code to it
$wikiCodes = ['shared','aa','de','el','en','es','fa','fr','pt','ru','zh'];
We have to hard-code namespace localizations. We do that as a big switch-case in the server config file. Add these lines, making the necessary changes according to the necessity of the language (not all languages require to rename MetaNamespaces and Sitename for instance)
case 'aa':
$wgMatomoIDSite = "xx";
$wgMetaNamespace = "ProleWiki";
$wgMetaNamespaceTalk = "ProleWiki talk"
$wgSitename = "ProleWiki"
$wgExtraNamespaces = [
NS_TALK => 'Talk'
NS_LBRY => 'Library'
NS_LBRY_TALK => 'Library discussion'
NS_ESY => 'Essay'
NS_ESY_TALK => 'Essay critique'
NS_PORTAL => 'Portal'
NS_PORTAL_TALK => 'Portal talk'
NS_QUOTE => 'Quotes'
NS_QUOTE_TALK => 'Quotes talk'
NS_USER => 'Comrade'
NS_USER_TALK => 'Comradeship'
];
break; // don't forget break; in switch case
With script
- Go to the root directory
/var/www/prolewiki
- Forte created a script on
pw-conf/
folder. You can simply add the language code to the array declared there:
wikis=("en" "pt" "es" "de" "fr" "ru" "zh" "el" "fa" "aa")
The sites are listed on the order of addition, just add to the end of the array. Then, from the root directory, run the script with:
pw-conf/./site_refresh.sh
Manually
You can still add manually a new site, by running from the root folder (/var/www/prolewiki/
):
php maintenance/run.php ./maintenance/addSite.php aa prolewiki --wiki shared --pagepath=https://aa.prolewiki.org/wiki/\$1 --filepath=https://aa.prolewiki.org/\$1 --language aa --interwiki-id aa
Notes
- ↑ (e.g.:
https://en.prolewiki.org
,en
,prole_en
)