ProleWiki:Maintenance/Adding languages: Difference between revisions
More languages
More actions
No edit summary |
m (Added Flow to list of extensions which require manual intervention.) |
||
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
** The 1st and 2nd <code>ServerAlias</code> lines in the <code>VirtualHost</code> blocks for port :80 and :443. | ** 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. | ** The <code>RewriteCond</code> lines in approximately the middle of the file. | ||
* Add entries for the new subdomain so that the | * Add entries for the new subdomain so that the placement, formatting, etc, match the existing entries. | ||
* Run <code> | * 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> | * Run <code>certbot</code> | ||
Line 28: | Line 28: | ||
so you can manually add those tables. (MediaWiki pls fix) | 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 === | === Step 5: Add new site to server registry configuration === | ||
Line 60: | Line 64: | ||
==== With script ==== | ==== With script ==== | ||
*Go to the root directory <code>/var/www/prolewiki</code> | *Go to the root directory <code>/var/www/prolewiki</code> | ||
*[[Comrade:Forte|Forte]] created | *[[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> | <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: | 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/./site_refresh.sh</code> | <code>pw-conf/scripts/./site_refresh.sh</code> | ||
==== Manually ==== | ==== Manually ==== |
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
)