Topic on Project:Support desk

How to lock everything lockable with Lockdown?

19
79.176.94.174 (talkcontribs)

I am having a bit of hard time to read Extension:Lockdown.

I seek to experiment with the extension by locking anything it allows to lock, as long as "Article", "Category" and "Footer" pages are available to all users.

How can this be done?

79.176.94.174 (talkcontribs)

Perhaps something like this?

$wgActionLockdown['*'] = [ 'user' ];
$wgSpecialPageLockdown['*'] = [ 'user' ];
$wgNamespacePermissionLockdown['*']['*'] = [ 'user' ];
Bawolff (talkcontribs)

If your goal is to make it so logged out users cannot read anything except for a few select pages,you might want to consider using core's $wgWhitelistRead instead of Lockdown.

79.176.94.174 (talkcontribs)

I wouldn't say except for a few select pages, because I want to lock anything which isn't articles, category pages or footer pages.

79.176.94.174 (talkcontribs)

In other words, I want my website to behave towards non registered users as any typical Drupal/Joomla/Wordpress website would behave.

No history/management webpage would be available to non registered users.

79.176.94.174 (talkcontribs)

Update


What I seek is a single command which locks everything.

Malyacko (talkcontribs)

That does not exist, I'm afraid.

79.183.173.166 (talkcontribs)

Alright,

What do you use to lock everything that is lockable with this extension?

Ciencia Al Poder (talkcontribs)

Read the manual page

79.183.173.166 (talkcontribs)

@Ciencia Al Poder I've tried, but this manual is extremely hard for me to read.

I don't understand if the manual covers all possible examples or that there are other lock commands which I should "guess" which only a MediaWiki developer could really guess.


If someone knows a more user friendly guide, suitable for non MediaWiki developers as well, please share it.

Ciencia Al Poder (talkcontribs)

If nobody is going to document this to you for free, you can try hiring someone

79.183.173.166 (talkcontribs)

As I want to only restrict crawlers from accessing special pages, I think that only $wgActionLockdown and $wgSpecialPageLockdown are relevant for me.

Am I wrong?

Malyacko (talkcontribs)

You could try and find out yourself, or read the manual.

79.183.173.166 (talkcontribs)

User:Clump has surprisingly deleted this topic as "duplicate" without any clarification question / notice / warning so I will try to repost it here from what I remember.

How to lock all special pages with lockdown?

After pasting wfLoadExtension( 'Lockdown' ); in the end of LocalSettings.php I've tried both of these codes, each one alone, and both failed (no special page was locked down):

$wgSpecialPageLockdown['Special']['*'] = array('sysop');
$wgSpecialPageLockdown['Special:']['*'] = array('sysop');
79.183.173.166 (talkcontribs)

Okay, I believe I have found a way.

First, before locking all special webpages, one should lock all actions because it's much easier than locking all special webpages (there are about 6 actions but about 150 special webpages):

$wgActionLockdown['edit'] = array( 'sysop' );
$wgActionLockdown['delete'] = array( 'sysop' );
$wgActionLockdown['move'] = array('sysop');
$wgActionLockdown['protect'] = array( 'sysop' );
$wgActionLockdown['history'] = array( 'sysop' );
$wgActionLockdown['createtalk'] = array('sysop');

After that, locking all special pages is ha bit hard but currently possible somewhat automatically like this:


1) A list of all special pages is available at en.wikipedia.org/wiki/Help:Special_page

2) From the shell (CLUI) Download the webpage to stdin, match the names with grep, filter the name with sort (which also removes duplicates) and redirect the output to a txt file:

curl wikipedia.org/wiki/Help:Special_page -s | grep -oP 'Special:\K[a-zA-Z0-9]*' | sort -u > special_page_names.txt

3) Use AWK to put each name in the blocking template of Extension:Lockdown:

awk '{ print "$wgSpecialPageLockdown[\47"$0"\47] = array(\47sysop\47);" }' special_page_names.txt > special_page_names_processed.txt

4) Paste the output in your LocalSettings.php

---

If someone knows an easier way to lock all special webpages, please share it.

Add an https protocol to the curl command because I can't add it due to the abuse filter here.

79.183.173.166 (talkcontribs)

A more detailed explanation is available here

unix.stackexchange.com/questions/694268/how-to-lock-everything-for-registered-users-in-mediawiki

79.183.173.166 (talkcontribs)

I now use the MediaWiki API instead the page in Wikipedia, and a bit different command, with tr and also a few line breaks for code clarity.

pandoc -t plain 'mediawiki.org/w/api.php?action=query&meta=siteinfo&siprop=specialpagealiases' |
  grep -oP '"realname": \K"[A-Za-z0-9]*",' |
  sort -u |
  tr -d '[,"]' |
  tr -s ' ' \
  > special_page_names.txt

awk '{ print "$wgSpecialPageLockdown[\47"$0"\47] = array(\47sysop\47);" }' special_page_names.txt > special_page_names_processed.txt
79.183.173.166 (talkcontribs)

Add an https protocol to the pandoc command because I can't add it due to the abuse filter here.

Bawolff (talkcontribs)

You might want to look into the jq command.

Reply to "How to lock everything lockable with Lockdown?"