ProleWiki:Maintenance/Adding languages: Difference between revisions
From ProleWiki, the proletarian encyclopedia
More languages
More actions
(Created page) Tag: Visual edit: Switched |
m (Fixed mysql command with wrong syntax) |
||
Line 8: | Line 8: | ||
<ul> | <ul> | ||
<li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight> | <li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight> | ||
<li> Type in <syntaxhighlight inline lang="mysql">CREATE prole_aa;</syntaxhighlight> | <li> Type in <syntaxhighlight inline lang="mysql">CREATE DATABASE prole_aa;</syntaxhighlight> | ||
<li> Give permission to database user by typing <syntaxhighlight inline lang="mysql">GRANT ALL PRIVILEGES ON prole_aa.* TO 'proledbuser'@'localhost';</syntaxhighlight> | <li> Give permission to database user by typing <syntaxhighlight inline lang="mysql">GRANT ALL PRIVILEGES ON prole_aa.* TO 'proledbuser'@'localhost';</syntaxhighlight> | ||
<li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight> | <li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight> |
Revision as of 00:53, 9 August 2022
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