-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
btongminh@svn.wikimedia.org wrote:
Force indices of groups and rights array to be in order so that the
JSON formatter recognizes it as a list instead of a dict in case for some reason rights or groups are removed somewhere in between (as done for sysops on testwiki). [snip]
$vals['groups'] = $wgUser->getGroups();
$vals['groups'] = array_values( $wgUser->getGroups() );
If this is really necessary, it should probably be done in User::getGroups() to return a consistent value... but it really shouldn't be needed.
Offhand nothing appears wrong with the straight results I see from getGroups() on testwiki.
Can you clarify with an example?
- -- brion
On Tue, May 20, 2008 at 12:08 AM, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
btongminh@svn.wikimedia.org wrote:
Force indices of groups and rights array to be in order so that the
JSON formatter recognizes it as a list instead of a dict in case for some reason rights or groups are removed somewhere in between (as done for sysops on testwiki). [snip]
$vals['groups'] = $wgUser->getGroups();
$vals['groups'] = array_values( $wgUser->getGroups() );
If this is really necessary, it should probably be done in User::getGroups() to return a consistent value... but it really shouldn't be needed.
Offhand nothing appears wrong with the straight results I see from getGroups() on testwiki.
Can you clarify with an example?
- -- brion
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgx+moACgkQwRnhpk1wk45nKQCg0VG7mcBIhFSL3fT8vcRBrwDy PQkAn2+RyrREFlwnHY6XmJddGD/hrzvW =Plu4 -----END PGP SIGNATURE-----
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I just checked, it was indeed not necessary for 'groups'; only for 'rights'. As a sysop on testwiki entries 8 and 9 were missing from the rights list causing the JSON formatter to interpret it as a dict instead of a list. On the other hand, better safe than sorry? Or is that unnecessary? :)
Bryan
On Tue, May 20, 2008 at 9:51 AM, Bryan Tong Minh bryan.tongminh@gmail.com wrote:
On Tue, May 20, 2008 at 12:08 AM, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
btongminh@svn.wikimedia.org wrote:
Force indices of groups and rights array to be in order so that the
JSON formatter recognizes it as a list instead of a dict in case for some reason rights or groups are removed somewhere in between (as done for sysops on testwiki). [snip]
$vals['groups'] = $wgUser->getGroups();
$vals['groups'] = array_values( $wgUser->getGroups() );
If this is really necessary, it should probably be done in User::getGroups() to return a consistent value... but it really shouldn't be needed.
Offhand nothing appears wrong with the straight results I see from getGroups() on testwiki.
Can you clarify with an example?
- -- brion
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgx+moACgkQwRnhpk1wk45nKQCg0VG7mcBIhFSL3fT8vcRBrwDy PQkAn2+RyrREFlwnHY6XmJddGD/hrzvW =Plu4 -----END PGP SIGNATURE-----
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I just checked, it was indeed not necessary for 'groups'; only for 'rights'. As a sysop on testwiki entries 8 and 9 were missing from the rights list causing the JSON formatter to interpret it as a dict instead of a list. On the other hand, better safe than sorry? Or is that unnecessary? :)
Bryan
I tracked it down to FlaggedRevs, which unsets the patrol and autopatrol rights using the UserGetRights hook. I moved the reindexation to just after the hook call. For getGroups no hooks appear to be run, so that should be safe.
Bryan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Bryan Tong Minh wrote:
I tracked it down to FlaggedRevs, which unsets the patrol and autopatrol rights using the UserGetRights hook.
Hmm, well that sounds kind of evil... Why would it do that?
I moved the reindexation to just after the hook call. For getGroups no hooks appear to be run, so that should be safe.
- -- brion
wikitech-l@lists.wikimedia.org