EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/160191
Change subject: Hygiene: Various small cleanups
......................................................................
Hygiene: Various small cleanups
* Add some missing properties to Pager
* Remove unused Pager::getDefaultDirection and Pager::{g,s}etDefaultLimit
methods
* Correct the return phpdoc on Index::getSort to match implementation
* Fix incorrect or partial docblock in TopicBlock
* Remove unused class alias's in a few files
Change-Id: I54a813b9ad1a0a5c9aa1abfb527184d9745b4794
---
M includes/Actions/Action.php
M includes/Block/Topic.php
M includes/Block/TopicList.php
M includes/Data/Index.php
M includes/Data/NotificationListener.php
M includes/Data/Pager.php
M includes/Data/WatchTopicListener.php
M includes/Model/Anchor.php
M includes/Notifications/Formatter.php
M includes/Parsoid/ReferenceExtractor.php
M includes/View.php
11 files changed, 27 insertions(+), 39 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/91/160191/1
diff --git a/includes/Actions/Action.php b/includes/Actions/Action.php
index 421f6cc..eb7e865 100644
--- a/includes/Actions/Action.php
+++ b/includes/Actions/Action.php
@@ -10,11 +10,9 @@
use Flow\Exception\InvalidInputException;
use Flow\Model\UUID;
use Flow\View;
-use DerivativeContext;
use IContextSource;
use OutputPage;
use Page;
-use RequestContext;
use Title;
use WebRequest;
use WikiPage;
diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index fe104d7..9d66468 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -16,7 +16,6 @@
use Flow\Model\PostRevision;
use Flow\Model\UUID;
use Flow\Model\Workflow;
-use Flow\NotificationController;
use Flow\Parsoid\Utils;
use Flow\RevisionActionPermissions;
use Flow\Templating;
@@ -651,8 +650,10 @@
/**
* Process the history result for either topic or post
- * @param FormatterRow
- * @param array
+ *
+ * @param FormatterRow $found
+ * @param array $options
+ * @return array
*/
protected function processHistoryResult( $found, $options ) {
$serializer = $this->getRevisionFormatter();
diff --git a/includes/Block/TopicList.php b/includes/Block/TopicList.php
index d707094..8733071 100644
--- a/includes/Block/TopicList.php
+++ b/includes/Block/TopicList.php
@@ -3,7 +3,6 @@
namespace Flow\Block;
use Flow\Container;
-use Flow\Data\ManagerGroup;
use Flow\Data\Pager;
use Flow\Data\PagerPage;
use Flow\Model\PostRevision;
@@ -303,7 +302,8 @@
public function setPageTitle( Templating $templating, \OutputPage $out
) {
if ( $this->action !== 'new-topic' ) {
// Only new-topic should override page title, rest
should default
- return parent::setPageTitle( $templating, $out );
+ parent::setPageTitle( $templating, $out );
+ return;
}
$title = $this->workflow->getOwnerTitle();
diff --git a/includes/Data/Index.php b/includes/Data/Index.php
index 5d172d7..439cb0d 100644
--- a/includes/Data/Index.php
+++ b/includes/Data/Index.php
@@ -57,7 +57,7 @@
function getLimit();
/**
- * @return string Sorting order, either 'ASC' or 'DESC'
+ * @return array|false Sorting order, either 'ASC' or 'DESC'
*/
function getSort();
diff --git a/includes/Data/NotificationListener.php
b/includes/Data/NotificationListener.php
index 6e98248..26df459 100644
--- a/includes/Data/NotificationListener.php
+++ b/includes/Data/NotificationListener.php
@@ -4,7 +4,6 @@
use Flow\Model\AbstractRevision;
use Flow\NotificationController;
-use User;
class NotificationListener implements LifecycleHandler {
diff --git a/includes/Data/Pager.php b/includes/Data/Pager.php
index 11dce11..1ed436c 100644
--- a/includes/Data/Pager.php
+++ b/includes/Data/Pager.php
@@ -19,9 +19,19 @@
protected $index;
/**
- * @var integer
+ * @var array Results sorted by the values in this array
*/
- protected $defaultLimit = 5;
+ protected $sort;
+
+ /**
+ * @var array Map of column name to column value for equality query
+ */
+ protected $query;
+
+ /**
+ * @var array Options effecting the result such as `sort`, `order`, and
`pager-limit`
+ */
+ protected $options;
public function __construct( ObjectManager $storage, array $query,
array $options ) {
// not sure i like this
@@ -66,27 +76,6 @@
} else {
return $this->processPage( $direction, $offset,
$pageLimit, $results );
}
- }
-
- /**
- * @return integer
- */
- public function getDefaultLimit() {
- return $this->defaultLimit;
- }
-
- /**
- * @param integer $newLimit
- */
- public function setDefaultLimit( $newLimit ) {
- $this->defaultLimit = $newLimit;
- }
-
- /**
- * @return string
- */
- protected function getDefaultDirection() {
- return 'fwd';
}
/**
diff --git a/includes/Data/WatchTopicListener.php
b/includes/Data/WatchTopicListener.php
index 02bc7b3..5efdeab 100644
--- a/includes/Data/WatchTopicListener.php
+++ b/includes/Data/WatchTopicListener.php
@@ -8,7 +8,6 @@
use Flow\Model\PostRevision;
use Flow\Model\Workflow;
use Flow\WatchedTopicItems;
-use JobQueueGroup;
use Title;
use User;
use WatchedItem;
diff --git a/includes/Model/Anchor.php b/includes/Model/Anchor.php
index 70381ac..d19b655 100644
--- a/includes/Model/Anchor.php
+++ b/includes/Model/Anchor.php
@@ -111,7 +111,14 @@
$this->message = $message;
} else {
// wrap non-messages into a message class
- $this->message = new RawMessage( '$1', array( $message
) );
+ $this->message = new RawMessage(
+ '$1',
+ // rawParam + htmlspecialchars ensures this
wont be treated as wikitext
+ // if the message gets parsed and that its
still safe for html output.
+ // NOTE: This can result in double encoding,
prefer to use explicit messages
+ // instead of this fallback.
+ array( Message::rawParam( htmlspecialchars(
$message ) ) )
+ );
}
}
}
diff --git a/includes/Notifications/Formatter.php
b/includes/Notifications/Formatter.php
index c920709..309d5d1 100644
--- a/includes/Notifications/Formatter.php
+++ b/includes/Notifications/Formatter.php
@@ -109,7 +109,6 @@
*/
protected function getLinkParams( $event, $user, $destination ) {
$anchor = null;
- $title = $event->getTitle();
// Unfortunately this is not a Flow code path, so we have to
reach
// into global state.
diff --git a/includes/Parsoid/ReferenceExtractor.php
b/includes/Parsoid/ReferenceExtractor.php
index e200b6d..d72253a 100644
--- a/includes/Parsoid/ReferenceExtractor.php
+++ b/includes/Parsoid/ReferenceExtractor.php
@@ -3,10 +3,7 @@
namespace Flow\Parsoid;
use DOMXPath;
-use Flow\Exception\InvalidInputException;
-use Flow\Model\URLReference;
use Flow\Model\UUID;
-use Flow\Model\WikiReference;
use Flow\Model\Workflow;
use MWException;
diff --git a/includes/View.php b/includes/View.php
index 5e748e5..28596ec 100644
--- a/includes/View.php
+++ b/includes/View.php
@@ -7,7 +7,6 @@
use Flow\Model\Workflow;
use Html;
use IContextSource;
-use Linker;
use Message;
use ContextSource;
--
To view, visit https://gerrit.wikimedia.org/r/160191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54a813b9ad1a0a5c9aa1abfb527184d9745b4794
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits