summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2022-10-12 11:26:51 -0400
committerBrian Evans <grknight@gentoo.org>2022-10-12 11:26:51 -0400
commit2245dd18c15e46985ecbed0a0171527835c18ed5 (patch)
tree9088838959eec09ad68c1f9d13bb1b9175134154
parentUpdate CommentStreams to version 7.2 (diff)
downloadextensions-2245dd18c15e46985ecbed0a0171527835c18ed5.tar.gz
extensions-2245dd18c15e46985ecbed0a0171527835c18ed5.tar.bz2
extensions-2245dd18c15e46985ecbed0a0171527835c18ed5.zip
Fix CommentStreams error using REL1_37 commits
Signed-off-by: Brian Evans <grknight@gentoo.org>
-rw-r--r--CommentStreams/extension.json7
-rw-r--r--CommentStreams/includes/AbstractComment.php5
-rw-r--r--CommentStreams/includes/MainHooks.php12
-rw-r--r--CommentStreams/includes/NoServiceHooks.php (renamed from CommentStreams/includes/SchemaHooks.php)16
4 files changed, 23 insertions, 17 deletions
diff --git a/CommentStreams/extension.json b/CommentStreams/extension.json
index fba324c9..76597a01 100644
--- a/CommentStreams/extension.json
+++ b/CommentStreams/extension.json
@@ -220,8 +220,8 @@
"PermissionManager"
]
},
- "schema": {
- "class": "MediaWiki\\Extension\\CommentStreams\\SchemaHooks"
+ "noservice": {
+ "class": "MediaWiki\\Extension\\CommentStreams\\NoServiceHooks"
}
},
"Hooks": {
@@ -235,7 +235,8 @@
"XmlDumpWriterOpenPage": "main",
"ImportHandlePageXMLTag": "main",
"AfterImportPage": "main",
- "LoadExtensionSchemaUpdates": "schema",
+ "CanonicalNamespaces": "noservice",
+ "LoadExtensionSchemaUpdates": "noservice",
"BeforeCreateEchoEvent": "MediaWiki\\Extension\\CommentStreams\\EchoInterface::onBeforeCreateEchoEvent",
"SMW::Property::initProperties": "MediaWiki\\Extension\\CommentStreams\\SMWHooks::initProperties",
"SMWStore::updateDataBefore": "MediaWiki\\Extension\\CommentStreams\\SMWHooks::updateData",
diff --git a/CommentStreams/includes/AbstractComment.php b/CommentStreams/includes/AbstractComment.php
index 9938f52c..c6637cc1 100644
--- a/CommentStreams/includes/AbstractComment.php
+++ b/CommentStreams/includes/AbstractComment.php
@@ -280,7 +280,10 @@ abstract class AbstractComment {
* @return ?string
*/
public function getModificationDate( User $user ): ?string {
- $this->modificationTimestamp->offsetForUser( $user );
+ if ( $this->modificationTimestamp ) {
+ $this->modificationTimestamp->offsetForUser( $user );
+ }
+
return $this->modificationTimestamp ?
$this->modificationTimestamp->format( "M j \a\\t g:i a" ) : null;
}
diff --git a/CommentStreams/includes/MainHooks.php b/CommentStreams/includes/MainHooks.php
index 4cf26aae..ffa0a42a 100644
--- a/CommentStreams/includes/MainHooks.php
+++ b/CommentStreams/includes/MainHooks.php
@@ -27,7 +27,6 @@ use HtmlArmor;
use MediaWiki;
use MediaWiki\Hook\AfterImportPageHook;
use MediaWiki\Hook\BeforePageDisplayHook;
-use MediaWiki\Hook\CanonicalNamespacesHook;
use MediaWiki\Hook\ImportHandlePageXMLTagHook;
use MediaWiki\Hook\MediaWikiPerformActionHook;
use MediaWiki\Hook\MovePageIsValidMoveHook;
@@ -58,7 +57,6 @@ use XmlDumpWriter;
use XMLReader;
class MainHooks implements
- CanonicalNamespacesHook,
MediaWikiPerformActionHook,
MovePageIsValidMoveHook,
GetUserPermissionsErrorsHook,
@@ -124,16 +122,6 @@ class MainHooks implements
}
/**
- * Adds CommentStreams namespaces.
- *
- * @param string[] &$namespaces Array of namespace numbers with corresponding canonical names
- */
- public function onCanonicalNamespaces( &$namespaces ) {
- $namespaces[NS_COMMENTSTREAMS] = 'CommentStreams';
- $namespaces[NS_COMMENTSTREAMS_TALK] = 'CommentStreams_Talk';
- }
-
- /**
* Prevents comment pages from being edited or deleted. Displays
* comment title and link to associated page when comment is viewed.
*
diff --git a/CommentStreams/includes/SchemaHooks.php b/CommentStreams/includes/NoServiceHooks.php
index 61ef027a..d2553e85 100644
--- a/CommentStreams/includes/SchemaHooks.php
+++ b/CommentStreams/includes/NoServiceHooks.php
@@ -22,9 +22,23 @@
namespace MediaWiki\Extension\CommentStreams;
use DatabaseUpdater;
+use MediaWiki\Hook\CanonicalNamespacesHook;
use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
-class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
+class NoServiceHooks implements
+ CanonicalNamespacesHook,
+ LoadExtensionSchemaUpdatesHook
+{
+ /**
+ * Adds CommentStreams namespaces.
+ *
+ * @param string[] &$namespaces Array of namespace numbers with corresponding canonical names
+ */
+ public function onCanonicalNamespaces( &$namespaces ) {
+ $namespaces[NS_COMMENTSTREAMS] = 'CommentStreams';
+ $namespaces[NS_COMMENTSTREAMS_TALK] = 'CommentStreams_Talk';
+ }
+
/**
* Updates database schema.
*