ProleWiki:Maintenance/Adding languages: Difference between revisions
More languages
More actions
m (Fixed mysql command with wrong syntax) |
m (Added Flow to list of extensions which require manual intervention.) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
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<ref group="lower-alpha">(e.g.: <code><nowiki>https://en.prolewiki.org</nowiki></code>, <code>en</code>, <code>prole_en</code>)</ref> 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.: <code>en</code> for English, <code>fr</code> for French, <code>ru</code> 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=== | === 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 <code>/etc/apache2/sites-enabled/prolewiki.conf</code> for editing. There are 3 places to add the new subdomain: | |||
** The 1st and 2nd <code>ServerAlias</code> lines in the <code>VirtualHost</code> blocks for port :80 and :443. | |||
** The <code>RewriteCond</code> lines in approximately the middle of the file. | |||
* Add entries for the new subdomain so that the placement, formatting, etc, match the existing entries. | |||
* Run <code>apache2ctl -t</code> and look for anything worse than a <code>warn</code>, or anything likely to cause problems | |||
* Run <code>certbot</code> | |||
===Step | === Step 3: Create new database for the site === | ||
<ul> | <ul> | ||
<li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight> | <li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight> | ||
Line 12: | Line 20: | ||
<li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight> | <li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight> | ||
</ul> | </ul> | ||
=== Step 4: Add basic schema to database === | |||
*Input the command <code>mysql prole_aa < /var/www/ | *Input the command <code>mysql prole_aa < /var/www/prolewiki/maintenance/tables-generated.sql</code> | ||
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 <code>sql/</code> folder inside. You'll need to run | |||
<code>mysql prole_aa < /var/www/prolewiki/extensions/[Extension]/sql/table_name_usually.sql</code> | |||
*Edit <code>/var/www/ | so you can manually add those tables. (MediaWiki pls fix) | ||
* | |||
Here is a list of extensions which we have to add those tables: | |||
CreatedPagesList | |||
Flow (extensions/Flow/sql/mysql/tables-generated.sql) | |||
=== Step 5: Add new site to server registry configuration === | |||
*Edit <code>/var/www/prolewiki/pw-conf/ServerRegistry.php</code> | |||
*In our wiki, we use an array to define wiki codes. Just add the new language code to it | |||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
$wikiCodes = ['shared','aa','de','el','en','es','fa','fr','pt','ru','zh']; | |||
</syntaxhighlight>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)<syntaxhighlight lang="php"> | |||
case 'aa': | |||
</syntaxhighlight> | $wgMatomoIDSite = "xx"; | ||
$wgMetaNamespace = "ProleWiki"; | |||
<syntaxhighlight lang="php"> | $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 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Step 6: Add site to sites table in shared database and update all databases === | |||
==== With script ==== | |||
*Go to the root directory <code>/var/www/prolewiki</code> | |||
*[[Comrade:Forte|Forte]] created several scripts on <code>pw-conf/scripts/</code> folder. You can simply add the language code to the array declared in the file named <code>wikicodes.sh</code>: | |||
<code>wikis=("en" "pt" "es" "de" "fr" "ru" "zh" "el" "fa" "aa")</code> | |||
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: | |||
<code>pw-conf/scripts/./site_refresh.sh</code> | |||
==== Manually ==== | |||
You can still add manually a new site, by running from the root folder (<code>/var/www/prolewiki/</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"/> |
Latest revision as of 14:58, 21 April 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 placement, formatting, etc, match the existing entries.
- Run
apache2ctl -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)
Here is a list of extensions which we have to add those tables:
CreatedPagesList Flow (extensions/Flow/sql/mysql/tables-generated.sql)
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 several scripts on
pw-conf/scripts/
folder. You can simply add the language code to the array declared in the file namedwikicodes.sh
:
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/scripts/./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
)