mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-30 19:16:39 +00:00
Merge "Add config option to enable/disable permalinks backend"
This commit is contained in:
commit
5d965ad9db
|
@ -620,6 +620,10 @@
|
||||||
"value": "default",
|
"value": "default",
|
||||||
"description": "Override availability of DiscussionTools visual enhancements's reply buttons sub-feature. 'default', 'available', or 'unavailable'."
|
"description": "Override availability of DiscussionTools visual enhancements's reply buttons sub-feature. 'default', 'available', or 'unavailable'."
|
||||||
},
|
},
|
||||||
|
"DiscussionToolsEnablePermalinksBackend": {
|
||||||
|
"value": true,
|
||||||
|
"description": "Enable the permalinks backend. Do not enable this unless the database tables exist."
|
||||||
|
},
|
||||||
"DiscussionToolsAutoTopicSubEditor": {
|
"DiscussionToolsAutoTopicSubEditor": {
|
||||||
"value": "discussiontoolsapi",
|
"value": "discussiontoolsapi",
|
||||||
"description": "Editor which triggers automatic topic subscriptions. Either 'discussiontoolsapi' for edits made using DiscussionTools' API (e.g. reply and new topic tools), or 'any' for any editor."
|
"description": "Editor which triggers automatic topic subscriptions. Either 'discussiontoolsapi' for edits made using DiscussionTools' API (e.g. reply and new topic tools), or 'any' for any editor."
|
||||||
|
|
|
@ -16,9 +16,9 @@ use MWTimestamp;
|
||||||
use ReadOnlyMode;
|
use ReadOnlyMode;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use TitleFormatter;
|
use TitleFormatter;
|
||||||
|
use Wikimedia\Rdbms\IDatabase;
|
||||||
use Wikimedia\Rdbms\ILBFactory;
|
use Wikimedia\Rdbms\ILBFactory;
|
||||||
use Wikimedia\Rdbms\ILoadBalancer;
|
use Wikimedia\Rdbms\ILoadBalancer;
|
||||||
use Wikimedia\Rdbms\IMaintainableDatabase;
|
|
||||||
use Wikimedia\Rdbms\IResultWrapper;
|
use Wikimedia\Rdbms\IResultWrapper;
|
||||||
use Wikimedia\Rdbms\SelectQueryBuilder;
|
use Wikimedia\Rdbms\SelectQueryBuilder;
|
||||||
|
|
||||||
|
@ -81,19 +81,16 @@ class ThreadItemStore {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function isDisabled(): bool {
|
private function isDisabled(): bool {
|
||||||
static $tablesCreated = null;
|
$dtConfig = $this->configFactory->makeConfig( 'discussiontools' );
|
||||||
if ( $tablesCreated === null ) {
|
return !$dtConfig->get( 'DiscussionToolsEnablePermalinksBackend' );
|
||||||
$tablesCreated = $this->getConnectionRef( DB_REPLICA )->tableExists( 'discussiontools_items', __METHOD__ );
|
|
||||||
}
|
|
||||||
return !$tablesCreated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $dbIndex DB_PRIMARY or DB_REPLICA
|
* @param int $dbIndex DB_PRIMARY or DB_REPLICA
|
||||||
*
|
*
|
||||||
* @return IMaintainableDatabase
|
* @return IDatabase
|
||||||
*/
|
*/
|
||||||
private function getConnectionRef( int $dbIndex ): IMaintainableDatabase {
|
private function getConnectionRef( int $dbIndex ): IDatabase {
|
||||||
return $this->loadBalancer->getConnectionRef( $dbIndex, [ 'watchlist' ] );
|
return $this->loadBalancer->getConnectionRef( $dbIndex, [ 'watchlist' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue