Yaron Koren has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373168 )

Change subject: Replace deprecated UnknownAction with $wgActions
......................................................................


Replace deprecated UnknownAction with $wgActions

Change-Id: I3f8906335de314d1b57bc894c274bc0f09a41773
---
M Cargo.php
M CargoPageValuesAction.php
M CargoRecreateDataAction.php
M extension.json
4 files changed, 21 insertions(+), 33 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Cargo.php b/Cargo.php
index e5e5508..f99caea 100644
--- a/Cargo.php
+++ b/Cargo.php
@@ -56,9 +56,7 @@
 // 'SkinTemplateNavigation' replaced 'SkinTemplateTabs' in the Vector skin
 $wgHooks['SkinTemplateTabs'][] = 'CargoRecreateDataAction::displayTab';
 $wgHooks['SkinTemplateNavigation'][] = 'CargoRecreateDataAction::displayTab2';
-$wgHooks['UnknownAction'][] = 'CargoRecreateDataAction::show';
 $wgHooks['BaseTemplateToolbox'][] = 'CargoPageValuesAction::addLink';
-$wgHooks['UnknownAction'][] = 'CargoPageValuesAction::show';
 $wgHooks['SkinTemplateNavigation'][] = 'CargoHooks::addPurgeCacheTab';
 $wgHooks['PageForms::TemplateFieldStart'][] = 
'CargoHooks::addTemplateFieldStart';
 $wgHooks['PageForms::TemplateFieldEnd'][] = 'CargoHooks::addTemplateFieldEnd';
@@ -158,6 +156,10 @@
 $wgAutoloadClasses['CargoDrilldownHierarchy'] = $dir . 
'/drilldown/CargoDrilldownHierarchy.php';
 $wgSpecialPages['Drilldown'] = 'CargoDrilldown';
 
+// Actions
+$wgActions['recreatedata'] = 'CargoRecreateDataAction';
+$wgActions['pagevalues'] = 'CargoPageValuesAction';
+
 // User rights
 $wgAvailableRights[] = 'recreatecargodata';
 $wgGroupPermissions['sysop']['recreatecargodata'] = true;
diff --git a/CargoPageValuesAction.php b/CargoPageValuesAction.php
index fec6771..693943b 100644
--- a/CargoPageValuesAction.php
+++ b/CargoPageValuesAction.php
@@ -6,7 +6,7 @@
  * @ingroup Cargo
  */
 
-class CargoPageValuesAction {
+class CargoPageValuesAction extends Action {
        /**
         * Return the name of the action this object responds to
         * @return String lowercase
@@ -20,16 +20,10 @@
         * to the context output.
         * $this->getOutput(), etc.
         */
-       public static function show( $action, Article $article ) {
-               $title = $article->getTitle();
-
-               if ( $action == 'pagevalues' ) {
-                       $pageValuesPage = new CargoPageValues( $title );
-                       $pageValuesPage->execute();
-                       return false;
-               }
-
-               return true;
+       public function show() {
+               $title = $this->page->getTitle();
+               $pageValuesPage = new CargoPageValues( $title );
+               $pageValuesPage->execute();
        }
 
        /**
diff --git a/CargoRecreateDataAction.php b/CargoRecreateDataAction.php
index cbabf5e..be5a22f 100644
--- a/CargoRecreateDataAction.php
+++ b/CargoRecreateDataAction.php
@@ -16,16 +16,12 @@
        }
 
        /**
-        * The main action entry point. Do all output for display and send it 
to the context
-        * output.
+        * The main action entry point. Do all output for display and send it
+        * to the context output.
         * $this->getOutput(), etc.
-        *
-        * @param string $action
-        * @param Article $article
-        * @return boolean
         */
-       public static function show( $action, Article $article ) {
-               $title = $article->getTitle();
+       public function show() {
+               $title = $this->page->getTitle();
 
                // These tabs should only exist for template pages, that
                // either call (or called) #cargo_declare, or call
@@ -33,16 +29,12 @@
                list( $tableName, $isDeclared ) = 
CargoUtils::getTableNameForTemplate( $title );
 
                if ( $tableName == '' ) {
-                       return true;
+                       // @TODO - display an error message here.
+                       return;
                }
 
-               if ( $action == 'recreatedata' ) {
-                       $recreateDataPage = new CargoRecreateData( $title, 
$tableName, $isDeclared );
-                       $recreateDataPage->execute();
-                       return false;
-               }
-
-               return true;
+               $recreateDataPage = new CargoRecreateData( $title, $tableName, 
$isDeclared );
+               $recreateDataPage->execute();
        }
 
        /**
diff --git a/extension.json b/extension.json
index 442d6f6..c20b440 100755
--- a/extension.json
+++ b/extension.json
@@ -227,6 +227,10 @@
                "localBasePath": "",
                "remoteExtPath": "Cargo"
        },
+       "Actions": {
+               "recreatedata": "CargoRecreateDataAction",
+               "pagevalues": "CargoPageValuesAction"
+       },
        "Hooks": {
                "ParserFirstCallInit": [
                        "CargoHooks::registerParserFunctions"
@@ -259,10 +263,6 @@
                "SkinTemplateNavigation": [
                        "CargoRecreateDataAction::displayTab2",
                        "CargoHooks::addPurgeCacheTab"
-               ],
-               "UnknownAction": [
-                       "CargoRecreateDataAction::show",
-                       "CargoPageValuesAction::show"
                ],
                "BaseTemplateToolbox": [
                        "CargoPageValuesAction::addLink"

-- 
To view, visit https://gerrit.wikimedia.org/r/373168
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3f8906335de314d1b57bc894c274bc0f09a41773
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to