Extension talk:Approved Revs

Approved revs+ Translate extension=not working?
Hi, I am using Mediaiwki ver 1.19.2 with both Approved revs and Translate extension installed. I am having problem that unapproved changes are being published. All changes made on source page are being published regardless if its approved or not. It seems like Translate extension "blocks" Approved revs functionality. Anyone having the same problem? Can you use these two extensions together?


 * Do things definitely work correctly if the Translate extension is temporarily un-installed? Yaron Koren (talk) 17:35, 22 January 2013 (UTC)


 * After a lot of testing I come to this conlusion:

If adding Semantic Bundle require_once.. etc -statements for Approved revs before Translate-extension in my Localsettings.php the approve function is blocked out somehow and always shows latest revision even if not approved. If adding Translate first and Approved revs after the function "mark this page for translation" is blocked out on page. But approved version is working. So there is some kind of mismatching :/


 * Alright. But to re-ask my question: does Approved Revs work for you if Translate is not there? Yaron Koren (talk) 14:01, 24 January 2013 (UTC)

-Yes, only a problem when together with Translate.


 * Okay - and are you using the latest versions of both Approved Revs and Translate? Yaron Koren (talk) 15:47, 25 January 2013 (UTC)

Wrong page cached when saves made (1.19+)
I encountered what appears to be a bug when using ApprovedRevs in 1.19+.

When you save a page, the *APPROVED* page is the one that is cached for the current revision, instead of the current revision. This results in any attempt to view the current revision as seing the approved revision. Very confusing.

It appears this happens because of the behavior of ApprovedRevsHooks::setApprovedRevForParsing, since that function (erroneously, I believe) returns the approved revision text as the page save text (to make sure links and properties are saved).

(I've elided the patch provided by the OP, which is still available in the archive. --66.162.23.2 20:50, 11 February 2013 (UTC))


 * Sorry for the long delay on this. I finally tested this out, and I couldn't see a problem. Assuming you're still reading this - can this be reproduced consistently, or does it only happen sometimes? Yaron Koren (talk) 01:00, 4 January 2013 (UTC)


 * I'm not the OP, but I've just started using this extension and I can consistently reproduce it on MW 1.19.2 with ApprovedRevs 0.6.4. My ApprovedRevs are set up to apply to just one namespace. If you create a page in this namespace, then approve that revision, the latest revision is the approved revision and everything works as expected. However, if you then create one or more unapproved revisions, the "latest revision" link always shows the approved revision instead of the latest revision. However, if you use the revision browsing links to move back one revision, then forward one, the correct revision is displayed. The problem doesn't seem to consistently happen when the latest approved revision isn't the first revision for the page. --66.162.23.2 17:43, 6 February 2013 (UTC)
 * The problem persists in MW 1.20.2. Also, further testing indicates that this seems to consistently occur; it doesn't matter if the latest approved revision is the first revision or not. A notable feature about my wiki is that I use PHP wincache (via $wgMainCacheType = CACHE_ACCEL) and the file cache; this bug may not replicate without those on. I also cache load.php through IIS's dynamic output cache, though I don't really see how that would have any effect. --66.162.23.2 23:13, 6 February 2013 (UTC)


 * Okay. If it's not too much work, could you try temporarily disabling wincache (I doubt the other caches are involved) and see if the problem still happens? Yaron Koren (talk) 23:20, 6 February 2013 (UTC)


 * Interestingly, the problem seems to persist even with $wgMainCacheType = CACHE_NONE. --66.162.23.2 16:20, 7 February 2013 (UTC)


 * Reviving this discussion from the archive, as the problem still persists despite disabling the cache... which is rather odd. --66.162.23.2 20:50, 11 February 2013 (UTC)

Hi - did you try that patch, by the way? Yaron Koren (talk) 13:40, 12 February 2013 (UTC)


 * The patch seems to fix the issue, at least how I put it in by my reading of the instructions. What I did was comment out the ParserBeforeInternalParse hook, then add the patched function in as the ArticleEditUpdates hook. The OP's instructions were a little unclear on whether the ParserBeforeInternalParse hook should be set to the new function as well, but as the signatures are different, I assumed that wasn't his/her intent. At any rate, the patch seems to correct the issue. --66.162.23.2 18:22, 12 February 2013 (UTC)


 * Okay, that's great. And I'm pretty sure you did the right thing by removing the previous hook. Since that patch seems to just fix everyone's problems, and the code certainly looks cleaner than the old hook, I'll just add it in to the next version. By the way, if the original poster is reading this, please let me know who you are, so I can credit you! Yaron Koren (talk) 22:24, 12 February 2013 (UTC)

Allow a user to see its own edits and a question about new unapproved page
I'd add ability for a user to see its own edits. Another point: when a new page (unapproved page) is created by a user it can be seen by anybody. And I (an admin) see no way to approve it.


 * Well, I think it's important for everyone to see the same thing - if a user's edits haven't been approved and aren't being shown yet, that user should know about it. And you should be able to approve by going to the history page. Yaron Koren (talk) 17:08, 19 February 2013 (UTC)

Notification
I think it would be helpful to add a notification piece to this extension. This would notify users with the 'approverevision' permission that there is a revision that needs approving.

--Dgennaro 17:17, 27 February 2013 (UTC)

Required MW version >= 1.19?
The extension page shows MW 1.17 as minimum version. However, Approved Revisions 0.6.5 on MW1.17 appears to have regression issues with a previously fixed issue with >1.19-code. Moreover, I receive an error on the special pages Special:ApprovedPages and Special:ApprovedRevs: “1109: Unknown table 'p' in order clause (localhost)”. --Remco de Boer 17:53, 4 March 2013 (UTC)


 * Ah - that's too bad; backward compatibility is to hard to ensure, when I don't a wiki running that MediaWiki version to test against. I'm hoping that MW 1.18 is still supported. I changed the documentation to reflect that it no longer works with 1.17. Yaron Koren (talk) 02:52, 5 March 2013 (UTC)

'''Same problem is occuring with meiawiki version 1.19.6. '''

“1109: Unknown table 'p' in order clause (localhost)”.

Can you please suggest any solution to this problem. Thanks in advance.


 * Sorry, I just saw this now. Did you create the "approved_revs" table? If not, that might be the cause of this problem - you need to call update.php to create it. Yaron Koren (talk) 19:25, 25 July 2013 (UTC)

Hide message on all pages
Is there a way to hide the message "This is the approved revision of this page, as well as being the most recent" on each page. I only want a message shown when the approved page is not the most recent. --82.2.128.31 21:04, 17 March 2013 (UTC)


 * The easiest way, though it's a little bit of a hack, is to go to the page "MediaWiki:approvedrevs-approvedandlatest" on your wiki, and replace the current contents with a space (" "). Yaron Koren (talk) 01:04, 18 March 2013 (UTC)


 * Thanks Yaron, that works a treat --82.2.128.31 18:24, 18 March 2013 (UTC)

I tried your hack Yaron, but it doesn't work for me properly (MediaWiki 1.20.5 & ApprovedRevs 0.6.5). Everytime I replace the content with a space, like you said, I click on Save and the page gets a blank body. But if I go back to another page, it always shows me the message "This is the approved revision of this page, as well as being the most recent". But the hack works if I replace the content with another text like "test" or whatever. --213.208.5.2 13:48, 24 June 2013 (UTC)


 * Hm, maybe the behavior changed in MediaWiki. You could try "&amp;nbsp;" instead. Yaron Koren (talk) 21:22, 25 June 2013 (UTC)


 * Thanks Yaron this works fine now :) --213.208.5.2 05:38, 26 June 2013 (UTC)

Creating redirects leaves behind an unnaproved page
If you are an admin and you move a page and leave behind a redirect, then it turns out that the REDIRECT works, but, the page with the REDIRECT on it is considered a new page and it is listed as unapproved on Special:ApprovedRevs&show=unapproved --Joshuagay (talk) 18:49, 26 April 2013 (UTC)

How do I approve all pages
I want to approve all pages whose approved revision is not their latest. Is there a way to do that automatically? --KonstantinDmitriev (talk) 07:31, 11 May 2013 (UTC)


 * Unfortunately, no. Yaron Koren (talk) 13:42, 15 May 2013 (UTC)

Missing MediaWiki:Approvedrevs-approvethisrev text
Small thing - (b10b172) doesn't come with any approvethisrev text - had to create page manually - easy but confused me initially and I ended up trying to hack code! --Md2017 (talk) 08:54, 25 May 2013 (UTC)


 * That's very strange - that message is there in the code. Yaron Koren (talk) 18:41, 26 May 2013 (UTC)

Thanks Yaron - I was trying to work out why the setArticleHeader/setSubtitle logic doesn't work for me. I am having great difficulty wrapping my head around the problem!


 * Create new page: "No revision has been approved for this page. View the most recent revision.". Fine
 * I click view revision and approve it. I see "This revision of the page has been set as the approved version." but also "Approve this revision." -uh oh.
 * I then click "read" and see "This is the approved revision of this page, as well as being the most recent." (fine).
 * I then make an edit, and see "This is the approved revision of this page; it is not the most recent. View the most recent revision" - fine. But when I follow the link to view the most recent revision I see the old subtitle:
 * Revision as of 23:08, 26 May 2013 by NJB (Talk | contribs | block)
 * (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 * ... but no "Approve this revision". I'm using 0.6.5 with MW 1.20.4. I have

$wgGroupPermissions['*']['viewlinktolatest'] = true; // $wgGroupPermissions['sysop']['viewlinktolatest'] = true; $wgGroupPermissions['*']['userCanApprove'] = true; $egApprovedRevsAutomaticApprovals = false; $egApprovedRevsBlankIfUnapproved = true; $egApprovedRevsShowApproveLatest = true; $egApprovedRevsNamespaces = array(NS_MAIN); Can you help? All worked beautifully with 0.6 and MW 1.17. Nick Md2017 (talk) 22:14, 26 May 2013 (UTC)

(Update) The following change to  restores the previous functionality: $approvedRevID = ApprovedRevs::getApprovedRevID( $title ); if ( ! ( empty( $approvedRevID ) || ( $wgRequest->getCheck( 'oldid' ) && $wgRequest->getInt( 'oldid' ) != $approvedRevID ) ) ) { // if ( ! empty( $approvedRevID ) && // 	! ( $wgRequest->getCheck( 'oldid' ) && // 	$wgRequest->getInt( 'oldid' ) == $approvedRevID ) ) { return true; }


 * Oh, that's great that you discovered a solution. I'll look into adding this to the main codebase. Yaron Koren (talk) 21:56, 29 May 2013 (UTC)


 * I just checked in a change that's a little different, but should be logically equivalent, to what you suggested. I hope it works - please let me know if there's still a problem. Yaron Koren (talk) 04:12, 28 June 2013 (UTC)

Show the latest content with a warning sign if its not approved
Hi

I want to show the latest content of a page with a warning text, though the revision is not approved yet. Msg some thing like "This is the most recent revision of the page, but not approved yet". please advice?


 * Well, the latest contents are already shown if there's no approved revision. So the only addition would be a message at the top. Which is not a bad idea, as an optional feature - I'll look into adding it. Yaron Koren (talk) 12:38, 12 July 2013 (UTC)
 * Thanks Yaron

XML Exports (and dumpBackup.php) Ignore Approved Revs
Approved Revs does not appear to hook into the XML export system, so the latest revision is always exported whether it's approved or not.

When doing an XML export with the "Stable" flag, the following hook is used:

WikiExporter::dumpStableQuery

Alternatively, this hook could be used to modify the query for all exports to ensure Approved Revs is used (more of a "brute force" to ensure only the approved revision is exported):

ModifyExportQuery

Adding one or both of these hooks to Approved Revs would ensure that search results (if using Lucene) only use the approved revision. Unfortunately, I'm not familiar enough with the Approved Revs code, and I didn't have time to figure what code would be needed around these hooks. Yaron, would you have time to add this feature?

Thanks!

--Jlemley (talk) 13:28, 31 July 2013 (UTC)


 * Hi - it's good to know that Approved Revs doesn't work with the export stuff - I never thought to check the export. Unfortunately, fixing it may prove difficult. I looked into fixing Special:Export, using those hooks - unfortunately, the first hook doesn't seem to get called; the second one, which is rather similar, does get called, but its structure makes it hard to set the approved revision in the export. (And actually, the same is true for the first hook.) It involves changing around elements of an SQL query, but with the approved_revs DB table that's difficult, because it only stores rows for pages that are approved - so the query would need to get values from different tables for different rows - which I don't think is possible, with the current querying structure. Is there possibly some other hook that could be used? Yaron Koren (talk) 13:25, 1 August 2013 (UTC)

Have viewlinktolatest subtitle show announcement to unapproved version only
Hi Yaron,

I just tried this extension and its awesome! Simple and very effected. Does exactly what you want it to without overloading it with too many features. I love your work with this and it works wonderful with the semantic forms. :)

My Requests: (1) I like the 'viewlinktolatest' subtitle at the topic that tells users if an unapproved version is available. This is useful. However, when I have this enabled, it also shows the "This is the approved revision of this page, as well as being the most recent" subtitle too. I dont want that since its annoying as most of the articles are usually approved ones. Is there a way to show the subtitles is awaiting approval version message only and not the subtitle that says this is the approved version? It will be useful if we can change these 2 settings to true or false separately in LocalSettings.php (2) Also, I am trying to show the subtitles for logged-in users and sysops only. So how do I disable 'viewlinktolatest' subtitle for users not logged in?


 * Hi - I'm glad you like it! For (1), I agree that there should be a setting; for now, though, you can do this with a hack, by goint to the page "MediaWiki:approvedrevs-approvedandlatest" on your wiki, and replacing contents with " ". For (2), you can do that by setting the 'viewlinktolatest' permission. Yaron Koren (talk) 01:31, 2 September 2013 (UTC)


 * Hi Yaron, (1) The hack was a good idea. However, I went to the page "MediaWiki:approvedrevs-approvedandlatest" in my wiki, and replaced its contents with " ", but still it didint work. It was still showing the message even when this MediaWiki:approvedrevs-approvedandlatest page was empty with just a space in it. So for now I opened the ApprovedRevs.i18n.php page and removed the text for 'approvedrevs-approvedandlatest' and replaced it with " ". That seems to work. (2) Setting the permission worked. I actually tried setting the permission last night after reading the examples in the extension page but it wasnt working. Maybe I was too tired then. Anyhow, it works now and I added the following for it:
 * $wgGroupPermissions['*']['viewlinktolatest'] = false;
 * $wgGroupPermissions['user']['viewlinktolatest'] = true;
 * $wgGroupPermissions['sysop']['viewlinktolatest'] = true;


 * BTW - a big thumbs up for your great support. I am new to mediawiki and so far I only have experience with phpbb. So its a big change for me learning MW and out of all your extensions have been the most useful for me. So a big thank you Yaron! :)


 * Ah, great - I actually had "&amp;nbsp;" in my my comments, but I forgot to HTML-escape it (just like you did, apparently :) ). I'm glad you figured it out. And thanks! Yaron Koren (talk) 13:27, 3 September 2013 (UTC)

Concepts for Enhancing ApprovedRevs
Has anyone looked into what it would take to enhance the self-owned-pages concept in ApprovedRevs? I'd like to use that feature on my organization's wikis, but we'd need to be able to change who the owner is if the previous owner was no longer a wiki user. Also having multiple users owning a page would be ideal.

Looking at ApprovedRevs_body.php, in the userCanApprove function, it seems like it would be pretty easy to add a database table with fields "page" and "user_who_can_approve", and add a check to that somewhere in the if-else statement. Or perhaps make a page in the MediaWiki namespace structured something like:

My page name | User:Dquayle, User:Bdole, User:Hclinton Another page name | User:Sstallone Yet another page | User:Bert, User:Ernie

Has anyone done any work in this direction? Any better ideas? Suggestions? What about being able to define a permission group able to approve in one namespace, and another group able to approve in another namespace?

Thanks.

--Jamesmontalvo3 (talk) 22:38, 3 September 2013 (UTC)


 * That's not a bad idea - especially the wiki page implementation: it's a simple interface, and quite powerful. Potentially, the "owned" area could be an individual page, a category or (as you note) a namespace; and the owner could be either an individual user or a user group. If the syntax could handle all of those things, I think it could be a complete solution. Any interest in working on it? :) Yaron Koren (talk) 02:03, 4 September 2013 (UTC)


 * Yeah I'll take a hack at it. The per-page and per-namespace method I see working fine. By category would work in many cases, but some people would be able to get around it. If a person was an editor, and had revision-approval rights for one category but not another, they could add the category they do have to any page then approve the rev. It's somewhat of an edge case, and requires malicious intent from a trusted person (they were granted approval rights to one category).


 * --Jamesmontalvo3 (talk) 03:17, 4 September 2013 (UTC)


 * That's great! It's true that category rights can be abused easily, but then again users can do any number of malicious things, if they wanted to... I still think it would be a useful component. Yaron Koren (talk) 13:23, 4 September 2013 (UTC)


 * I haven't gotten around to working on this update yet, but it's an approaching priority for me so hopefully I can start today or tomorrow. But, another thing I'd like to do is add the capability to have approved files/images. The extension description says it's not recommended to use ApprovedRevs on files. Any thoughts on how difficult it would be to make it work with files?


 * --Jamesmontalvo3 (talk) 17:38, 11 September 2013 (UTC)


 * I don't know - from what I recall, I looked into that before and saw that it would require changes to the image-display code in MediaWiki; at the very least, adding some hooks. At that point, I gave up on the idea. But I agree that it would be a great feature to have, and I'd be happy to provide support if you wanted to look into it further. Who knows, maybe by this point core MediaWiki no longer requires modification to get this feature working. Yaron Koren (talk) 19:14, 11 September 2013 (UTC)

Magic Word
Hello, I would like to print out some special text on a special place in an article depending on wether the article is the latest approved one or not. Conditional text seems to be possible via ParserFunctions. But i couldn't find a way to check wether the revision is the latest approved one or not.

Any ideas? --Finswimmer (talk) 07:53, 9 September 2013 (UTC)


 * That's an interesting idea - I don't know if it's possible, other than with some hack; it might require creating a new parser function, like #if_latest_is_approved. Out of curiosity, what kind of text do you want to display? Yaron Koren (talk) 17:33, 9 September 2013 (UTC)


 * I don't think that is absolutly necessary that ApprovedRevs give me a parser function (of course it would be nice). I think it's enough if there is some kind of magic word/Variable that gives back a status. I use mediawiki for a quality management system. And there i have on each site in infobox where i would like to print out whether this site and revision is approved. --Finswimmer (talk) 17:48, 9 September 2013 (UTC)