Jump to content

User:Reversedragon/LocalSettings.php: Difference between revisions

From Philosophical Research
user rights
m Managing user rights: clarify what's in sqlite
Line 165: Line 165:
sqlite> INSERT INTO user_groups VALUES(1, 'bureaucrat', NULL);
sqlite> INSERT INTO user_groups VALUES(1, 'bureaucrat', NULL);
sqlite> INSERT INTO user_groups VALUES(1, 'interface-admin', NULL);
sqlite> INSERT INTO user_groups VALUES(1, 'interface-admin', NULL);
.save
sqlite> .save
.quit</pre>
sqlite> .quit</pre>

Revision as of 22:52, 7 February 2025

Info on namespace configuration (debug), etc. Not the entire LocalSettings.php, only the interesting parts.

Wikibase.example.php (unchanged)

call_user_func( function() {
	$baseNs = 120;

	define( 'WB_NS_ITEM', $baseNs );
	define( 'WB_NS_ITEM_TALK', $baseNs + 1 );
	define( 'WB_NS_PROPERTY', $baseNs + 2 );
	define( 'WB_NS_PROPERTY_TALK', $baseNs + 3 );
} );

LocalSettings.php (tested)

The following lines have been verified on a second test instance.

# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'Cite' );
wfLoadExtension( 'CiteThisPage' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
# The following were additional downloads:
wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
wfLoadExtension( 'WikibaseLexeme' );

# Extension configuration
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";

# Allow DISPLAYTITLE for pages such as User pages
$wgAllowDisplayTitle = true;
$wgRestrictDisplayTitle = false;

# Define constants for additional namespaces
define("NS_ONTOLOGY", 270);
define("NS_ONTOLOGY_TALK", 271);

# Add namespaces
$wgExtraNamespaces[NS_ONTOLOGY] = "Ontology";
$wgExtraNamespaces[NS_ONTOLOGY_TALK] = "Ontology_talk";

LocalSettings.php

// Define constants for my additional namespaces.
define("NS_ITEM", 0);
define("NS_TEMPLATE", 10);
define("NS_PROPERTY", WB_NS_PROPERTY);
define("NS_LEXEME", 146);
define("NS_ONTOLOGY", 270);
define("NS_ONTOLOGY_TALK", 271);

// Combine talk pages
define("NS_ITEM_TALK", NS_ONTOLOGY_TALK);
define("NS_PROPERTY_TALK", NS_ONTOLOGY_TALK);
define("NS_LEXEME_TALK", NS_ONTOLOGY_TALK);
// define("NS_FILE_TALK", NS_HELP_TALK);
// define("NS_TEMPLATE_TALK", NS_HELP_TALK);

// Add namespaces.
$wgExtraNamespaces[NS_ONTOLOGY] = "Ontology";
$wgExtraNamespaces[NS_ONTOLOGY_TALK] = "Ontology_talk";

$wgNamespacesWithSubpages[NS_ONTOLOGY] = false;
$wgNamespacesWithSubpages[NS_ONTOLOGY_TALK] = true;

// $wgNamespaceContentModels[NS_ITEM] = "wikibase-item";
// $wgNamespaceContentModels[NS_LEXEME] = "wikibase-lexeme";

$wgContentNamespaces = [ NS_ITEM, NS_PROJECT, 12, NS_LEXEME, NS_ONTOLOGY ];  // Main, Philosophical Research, Help, Lexeme, Ontology
$wgNamespaceAliases = [ 'Q' => NS_ITEM, 'P' => NS_PROPERTY, 'L' => NS_LEXEME, 'T' => NS_TEMPLATE, 'ONT' => NS_ONTOLOGY ];

// Interwiki
$wgLocalInterwikis = [ 'r' ];
$wgLocalDatabases = [ 'research' ];
$wgWBRepoSettings['siteLinkGroups'] = [ 'research', 'wikidata' ];
$wgWBRepoSettings['localClientDatabases'] = [ 'r' => 'research', 'd' => 'wikidata' ];

$wgWBClientSettings['entitySources'] = [
	'research' => [
		'repoDatabase' => 'research',
		'baseUri' => 'https://research.moraleconomy.au/entity',
		'entityNamespaces' => [
			'item' => 0,
			'property' => 122,
		],
		'rdfNodeNamespacePrefix' => 'r',
		'rdfPredicateNamespacePrefix' => '',
		'interwikiPrefix' => 'r'
	],
	'wikidata' => [
		'repoDatabase' => 'wikidata',
		'baseUri' => 'http://www.wikidata.org/entity',
		'entityNamespaces' => [
			'item' => 0,
			'property' => 120,
		],
		'rdfNodeNamespacePrefix' => 'd',
		'rdfPredicateNamespacePrefix' => '',
		'interwikiPrefix' => 'd'
	]
];

// $wgWBClientSettings['otherProjectsLinks'] = [ 'research', 'wikidata' ];

$wgWBRepoSettings['formatterUrlProperty'] = 'P26';
// $wgWBRepoSettings['propertyOrderUrl'] = $wgServer. $wgScriptPath . '/index.php?title=MediaWiki:Wikibase-SortedProperties&action=raw&sp_ver=1';

$wgWBRepoSettings['statementSections'] = [
	'item' => [
		'statements' => null,
		'guide' => [
			'propertyIds' => [ 'P27' ],  'type' => 'propertySet'
		]
		'events' => [
			'propertyIds' => [ 'P9', 'P10', 'P11', 'P12', 'P17' ],  'type' => 'propertySet'
		],
		'components' => [
			'propertyIds' => [ 'P6' ],  'type' => 'propertySet'
		],
		'bibliography' => [
			'propertyIds' => [ 'P2' ],  'type' => 'propertySet'
		]
	],
	'property' => [
		'statements' => null,
		'guide' => [
			'propertyIds' => [ 'P27' ],  'type' => 'propertySet'
		]
    ]
];

Allows sorting Properties into sections, etc.

Managing user rights

In some cases, an administrator user is created during installation. If that did not successfully happen, it can be fixed by opening up the user_groups table and issuing some SQL statements to grant user rights.

First, you may want to check which users exist:

sqlite> select * from user;
1|Reversedragon||(... very long hash)||||20250207194016|(... hash)||||20250207194015|1||0
2|MediaWiki default||||||20250207194015|*** INVALID ***||||20250207194015|0||0

Then take the user ID number from the first column to assign user rights:

$ sudo sqlite3 /path/to/databases/wikiname.sqlite
sqlite> INSERT INTO user_groups VALUES(1, 'sysop', NULL);
sqlite> INSERT INTO user_groups VALUES(1, 'bureaucrat', NULL);
sqlite> INSERT INTO user_groups VALUES(1, 'interface-admin', NULL);
sqlite> .save
sqlite> .quit