Jump to content

User:CFeng (WMF)/MachineVisionSetup/LocalSettings.php

From mediawiki.org
<?php
	require_once __DIR__ . '/.docker/LocalSettings.php';
	
	wfLoadSkin( 'Vector' );
	
	wfLoadExtension( 'CirrusSearch' );
	wfLoadExtension( 'Elastica' );
	wfLoadExtension( 'MachineVision' );
	wfLoadExtension( 'UniversalLanguageSelector' );
	wfLoadExtension( 'UploadWizard' );
	wfLoadExtension( 'WikibaseCirrusSearch' );
	wfLoadExtension( 'WikibaseMediaInfo' );
	wfLoadExtension( 'WikimediaEditorTasks' );
	
	// General
	
	$wgEnableUploads = true;
	$wgUseImageMagick = true;
	$wgScribuntoDefaultEngine = 'luastandalone';
	$wgMediaViewerEnableByDefault = true;
	$wgPFEnableStringFunctions = true;
	$wgApiFrameOptions = 'SAMEORIGIN';
	$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";
	
	// CirrusSearch
	
	$wgCirrusSearchServers = [ "elasticsearch.svc" ];
	$wgSearchType = "CirrusSearch";
	
	// EventLogging
	
	$wgEventLoggingBaseUri = 'http://localhost:8100/event.gif';
	
	// Wikibase
	
	$wgEnableWikibaseRepo = true;
	$wgEnableWikibaseClient = true;
	require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
	require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
	require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
	require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
	
	// WikibaseMediaInfo
	
	$wgMediaInfoEnableFilePageDepicts = true;
	$wgMediaInfoEnableSearch = true;
	$wgMediaInfoShowQualifiers = true;
	$wgMediaInfoEnableOtherDatatypes = true;
	$wgMediaInfoProperties = ['depicts' => 'P1'];
	
	$wgUploadWizardConfig[ 'wikibase' ][ 'enabled' ] = true;
	$wgUploadWizardConfig[ 'wikibase' ][ 'captions' ] = true;
	$wgUploadWizardConfig[ 'wikibase' ][ 'depicts' ] = true;
	
	$wgMediaInfoSupportedDataTypes = [
		'wikibase-item',
		'quantity'
	];
	
	// WikimediaEditorTasks
	
	$wgWikimediaEditorTasksEnableEditStreaks = true;
	$wgWikimediaEditorTasksEnableRevertCounts = true;
	
	$wgWikimediaEditorTasksEnabledCounters = [
		[
			'class' => 'MediaWiki\\Extension\\WikimediaEditorTasks\\WikipediaAppDescriptionEditCounter',
			'counter_key' => 'app_description_edits',
		],
		[
			'class' => 'MediaWiki\\Extension\\WikimediaEditorTasks\\WikipediaAppCaptionEditCounter',
			'counter_key' => 'app_caption_edits',
		],
		[
			'class' => 'MediaWiki\\Extension\\WikimediaEditorTasks\\WikipediaAppImageDepictsEditCounter',
			'counter_key' => 'app_depicts_edits',
		],
	];
	
	// MachineVision
	
	$wgMachineVisionRequestLabelsOnUploadComplete = true;
	$wgMachineVisionGCVSendFileContents = true;
	$wgMachineVisionRequestLabelsFromWikidataPublicApi = true;
	$wgMachineVisionShowUploadWizardCallToAction = true;
	
	$wgMachineVisionGoogleCredentialsFileLocation = '/var/www/mediawiki/machine-vision-credentials.json';
	
	$wgMachineVisionHandlers['google'] = [
		'class' => 'MediaWiki\\Extension\\MachineVision\\Handler\\GoogleCloudVisionHandler',
		'services' => [
			'MachineVisionFetchGoogleCloudVisionAnnotationsJobFactory',
			'MachineVisionRepository',
			'MachineVisionRepoGroup',
			'MachineVisionLabelResolver',
		],
	];
	
	$wgMachineVisionGoogleSafeSearchLimits = [
		'adult' => 3,
		'medical' => 3,
		'violent' => 4,
		'racy' => 4,
	];
	
	$wgMachineVisionTemplateBlacklist = [
		'Template:Artwork',
	];