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

Change subject: Added lingo support for ApprovedRevs.
......................................................................


Added lingo support for ApprovedRevs.

To enable feature use '$wgexLingoEnableApprovedRevs = true;' in 
LocalSettings.php

Change-Id: I45bf91f4f5e76c78bf72164b0148e79418d7157d
---
M Lingo.php
M LingoBasicBackend.php
2 files changed, 28 insertions(+), 3 deletions(-)

Approvals:
  Foxtrott: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Lingo.php b/Lingo.php
index 4e29ab4..cc4d220 100644
--- a/Lingo.php
+++ b/Lingo.php
@@ -43,6 +43,9 @@
 // set default cache type (null = use main cache)
 $wgexLingoCacheType = null;
 
+// use ApprovedRevs extension
+$wgexLingoEnableApprovedRevs = false;
+
 // set extension credits
 // (no description here, will be set later)
 $wgExtensionCredits['parserhook']['lingo'] = array(
diff --git a/LingoBasicBackend.php b/LingoBasicBackend.php
index 6c1fba3..01de946 100644
--- a/LingoBasicBackend.php
+++ b/LingoBasicBackend.php
@@ -45,8 +45,7 @@
                        $content = $wgRequest->getVal( 'wpTextbox1' );
 
                } else {
-
-                       $rev = Revision::newFromTitle( $title );
+                       $rev = $this->getRevision( $title );
                        if ( !$rev ) {
                                $this->getMessageLog()->addWarning( 
wfMsgForContent( 'lingo-noterminologypage', $page ) );
                                return false;
@@ -115,7 +114,30 @@
 
                wfProfileOut( __METHOD__ );
                
-               return array_pop($ret);;
+               return array_pop($ret);
+       }
+
+       /**
+        * Returns revision of the terms page.
+        *
+        * @param Title $title
+        * @return Revision
+        */
+       public function getRevision( $title )
+       {
+               global $wgexLingoEnableApprovedRevs;
+
+               if ( $wgexLingoEnableApprovedRevs ) {
+
+                       if ( defined( 'APPROVED_REVS_VERSION' ) ) {
+                               $rev_id = ApprovedRevs::getApprovedRevID( 
$title );
+                               return Revision::newFromId( $rev_id );
+                       } else {
+                               wfDebug( 'Support for ApprovedRevs is enabled 
in Lingo. But ApprovedRevs was not found.\n' );
+                       }
+               }
+
+               return Revision::newFromTitle( $title );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I45bf91f4f5e76c78bf72164b0148e79418d7157d
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/Lingo
Gerrit-Branch: master
Gerrit-Owner: Euvl <[email protected]>
Gerrit-Reviewer: Euvl <[email protected]>
Gerrit-Reviewer: Foxtrott <[email protected]>
Gerrit-Reviewer: Yury Katkov <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to