Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/119501
Change subject: Add BC for obsolete action names
......................................................................
Add BC for obsolete action names
Change-Id: Ib21eb97d8c3448059eae0ca8314a211b9d240419
---
M includes/Block/Block.php
1 file changed, 21 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/01/119501/1
diff --git a/includes/Block/Block.php b/includes/Block/Block.php
index 9c8db62..cef5de2 100644
--- a/includes/Block/Block.php
+++ b/includes/Block/Block.php
@@ -100,13 +100,13 @@
//abstract public function commit();
public function init( $action, $user ) {
- $this->action = $action;
+ $this->action = $this->getActionName( $action );
$this->user = $user;
}
public function onSubmit( $action, User $user, array $data ) {
$section = new \ProfileSection( __METHOD__ );
- if ( false === array_search( $action,
$this->supportedPostActions ) ) {
+ if ( false === array_search( $this->getActionName( $action ),
$this->supportedPostActions ) ) {
return null;
}
@@ -120,7 +120,7 @@
public function onRender( $action, Templating $templating, array
$options ) {
$section = new \ProfileSection( __METHOD__ );
- if ( !in_array( $action, $this->supportedGetActions ) ) {
+ if ( !in_array( $this->getActionName( $action ),
$this->supportedGetActions ) ) {
return false;
}
@@ -195,6 +195,24 @@
}
/**
+ * Given a certain action name, this returns the valid action name.
This is
+ * meant for BC compatibility with renamed actions.
+ *
+ * @param string $action
+ * @return string
+ */
+ public function getActionName( $action ) {
+ // BC for renamed actions
+ $alias = Container::get( 'flow_actions' )->getValue( $action );
+ if ( is_string( $alias ) ) {
+ // All proper actions return arrays, but aliases return
a string
+ $action = $alias;
+ }
+
+ return $action;
+ }
+
+ /**
* Run through AbuseFilter and friends.
* @todo Having to call spamFilter in each place that creates a revision
* is error-prone.
--
To view, visit https://gerrit.wikimedia.org/r/119501
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib21eb97d8c3448059eae0ca8314a211b9d240419
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits