Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ProleWiki:Maintenance/Adding languages

From ProleWiki, the proletarian encyclopedia
More languages
Revision as of 02:06, 9 August 2022 by KakumeiAshley (talk | contribs) (added apache and ssl cert info)

Here we will be following a step-by-step tutorial on how to add new languages to ProleWiki. We will use a non-existent "aa" language code as an example, 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: 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 3: Add basic schema to database

  • Go to maintenance folder (cd /var/www/prole/maintenance)
  • Input the command mysql prole_aa < /var/www/prole/maintenance/tables-generated.sql

Step 4: Add new site to site configuration

  • Edit /var/www/prole/LocalSettings.php
  • Add the following lines where there are similar ones, and before the "language selector":
elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'aa.prolewiki.org') {
    $wikiId = 'aa';
}
  • Add this code block where there are similar ones like it, changing the options to the target language:
elseif ($wikiId == 'aa') {
	$wgServer = "https://aa.prolewiki.org";
	$wgDBname = "prole_aa";
	$wgLanguageCode = 'aa';
	$wgLogo = "/resources/assets/prolewiki_logo_aa.png";
	$wgExtraNamespaces = [
		NS_LBRY => 'Library',
		NS_LBRY_TALK => 'Library_talk',
		NS_ESY => 'Essay',
		NS_ESY_TALK => 'Essay_talk',
		NS_USER => 'Comrade',
		NS_USER_TALK => 'Comradeship',
		NS_QUOTE => 'Quotes',
		NS_QUOTE_TALK => 'Quotes_talk'
	];
	$wgMatomoIDSite = "X";					// Change to Matomo site
	$wgMetaNamespace = "ProleWiki";					// Only necessary for wikis which use a different alphabet
	$wgSitename = "ProleWiki";						// Same as above
	$wgNamespaceAliases['ProleWiki'] = NS_PROJECT;	// Same as above, leaving this as it is as a Latin alphabet fallback for the ProleWiki: namespace
	$wgWikiSeoDefaultImage = '/resources/assets/seo/seo_aa.png';
	$wgPageImagesOpenGraphFallbackImage = "/resources/assets/seo/seo_aa.png";
	// Wikibase
	wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
	require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
	$wgWBClientSettings['siteGlobalID'] = 'aa';
}
  • Save the file

Step 5: Add site to sites table in database and update it

  • Go to /var/www/prole/maintenance/
  • Input the following:
php addSite.php aa prolewiki --wiki shared --pagepath=https://aa.prolewiki.org/wiki/\$1  --filepath=https://aa.prolewiki.org/\$1 --language aa --interwiki-id aa
  • This should be done for all wikis. To do that, you should use:
php exportSites.php --wiki shared sites.xml
  • Then you import it for every wiki using (where wiki-id is de, en, es, fr, pt, ru, aa, etc.):
php importSites.php --wiki <wiki-id> sites.xml
  • Update all databases (where wiki-id includes shared as well:
php update.php --wiki <wiki-id> --quick

Step 6: 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 the VirtualHost blocks for port :80 and :443.
    • The RewriteCond lines in approximately the middle of the file.
  • 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 a warn, or anything likely to cause problems
  • Run certbot
    • To do: add more detailed certbot notes Comrade KakumeiAshley (talk) 02:06, 9 August 2022 (UTC)