jenkins-bot has submitted this change and it was merged.

Change subject: Remove unused code and rename functions that were called "Local"
......................................................................


Remove unused code and rename functions that were called "Local"

In the past, functions were named with the word "Local" in them if it was
anticipated that we would need to write a separate function for global
deliveries. This is no longer true for some functions, which have been renamed.

getLocalTargets has been replaced by getParserFunctionTargets and is no longer
used at all, and can safely be removed.

Change-Id: I23f22a317060bd69110b2a3dda2de396bad65cf5
---
M MassMessageJob.php
M SpecialMassMessage.php
2 files changed, 8 insertions(+), 40 deletions(-)

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



diff --git a/MassMessageJob.php b/MassMessageJob.php
index 20de7b4..c5f7160 100644
--- a/MassMessageJob.php
+++ b/MassMessageJob.php
@@ -21,7 +21,7 @@
         * @return bool
         */
        public function run() {
-               $status = $this->sendLocalMessage();
+               $status = $this->sendMessage();
 
                if ( $status !== true ) {
                        $this->setLastError( $status );
@@ -69,12 +69,12 @@
        }
 
        /**
-        * Send a message to a user on the same wiki.
+        * Send a message to a user
         * Modified from the TranslationNotification extension
         *
         * @return bool
         */
-       function sendLocalMessage() {
+       function sendMessage() {
                $title = $this->normalizeTitle( $this->title );
                if ( $title === null ) {
                        return true; // Skip it
diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index ebf16b4..bdc5845 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -158,38 +158,6 @@
        }
 
        /**
-        * Get a list of pages to spam
-        *
-        * @param $spamlist Title
-        * @return Array
-        */
-       function getLocalTargets( $spamlist ) {
-               // Something.
-               global $wgNamespacesToExtractLinksFor, $wgNamespacesToConvert;
-               $dbr = wfGetDB( DB_SLAVE );
-               $res = $dbr->select(
-                       'pagelinks',
-                       array( 'pl_namespace', 'pl_title' ),
-                       array( 'pl_from' => $spamlist->getArticleID(), 
'pl_namespace' => $wgNamespacesToExtractLinksFor ),
-                       __METHOD__,
-                       array()
-               );
-               $pages = array();
-               foreach ( $res as $row ) {
-                       $ns = $row->pl_namespace;
-                       if ( isset( $wgNamespacesToConvert[$ns] ) ) {
-                               $ns = $wgNamespacesToConvert[$ns];
-                       }
-                       $title = Title::makeTitle( $ns, $row->pl_title );
-                       $title = MassMessage::followRedirect( $title );
-                       if ( $title !== null ) { // Skip interwiki redirects
-                               $pages[$title->getFullText()] = $title; // Use 
an assoc array to quickly and easily filter out duplicates
-                       }
-               }
-               return $pages;
-       }
-
-       /**
         * Log the spamming to Special:Log/massmessage
         *
         * @param $spamlist Title
@@ -240,7 +208,7 @@
         * @param $title string
         * @return Title|string string will be a error message key
         */
-       function getLocalSpamlist( $title ) {
+       function getSpamlist( $title ) {
                $spamlist = Title::newFromText( $title );
                if ( $spamlist === null || !$spamlist->exists() ) {
                        return 'massmessage-spamlist-doesnotexist' ;
@@ -267,7 +235,7 @@
 
                $this->isGlobal = isset( $data['global'] ) && $data['global']; 
// If the message delivery is global
 
-               $spamlist = $this->getLocalSpamlist( $data['spamlist'] );
+               $spamlist = $this->getSpamlist( $data['spamlist'] );
                if ( !( $spamlist instanceof Title ) ) {
                        $this->status->fatal( $spamlist );
                }
@@ -299,8 +267,8 @@
         */
        function preview( $data ) {
 
-               $spamlist = $this->getLocalSpamlist( $data['spamlist'] );
-               // $targets = $this->getLocalTargets( $spamlist );
+               $spamlist = $this->getSpamlist( $data['spamlist'] );
+               // $targets = $this->getParserFunctionTargets( $spamlist );
                // $firstTarget = array_values( $targets )[0]; // Why doesn't 
this work??
                $firstTarget = Title::newFromText( 'User talk:Example' );
                $article = Article::newFromTitle( $firstTarget, 
$this->getContext() );
@@ -341,7 +309,7 @@
         * @return Status
         */
        function submit( $data ) {
-               $spamlist = $this->getLocalSpamlist( $data['spamlist'] );
+               $spamlist = $this->getSpamlist( $data['spamlist'] );
 
                // Log it.
                $this->logToWiki( $spamlist, $data['subject'] );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23f22a317060bd69110b2a3dda2de396bad65cf5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to