Extension:StructuredDiscussions

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
StructuredDiscussions

Release status:Extension status beta

2013-08-21 Flow prototype.png
ImplementationTemplate:Extension#type Page action
DescriptionTemplate:Extension#description Provides a discussion and collaboration system for talk pages
Author(s)Template:Extension#username Brandon Harris, Erik Bernhardson, Matthias Mullie, Andrew Garrett, Benny Situ, Shahyar Ghobadpour, Matthew Flaschen, Roan Kattouw, Moriel Schottlender, Stephane Bisson, Kunal Mehta
Latest versionTemplate:Extension#version 1.1
Compatibility policyCompatibility#mediawiki_extensions release branches
MediaWikiTemplate:Extension#mediawiki 1.27+ . StructuredDiscussions master is only supported with core's master; otherwise, use matching branches (e.g. StructuredDiscussions REL1_27 with core REL1_27, or matching WMF release branches).
PHPTemplate:Extension#php 5.4+
Database changesTemplate:Extension#needs-updatephp Yes
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ExampleTemplate:Extension#example Talk:Structured Discussions
Added rightsTemplate:Extension#rights
  • flow-hide
  • flow-edit-post
  • flow-create-board
  • flow-suppress
  • flow-delete
  • flow-lock
Hooks usedTemplate:Extension#hook
LoadExtensionSchemaUpdatesManual:Hooks/LoadExtensionSchemaUpdates
ApiTokensGetTokenTypesManual:Hooks/ApiTokensGetTokenTypes
MediaWikiPerformActionManual:Hooks/MediaWikiPerformAction
OldChangesListRecentChangesLineManual:Hooks/OldChangesListRecentChangesLine
SkinTemplateNavigation::UniversalManual:Hooks/SkinTemplateNavigation::Universal
Article::MissingArticleConditionsManual:Hooks/Article::MissingArticleConditions
SpecialWatchlistGetNonRevisionTypesManual:Hooks/SpecialWatchlistGetNonRevisionTypes
UserGetReservedNamesManual:Hooks/UserGetReservedNames
ResourceLoaderGetConfigVarsManual:Hooks/ResourceLoaderGetConfigVars
ContribsPager::reallyDoQueryManual:Hooks/ContribsPager::reallyDoQuery
ContributionsLineEndingManual:Hooks/ContributionsLineEnding
AbuseFilter-computeVariable
EnhancedChangesListModifyBlockLineDataManual:Hooks/EnhancedChangesListModifyBlockLineData
EnhancedChangesListModifyLineDataManual:Hooks/EnhancedChangesListModifyLineData
UnwatchArticleManual:Hooks/UnwatchArticle
NamespaceIsMovableManual:Hooks/NamespaceIsMovable

Translate the StructuredDiscussions extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The StructuredDiscussions extension provides a discussion and collaboration system for talk pages. This page covers how to install and administer Structured Discussions; for a guide to using it, see Help:Structured Discussions. You can try out Structured Discussions yourself at the Sandbox talk page.

The StructuredDiscussions extension was developed by the Collaboration team at the Wikimedia Foundation. It is still being maintained to fix bugs, but no substantial development on the extension has been done since 2015. Development may possibly start again in the future. For more information on the development status of this extension, as well as an overview of its design, see Structured Discussions.

Installing[edit]

Caution! Caution: This is in Beta and still under active development. Before starting, you should do a complete backup. You also may want to drop into #wikimedia-collaborationconnect to discuss before installing.

The easiest way to install StructuredDiscussions locally is to use the MediaWiki-Vagrant appliance and enable its flow role. This is only intended for development/local testing.

To install the extension manually:

  • Download and place the file(s) in a directory called Flow in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Flow' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.28 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.28 and earlier), instead of wfLoadExtension( 'Flow' );, you need to use:

require_once "$IP/extensions/Flow/Flow.php";

Note Note: You must run "update.php" as the web server user (depends on configuration, but could be e.g. www-data). Otherwise, it can leave temporary /tmp/mw-UIDGeneratorUUID-UID-xx files that MediaWiki may be unable to open (phab:T55791). If you get a "Permission denied" error upon first visiting a Flow board you have to delete these files. Also, update.php will create {{FlowMention}} to support Flow's mention feature in VE (either @ or a toolbar menu provides a convenient auto-complete interface for mentions).

If you install from git, you will also need to run "composer update".

Make sure you follow the full instructions for enabling or disabling Flow, including the scripts mentioned there.

Dependencies[edit]

  • required: Extension:Echo for notifications (e.g. replies to your post)
  • required: It is required to have an object cache. It is recommended that you use memcached for this. You may encounter problems with Redis currently.
  • required: Extension:ParserFunctions for the templates that are automatically installed (e.g. #time)
  • required: $wgContentHandlerUseDB. Required for Special:EnableFlow and to avoid corruption if you change the content model of namespaces (towards or away from StructuredDiscussions) if there are already pages in that namespace.
  • strongly recommended: Parsoid for the option to store posts as HTML ($wgFlowContentFormat = 'html';) which improves performance. This is how WMF wikis are configured, and hence is the most tested configuration by far. If you use MediaWiki-Vagrant, enabling StructuredDiscussions enables Parsoid and sets the format to 'html'.
  • optional: Extension:BetaFeatures if you want to use the opt-in beta feature for user talk.
  • optional: Extension:CLDR for human-friendly timestamps such as "3 days ago"
  • optional: Extension:VisualEditor for VisualEditor support ($wgFlowEditorList = array( 'visualeditor', 'none' );)
    bug? if you have the VisualEditor present (e.g. perhaps to provide OOjs UI),then StructuredDiscussions will attempt to contact Parsoid even if VE is not enabled
  • optional: StructuredDiscussions can integrate with Extension:AbuseFilter, Extension:SpamBlacklist, and Extension:ConfirmEdit, see /Spam
  • optional: StructuredDiscussions will integrate with Extension:CheckUser if you have it installed.
  • optional: Extension:Thanks to "Thank" users for their posts
  • optional: Extension:EventLogging for analytics

Only for REL_1_24[edit]

Verifying installation[edit]

Visit one of the pages you enabled for StructuredDiscussions (see #Configuration) and try adding a topic and editing its header.

Upgrading[edit]

The $wgFlowOccupyPages variable, which enumerated StructuredDiscussions boards, was removed as part of phab:T105574. Before upgrading to 1.26 or later, run the maintenance scripts:

php maintenance/populateContentModel.php --ns=all --table=page
php extensions/Flow/maintenance/FlowUpdateRevContentModelFromOccupyPages.php

The first script is part of MediaWiki core.

Configuration[edit]

Here are some settings you need to make in LocalSettings.php.

Enabling or disabling StructuredDiscussions[edit]

To enable or disable StructuredDiscussions for a namespace, first run populateContentModel.php on the affected namespaces (or you can do it on all). E.g. if you are about to enable or disable it on NS_TALK (1) and NS_USER_TALK (3) as shown in the PHP config below:

mwscript populateContentModel.php --wiki=somewiki --ns=1 --table=revision
mwscript populateContentModel.php --wiki=somewiki --ns=1 --table=archive
mwscript populateContentModel.php --wiki=somewiki --ns=1 --table=page

mwscript populateContentModel.php --wiki=somewiki --ns=3 --table=revision
mwscript populateContentModel.php --wiki=somewiki --ns=3 --table=archive
mwscript populateContentModel.php --wiki=somewiki --ns=3 --table=page

If mwscript is not configured, replace mwscript populateContentModel.php with php maintenance/populateContentModel.php

After the above, set $wgNamespaceContentModels[namespace] for particular namespaces. For example:

  // These lines enable StructuredDiscussions on the "Talk" and "User talk" namespaces
  // All the NS_* constants here: https://www.mediawiki.org/wiki/Manual:Namespace_constants
  
  $wgNamespaceContentModels[NS_TALK] = 'flow-board';
  $wgNamespaceContentModels[NS_USER_TALK] = 'flow-board';

Do not reassign the global ($wgNamespaceContentModels =).

To enable it on a single page, use Special:EnableFlow. This requires the flow-create-board right, which can be granted to any group (see Manual:User rights#Changing group permissions).

  $wgGroupPermissions['somegroup']['flow-create-board'] = true;

Parsoid configuration[edit]

StructuredDiscussions uses the Virtual REST Service to contact a Parsoid or RESTBase service. If your wiki loads the VisualEditor extension, then you've probably already set this up. Look for the following in your LocalSettings.php:

$wgVirtualRestConfig['modules']['parsoid'] = array(
  // URL to the Parsoid instance
  // Use port 8142 if you use the Debian package
  'url' => 'http://localhost:8000',
  // Parsoid "domain", see below (optional)
  'domain' => 'localhost',
  // Parsoid "prefix", see below (optional)
  'prefix' => 'localhost',
);

A single Parsoid server can handle multiple wikis. The Parsoid domain setting identifies your wiki configuration to Parsoid. By default it is set to the hostname named by $wgCanonicalServer, but you can pick an arbitrary string. Older versions of Parsoid also used a unique "prefix" to identify the server; you may need to list that here as well.

Parsoid must have been configured to match, using a line in Parsoid's localsettings.js like:

parsoidConfig.setMwApi({ uri: 'http://path/to/my/wiki/api.php', domain: 'localhost', prefix: 'localhost' });

Again, the "domain" property is optional in the Parsoid configuration; it defaults to the hostname used in the uri property if not specified. The "prefix" property can also be omitted unless you are running an older version of Parsoid. Make sure the domain and prefix listed in Parsoid's localsettings.js match what's in your wiki's LocalSettings.php.

See Parsoid/Setup#Configuration for more details.

"maximum function nesting level of '100' reached, aborting"[edit]

If you get this error, you need to set xdebug.max_nesting_level = 200, probably in /etc/php5/apache2/php.ini .[1]

"Exception Caught: CAS is not implemented in Xyz"[edit]

StructuredDiscussions invokes $cache->cas() and some cache implementations including CACHE_ACCEL (APCBagOStuff) don't implement CAS. You probably need to use a different cache, for example install memcached and set $wgMainCacheType = CACHE_MEMCACHED;.

Permissions[edit]

Users must have the core edit permission to perform any write action in StructuredDiscussions. Many wikis only grant this permission to the 'user' (logged-in) or 'autoconfirmed' group.

StructuredDiscussions defines many actions such as edit-post and delete-topic (see the list in FlowActions.php). The permissions vary depending on whether the post is your own and whether it has been moderated. For example, by default users can edit their own posts, but only users in the 'sysop' group have the flow-edit-post permission to edit anyone's post. You can override which groups have which permissions and what permissions are required for each Flow action; see Manual:User rights for an overview of permissions.

Migrating existing pages[edit]

To migrate a single existing page, use Special:EnableFlow. It will handle archiving of a single page (then enabling StructuredDiscussions) automatically.

The script maintenance/convertNamespaceFromWikitext.php automates this namespace conversion and archiving, see Flow/Converting talk pages. It is somewhat WMF-specific, so evaluate its operation and backup your database before running it. Another script maintenance/convertLqt.php converts LiquidThreads pages and their threads to Flow boards and topics, see Flow/Converting LiquidThreads. Similar caveats apply.

Flow adds a Topic: namespace, see Extension default namespaces#Flow. You can visit Special:PrefixIndex/Topic: to see if there are existing pages that conflict with this; if so run the maintenance script maintenance/namespaceDupes.php.

Configuration[edit]

Configuration settings in Flow.php
parameter default comment
$wgFlowHelpPage //www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Flow URL for more information about the Flow notification system
$wgFlowCluster false $wgFlowCluster will define what external DB server should be used.

If set to false, the current database (wfGetDB) will be used to read/write data from/to. If StructuredDiscussions data is supposed to be stored on an external database, set the value of this variable to the $wgExternalServers key representing that external connection.

$wgFlowDefaultWikiDb false Database to use for StructuredDiscussions metadata. Set to false to use the wiki db.

Any number of wikis can and should share the same StructuredDiscussions database.

$wgFlowExternalStore false Used for content storage. False to store content in StructuredDiscussions db. Otherwise a cluster or list of clusters to use with ExternalStore. Provided clusters must exist $wgExternalStores.

Multiple clusters required for HA, so inserts can continue if one of the masters is down for maint or any other reason.

$wgFlowExternalStore = array( 'DB://cluster24', 'DB://cluster25' );

$wgFlowContentFormat html By default, StructuredDiscussions will store content in HTML. However, this requires having Parsoid up and running, as it'll be necessary to convert HTML to wikitext for the basic editor. (n.b. to use VisualEditor, you'll definitely need Parsoid, so if you do support VE, might as well set this to HTML right away)

If $wgFlowParsoidURL is null, $wgFlowContentFormat will be forced to wikitext.

The 'wikitext' format is likely to be deprecated in the future.

$wgFlowParsoidURL null
Warning Warning: Deprecated. Use $wgVirtualRestConfig['modules']['parsoid']['url'].

StructuredDiscussions Parsoid config

Please note that this configuration is separate from VE's Parsoid config.

$wgFlowParsoidPrefix null
Warning Warning: Deprecated. Use $wgVirtualRestConfig['modules']['parsoid']['prefix'].

Flow Parsoid config

Please note that this configuration is separate from VE's Parsoid config.

$wgFlowParsoidTimeout null
Warning Warning: Deprecated. Use $wgVirtualRestConfig['modules']['parsoid']['timeout'].

Flow Parsoid config

Please note that this configuration is separate from VE's Parsoid config.

$wgFlowParsoidForwardCookies false
Warning Warning: Deprecated. Use $wgVirtualRestConfig['modules']['parsoid']['forwardCookies'].

Forward users' Cookie: headers to Parsoid. Required for private wikis (login required to read).

If the wiki is not private (i.e. $wgGroupPermissions['*']['read'] is true) this configuration variable will be ignored.

This feature requires a non-locking session store. The default session store will not work and will cause deadlocks when trying to use this feature. If you experience deadlock issues, enable $wgSessionsInObjectCache.

WARNING: ONLY enable this on private wikis and ONLY IF you understand the SECURITY IMPLICATIONS of sending Cookie headers to Parsoid over HTTP. For security reasons, it is strongly recommended that $wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] be pointed to localhost if this setting is enabled.

$wgFlowDefaultWorkflow discussion When visiting the StructuredDiscussions for an article but not specifying what type of workflow should be viewed, use this workflow
$wgFlowDefaultLimit 10 Limits for paging
$wgFlowMaxLimit 100 Limits for paging
$wgFlowMaxMentionCount 100 Maximum number of users that can be mentioned in one comment
$wgFlowMaxThreadingDepth 8 Max threading depth
$wgFlowEditorList array( 'visualeditor', 'wikitext' ); A list of editors to use, in priority order. Non-supported editors will be skipped.
$wgFlowUseMemcache true Set this to false to disable all memcache usage. Do not just turn the cache back on, it will be out of sync with the database. There is not yet an official process for re-sync'ing the cache yet, currently the per-index versions would need to incremented(ask the flow team).

This will reduce, but not necessarily kill, performance. The queries issued will be the queries necessary to fill the cache rather than only the queries needed to answer the request. A bit of a refactor in ObjectManager::findMulti to allow query without indexes, along with adjusting container.php to only include the indexes when this is true, would get most of the way towards making this a reasonably performant option.

$wgFlowCacheTime 60 * 60 * 24 * 3 The default length of time to cache StructuredDiscussions data in memcache. This value can be tuned in conjunction with measurements of cache hit/miss ratios to achieve the desired tradeoff between memory usage, db queries, and response time. The initial default of 3 days means StructuredDiscussions will attempt to keep in memcache all data models requested in the last 3 days.
$wgFlowCacheVersion 4.7 A version string appended to cache keys. Bump this if cache format or logic changes. StructuredDiscussions can be a cross-wiki database accessed by wikis running different versions of the Flow code; WMF sometimes overrides this globally in wmf-config/CommonSettings.php
$wgFlowSearchServers array( 'localhost' ) ElasticSearch servers
$wgFlowSearchConnectionAttempts 1 // see $wgCirrusSearchConnectionAttempts StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchBannedPlugins array() // see $wgCirrusSearchBannedPlugins Flow search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchOptimizeIndexForExperimentalHighlighter false // see $wgCirrusSearchOptimizeIndexForExperimentalHighlighter StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchMaxShardsPerNode array() // see $wgCirrusSearchMaxShardsPerNode StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchRefreshInterval 1 // see $wgCirrusSearchRefreshInterval StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchMaintenanceTimeout 3600 // see $wgCirrusSearchMaintenanceTimeout StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchReplicas '0-2' // see $wgCirrusSearchReplicas StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchShardCount array( 'flow' => 4 ) // see $wgCirrusSearchShardCount StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchCacheWarmers array() // see $wgCirrusSearchCacheWarmers StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchMergeSettings
$wgFlowSearchMergeSettings = array(
	'flow' => array(
		'max_merge_at_once' => 10,
		'segments_per_tier' => 10,
		'reclaim_deletes_weight' => 2.0,
		'max_merged_segment' => '5g',
	),
);
// see $wgCirrusSearchMergeSettings
StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchIndexAllocation
$wgFlowSearchIndexAllocation = array(
	'include' => array(),
	'exclude' => array(),
	'require' => array(),
);
// see $wgCirrusSearchIndexAllocation
StructuredDiscussions search config setting - akin to CirrusSearch

See CirrusSearch.php for documentation for these params, which have similar

variable names (s/FlowSearch/CirrusSearch/)

$wgFlowSearchEnabled false This allows running StructuredDiscussions without the search functionality. Right now, it's because the search functionality isn't ready for production, but we need to test it locally. We can decide later (after it's in production) whether to get rid of this setting. For example, this controls whether ApiFlowSearch is available.
$wgFlowAbuseFilterGroup 'flow' Custom group name for AbuseFilter

Acceptable values:

  • a specific value for flow-specific filters
  • 'default' to use core filters; make sure they are compatible with both core and StructuredDiscussions (e.g. StructuredDiscussions has no 'summary' variable to test on)
  • false to not use AbuseFilter
$wgFlowAbuseFilterEmergencyDisableThreshold 0.10 AbuseFilter emergency disable values for StructuredDiscussions
$wgFlowAbuseFilterEmergencyDisableCount 50 AbuseFilter emergency disable values for StructuredDiscussions
$wgFlowAbuseFilterEmergencyDisableAge 86400 // One day. AbuseFilter emergency disable values for StructuredDiscussions
$wgFlowAjaxTimeout 30 Timeout for StructuredDiscussions's AJAX requests (only affects ones that go through flow-api.js), in seconds
$wgFlowCoreActionWhitelist array( 'info', 'protect', 'unprotect', 'unwatch', 'watch', 'history', 'wikilove', 'move', 'delete' ); Actions that must pass through to MediaWiki on StructuredDiscussions-enabled pages
$wgFlowServerCompileTemplates false When set to true StructuredDiscussions will compile templates into their intermediate forms on every run. When set to false Flow will use the versions already written to disk. Production should always have this set to false.
$wgFlowEventLogging false Enable/disable event logging

System messages[edit]

Using the "Source editing" option on StructuredDiscussions boards makes visible the help text "Wikitext uses markup and you can preview the result anytime.". The "uses markup" part is linked through the system message MediaWiki:Flow-wikitext-editor-help-uses-wikitext which makes use of an interwiki link to MediaWiki.org.

In some cases, this interwiki link, instead of pointing to Help:Formatting on MediaWiki.org, points to a (usually non-existent) Help:Formatting page on the host Wiki. This can be corrected by changing the interwiki link on MediaWiki:Flow-wikitext-editor-help-uses-wikitext to an external link such as

[https://www.mediawiki.org/wiki/Help:Formatting uses markup].

Architecture[edit]

See Flow/Architecture.

Spam[edit]

See Extension:StructuredDiscussions/Spam for more information on how to fight spam in Flow.

Moderation[edit]

See Extension:StructuredDiscussions/Moderation for more information on moderation in Flow.