Last modified: 2007-06-18 17:01:01 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 10260 - Page protection status in prop=info
Page protection status in prop=info
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-14 17:19 UTC by Victor Vasiliev
Modified: 2007-06-18 17:01 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Makes prop=info list protections (1.46 KB, patch)
2007-06-14 19:33 UTC, Roan Kattouw
Details
Cleaner version of first patch (1.32 KB, patch)
2007-06-16 17:15 UTC, Roan Kattouw
Details
Implements listing page protection status through prop=info&inprop=protections (2.82 KB, patch)
2007-06-17 19:08 UTC, Roan Kattouw
Details

Description Victor Vasiliev 2007-06-14 17:19:07 UTC
Please, add page protection status in prop=info, like here:
<page pageid="11105676" ns="0" title="Main Page" touched="2007-06-14T16:54:31Z" lastrevid="135936648" counter="0" length="4726"><protection edit="sysop" move="sysop"></page>
Comment 1 Roan Kattouw 2007-06-14 19:33:42 UTC
Created attachment 3767 [details]
Makes prop=info list protections

I attached a patch that implements this. The following example illustrates how the protections are returned:

(Main Page is not protected, User:Catrope is protected "edit=sysop; move=sysop" expiring 12:57, 15 June 2007 and User:Catrope2 is protected the same with expiry infinite.)

api.php?action=query&prop=info&titles=User:Catrope|User:Catrope2|Main%20Page

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <pages>
      <page pageid="1" ns="0" title="Main Page" touched="2007-06-13T17:49:38Z" lastrevid="1" counter="5" length="444">
        <protection />
      </page>
      <page pageid="2" ns="2" title="User:Catrope2" touched="2007-06-14T16:55:38Z" lastrevid="9" counter="13" length="135">
        <protection>
          <pr type="edit" level="sysop" expiry="infinity" />
          <pr type="move" level="sysop" expiry="infinity" />
        </protection>
      </page>
      <page pageid="3" ns="2" title="User:Catrope" touched="2007-06-14T19:29:38Z" lastrevid="10" counter="3" length="27" redirect="" new="">
        <protection>
          <pr type="edit" level="sysop" expiry="20070615125700" />
          <pr type="move" level="sysop" expiry="20070615125700" />
        </protection>
      </page>
    </pages>
  </query>
</api>


Note that the expiry date can be a date in the past, in which case the protection is no longer valid. It's up to you to check this. Expiry dates are formatted yyyymmddhhmmss.

The format is not exactly what you asked for, but this makes more sense given the way protections are stored in the database.

Hope this helps,

Roan Kattouw
Comment 2 Roan Kattouw 2007-06-16 17:15:32 UTC
Created attachment 3790 [details]
Cleaner version of first patch

I've attached a patch that implements this slightly cleaner than the previous one.
Comment 3 Yuri Astrakhan 2007-06-17 10:44:16 UTC
This looks good, but it should not be done all the time (expensive on DB). Roan, could you add an optional parameter "prop" (prefix "in"), null by default, with the only valid value of "protection". Thanks!

btw, this line should be changed to add the prefix 'in':
 parent :: __construct($query, $moduleName);
Comment 4 Roan Kattouw 2007-06-17 11:26:13 UTC
(In reply to comment #3)
> This looks good, but it should not be done all the time (expensive on DB).
> Roan, could you add an optional parameter "prop" (prefix "in"), null by
> default, with the only valid value of "protection". Thanks!
> 
> btw, this line should be changed to add the prefix 'in':
>  parent :: __construct($query, $moduleName);

Will do, expect third version of patch early next week (Monday or Tuesday).
Comment 5 Roan Kattouw 2007-06-17 19:08:24 UTC
Created attachment 3796 [details]
Implements listing page protection status through prop=info&inprop=protections

Done earlier that I thought. The attached patch was made using the svn diff command, and should be applied with patch -p0 in the phase3 directory.
Comment 6 Yuri Astrakhan 2007-06-18 02:01:16 UTC
Applied in r23052 -- The patch had to be significantly altered for various reasons. Please review.
Comment 7 Roan Kattouw 2007-06-18 14:52:24 UTC
Doesn't look major to me. Just the coding style (opening braces) and the $fld_protection var. Looks like it should still work the same way.
Comment 8 Yuri Astrakhan 2007-06-18 16:09:21 UTC
By major i meant execution optimization: the patch was doing a complex query and then ignored the result when the property was not specified. Its all about performance, otherwise I will have domas chasing me with a wet towel.
Comment 9 Roan Kattouw 2007-06-18 17:01:01 UTC
(In reply to comment #8)
> By major i meant execution optimization: the patch was doing a complex query
> and then ignored the result when the property was not specified. Its all about
> performance, otherwise I will have domas chasing me with a wet towel.

Hell, you're right, can't believe I could be so stupid. A good thing _you_ are paying attention, then.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links