Remove default nonexistent bottom links

I have a problem installing MediaWiki on a local network. I am using MediaWiki in German. My wiki has several footer links that cause a 404 error. For example, there is an Impressum link in the footer (in English: Disclaimer). It points to *NameOfMyWiki*:Impressum , which does not exist.

When I go to MediaWiki:Disclaimers , a refusal message appears, this is the page that should be behind *wgSitename*:Impressum . I do not think it is intended that I should provide a disclaimer on MediaWiki:Disclaimers .

Another behavior, which is probably based on the same problem, is that the user gets 404 on his own user page when the user page is still empty / not yet created (click on the link in the upper right corner next to the settings ) When another user edits the user page of the first user, the first user can also access and edit it. But not when it is still empty / undefined.

How can i fix this?

+6
source share
3 answers

footer link text comes from MediaWiki:Privacy , MediaWiki:Aboutsite and MediaWiki:Disclaimers . To disable one or more of these links, set the corresponding link text to one hyphen ( - ).

Alternatively, since MediaWiki 1.17 you can also change the footer of the defining hook in your LocalSettings.php .

Ps. For anyone interested in navigating to the source code, the code that processes these links is in the Skin :: footerLink () method. The practice of disabling various interface functions by setting the appropriate message to - actually quite common (although not universal) in MediaWiki; completely empty messages are processed a little strange for historical reasons, therefore - it - usually used as a backup for "no value".


Edit: I just noticed that you also asked the second question about custom pages. To better answer this question, let me start by describing how MediaWiki should handle non-existent pages:

  • When MediaWiki sees wikilink (most, though not necessarily all, links in the navigation menu are also treated the same way), pointing to a page that does not exist, it creates a so-called redlink . These links are different from regular links (usually they are colored red, hence the name) and point to a URL that looks like this one with the parameters action=edit (which makes it a special kind of edit link) and redlink=1 .

  • When a user clicks on such a link, MediaWiki first checks that the page was not created in average time, and if it was not, the user is allowed to create and edit it:

    • If the page exists, the user is simply redirected to the normal view URL for the page.

    • If the page does not exist and the user is not allowed to create it, they are also redirected to the usual view URL, which then returns an HTTP 404 status code and a message stating that the page does not exist. (This will happen if you click the β€œlike this” link above, unless you are an administrator on Wikipedia.)

    • Finally, if the page does not exist, but the user is allowed to create it, MediaWiki simply treats the URL as a regular edit link and displays the edit form.

It seems that for some reason, new users, by clicking on the link to their own user page on your wiki, beat case 2 above, rather than the expected case 3. This may be user rights : in particular, you should check that ordinary registered users ( user group) on your wiki have createpage permission.

If you want regular users to be able to create only their own custom pages, there are ways to do this, but all I know is to install extension or write my own getUserPermissionsErrors . I can give you some examples of how to do this if you want, but requires a bit of coding.

+9
source

These links are placeholders that you may want to fill out. They are provided, so you can easily fill out some important parts of your new wiki.

For a complete list, see http://www.mediawiki.org/wiki/Manual:Footer .

In fact, there are no settings to turn them off.

0
source

Link mentioned by Ilmari Karonen above:

Alternatively, since MediaWiki 1.17 you can also change the footer definition of the hook in your LocalSettings.php .

... shows how to add links to the built-in list of bottom links. That it does NOT show how to remove existing embedded footer links, which was the original question.

Turns out this is a simple addition to the allowed hook solution. You just need to drop the existing footer links in the template array.

Most people will not only want to remove the embedded footer links, but also add their own. In the spirit of StackOverflow, here is a complete sample solution that both do (this is from an existing Wiki ...)

This works in mediawiki-1.29.2, but it will probably work in many older versions. Put this code in the LocalSettings.php file (I put it below) to remove the existing footer links and add your own:

 # Remove all existing footer links and add my own $wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) { # IMPORTANT: this is the secret sauce - remove all existing footer links $tpl->data['footerlinks']['places'] = array(); # To add new footer links to local wiki pages: # # 1) You MUST create your new pages in your (Main) namespace first, for example: # # http://<your-site>/wiki/index.php/About_Us # http://<your-site>/wiki/index.php/Contact_Us # http://<your-site>/wiki/index.php/Disclaimer # http://<your-site>/wiki/index.php/Download # http://<your-site>/wiki/index.php/Privacy_Policy # # 2) You MUST then create each of these pages in your MediaWiki namespace: # # http://<your-site>/wiki/index.php/MediaWiki:Aboutpage # - Insert 1 line, with "About Us" (no quotes) # http://<your-site>/wiki/index.php/MediaWiki:Contactpage # - Insert 1 line, with "Contact Us" (no quotes) # http://<your-site>/wiki/index.php/MediaWiki:Disclaimerpage # - Insert 1 line, with "Disclaimer" (no quotes) # http://<your-site>/wiki/index.php/MediaWiki:Downloadpage # - Insert 1 line, with "Download" (no quotes) # http://<your-site>/wiki/index.php/MediaWiki:Privacypage # - Insert 1 line, with "Privacy Policy" (no quotes) # # 3) Add new footer links like this: $tpl->set( 'aboutpage', $sk->footerLink( 'aboutpage', 'aboutpage' ) ); $tpl->data['footerlinks']['places'][] = 'aboutpage'; $tpl->set( 'contactpage', $sk->footerLink( 'contactpage', 'contactpage' ) ); $tpl->data['footerlinks']['places'][] = 'contactpage'; $tpl->set( 'disclaimerpage', $sk->footerLink( 'disclaimerpage', 'disclaimerpage' ) ); $tpl->data['footerlinks']['places'][] = 'disclaimerpage'; $tpl->set( 'downloadpage', $sk->footerLink( 'downloadpage', 'downloadpage' ) ); $tpl->data['footerlinks']['places'][] = 'downloadpage'; $tpl->set( 'privacypage', $sk->footerLink( 'privacypage', 'privacypage' ) ); $tpl->data['footerlinks']['places'][] = 'privacypage'; return true; }; 

IMPORTANT Remember to follow the instructions and create your own MediaWiki pages and associated redirects, or your links may not appear or they may be damaged.

0
source

Source: https://habr.com/ru/post/909811/


All Articles