Project:Support desk

Jump to navigation Jump to search

About this board

Welcome to MediaWiki.org's Support desk, where you can ask MediaWiki questions!

There are also other places where to ask :

Before you post

Post a new question

  1. To help us answer your questions, please always indicate which versions you are using (reported by your wiki's Special:Version page):
    • MediaWiki
    • PHP
    • Database
  2. Please include the URL of your wiki unless you absolutely can't. It's often a lot easier for us to identify the source of the problem if we can look for ourselves.
  3. To start a new thread, click "Start a new topic".
Previous page history was archived for backup purposes at Project:Support_desk/old on 2015-07-30.
 

Add a page to the local mediawiki using API

4
Summary by Majavah

Wrong endpoint, probably. Anyways a 8-month-old topic.

SumanGadhawal (talkcontribs)

Hi all,

I am new here and currently I am trying to generate login token for my local url http://localhost/mediawiki/index.php/Main_Page but i am getting response 404


here is my code


import requests
S = requests.Session()
URL = "http://localhost/mediawiki/index.php/Main_Page"
# Retrieve login token first
PARAMS_0 = {
    'action':"query",
    'meta':"tokens",
    'type':"login",
    'format':"json"
}
R = S.get(url=URL, params=PARAMS_0)
print(R)
DATA = R.json()
LOGIN_TOKEN = DATA['query']['tokens']['logintoken']
print('data',DATA)
Clump (talkcontribs)

404 is not found---does the url work in a browser? Either way, the API entry point is not index.php/Main_Page, it is api.php. See API:Main_page#Endpoint.

SumanGadhawal (talkcontribs)
Ciencia Al Poder (talkcontribs)

Do you realize you're typing index.php instead of api.php?

Automatically adding category to empty pages

3
Desbrina1 (talkcontribs)

I'm currently creating several pages on my wiki as placeholders which I will create properly at a later date. Currently I'm adding a category manually to these pages to make them easier to find.

Is there anyway of automatically adding the category to empty pages, maybe how the broken file links works.

TiltedCerebellum (talkcontribs)

Well, if they don't have a category they would automatically show up in Special:UncategorizedPages report and in your orphaned pages under Special:LonelyPages. You might want to familiarize yourself with Special:SpecialPages if you aren't already familiar with the reports there.

Pppery (talkcontribs)
Reply to "Automatically adding category to empty pages"

New MediaWiki - All domain traffic is redirected to wiki; subdomain setup possible too?

2
Ribrob2379 (talkcontribs)

Hi guys, first time posting cause it's my first time setting up mediawiki on my server. I'm using nginx and I installed mediawiki under /var/www/html/w/. I setup short urls and it's working but it's routing all my traffic that goes to edhel.online to edhel.online/wiki/Main_Page.

The first thing I would like to do is have my main website, preferably I'll setup a wordpress at edhel.online and have the mediawiki at edhel.online/w/ or at wiki.edhel.online. Is there a way to do this while maintaining short urls or does the wiki need to be my landing page?


I originally had it installed in a mediawiki/ folder instead of w/ but I couldn't get wiki.edhel.online to work.


Mediawiki: 1.34.0

PHP: 7.4

Databse: MySql/MariaDB


/etc/nginx/sites-availale/default:


server {

        listen 80;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html index.php;

        server_name wiki.edhel.online;

#       return 301 https://$host$request_uri;

#       location / {

#               try_files $uri $uri/ =404;

#       }

#       location ~ \.php$ {

#         fastcgi_pass unix:/run/php/php7.4-fpm.sock;

#         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

#         include fastcgi_params;

#         include snippets/fastcgi-php.conf;

#        }

}

server {

        root /var/www/html;

        index index.php index.html index.htm index.nginx-debian.html;

        server_name wiki.edhel.online; # managed by Certbot

        # Location for wiki's entry points

        location ~ ^/w/(index|load|api|thumb|opensearch_desc)\.php$ {

                include fastcgi_params;

                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                fastcgi_pass unix:/run/php/php7.4-fpm.sock; # or whatever port your PHP-FPM list$

        }

        # Images

        location /w/images {

                # Separate location for images/ so .php execution won't apply

        }

        location /w/images/deleted {

                # Deny access to deleted images folder

                deny all;

        }

        # MediaWiki assets (usually images)

        location ~ ^/w/resources/(assets|lib|src) {

                try_files $uri 404;

                add_header Cache-Control "public";

                expires 7d;

        }

        # Assets, scripts and styles from skins and extensions

        location ~ ^/w/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg|wasm)$ {

                try_files $uri 404;

                add_header Cache-Control "public";

                expires 7d;

        }

        # Favicon

        location = /favicon.ico {

                alias /w/images/6/64/Favicon.ico;

                add_header Cache-Control "public";

                expires 7d;

        }

        ## Uncomment the following code if you wish to use the installer/updater

        ## installer/updater

        #location /w/mw-config/ {

        #       # Do this inside of a location so it can be negated

        #       location ~ \.php$ {

        #               include /etc/nginx/fastcgi_params;

        #               fastcgi_param SCRIPT_FILENAME $document_root/w/mw-config/$fastcgi_script$

        #               fastcgi_pass unix:/run/php/php7.4-fpm.sock; # or whatever port your PHP-$

        #       }

        #}

        # Handling for the article path (pretty URLs)

        location /wiki/ {

                rewrite ^/wiki/(?<pagename>.*)$ /w/index.php;

        }

        # Allow robots.txt in case you have one

        location = /robots.txt {

        }

        # Explicit access to the root website, redirect to main page (adapt as needed)

        location = / {

                return 301 /wiki/Main_Page;

        }

       # Every other entry point will be disallowed.

        # Add specific rules for other entry points/images as needed above this

        location / {

                return 404;

        }

        listen [::]:443 ssl ipv6only=on; # managed by Certbot

        listen 443 ssl; # managed by Certbot

        ssl_certificate /etc/letsencrypt/live/edhel.online/fullchain.pem; # managed by Certbot

        ssl_certificate_key /etc/letsencrypt/live/edhel.online/privkey.pem; # managed by Certbot

        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {

    if ($host = www.edhel.online) {

        return 301 https://$host$request_uri;

    } # managed by Certbot

    if ($host = edhel.online) {

        return 301 https://$host$request_uri;

    } # managed by Certbot

    listen 80 ;

    listen [::]:80 ;

    server_name edhel.online;

    return 404; # managed by Certbot

}

TiltedCerebellum (talkcontribs)

If your $wgArticlePath setting in LocalSettings.php was incorrect (i.e., had /wiki/ in it) then it would explain the incorrect routing.

You should consider putting the wiki under a subdomain if you want a wordpress site under the primary domain. Running them off the same domain is not a good idea, putting mediawiki into a subdomain is a better idea.

Did you confirm your subdomain was working and displaying pages before attempting to install mediawiki under it? If not I'd do a web search on how to config a subdomain in nginx, get the subdomain working and first confirm that it's working by creating and uploading a generic index.html or index.php with something in it like "it works", and then try to view it in your browser. If you know your subdomain is first working, then you're good to go on installing mediawiki under it. But if you don't know if it's working, you don't know where the issue is.

Then after you know your subdomain is working try installing MediaWiki in the subdomain folder via the steps at Manual:Installing MediaWiki. If you don't want it nested in a /wiki/ or /w/ folder then don't leave it nested in a /wiki/ or /w/ folder. You don't have to have /wiki/ or /w/ in the file path at all. To remove it, you could via ftp upload the contents of the MW directory into your subdomain web folder. Then your path would be like: sub.yoursite.com/Main_Page instead of sub.yoursite.com/w/Main_Page. If you were extracting from command line, you could have used the --strip-componets command to strip the extra folder off and just extract the contents to the web folder of your subdomain.

tar xvzf mediawiki-1.34.2.tar.gz --strip-components 1

Then you'd have to make sure that your $wgArticlePath is correctly set. Like one of the following:

# If mediawiki files are NOT nested into a folder in your web directory:
$wgArticlePath = "/$1";

# If mediawiki files are nested into a /w/ folder in your web directory:
$wgArticlePath = "/w/$1";

# If mediawiki files are nested into a /wiki/ folder in your web directory:
$wgArticlePath = '/wiki/$1';

Though the documentation states you can't use /wiki/ with short URLs. I personally don't like nesting MW into a subfolder at all and I like having MW in its own subdomain so there can be no errors with working with files and directories on the main site and accidentally copying over a necessary MW file or folder.

Reply to "New MediaWiki - All domain traffic is redirected to wiki; subdomain setup possible too?"

How to block editation of all discussions?

2
2A02:908:3111:7DA0:5DEA:6B5C:E3F0:4C35 (talkcontribs)

Hi I want to prohibit, that any discussion can be edited on my wiki.

I am the admin and the only user, but I need to remember, never to edit this namespace.

Can I somehow make it able, that I don't edit them accidently?

Bawolff (talkcontribs)

$wgNamespaceProtection might be an option.

You can also use css by adding the following to the page MediaWiki:Common.css on your wiki:

#ca-talk {display:none}

That won't disable it, but it will hide the link.

how can i start our company introduction

2
Summary by TiltedCerebellum

Not a MediaWiki software help desk question. This help desk is for questions related to installing/running/maintaining the mediawiki software.

Shliftop (talkcontribs)

how can i upload info of our company shliftop@gmail.com

thank yousr

Ciencia Al Poder (talkcontribs)

If you pretend to add info about your company on Wikipedia, the info may not be accepted, and will be deleted. Refer to local policies on that wiki. Have you tried a service like yellow pages, etc? People usually look at companies about a subject, and looks for subjects in sites like yellow pages, not on Wikipedia.

Keep but disable several user accounts

2
76.173.103.102 (talkcontribs)

I have a private wiki that requires an account to view and edit.

I've have several user accounts of individuals that needed temporary access to edit the wiki. Some of these accounts are email confirmed users.

These users no longer need view or edit access however I would like to retain all their edits and have them associated with their accounts.

What is the best way to disable these accounts? And if I ever need to reactivate an account, how would I go about doing it?

Majavah (talkcontribs)

You can set $wgBlockDisablesLogin to true. That would allow you to block all accounts that shouldn't be able to log in and if you need to re-activate the account you can just unblock them.

can i hook "page preview" to script-generated content?

2
קיפודנחש (talkcontribs)

i think the title pretty much explains the question, but let me elaborate a bit: the content i'm talking about is contained in a dialog - either some OOJS form, or jQuery.ui dialog.

this newly minted content contains links which look identical to links which show "page preview", when they are on the page.

is there a way to convince page preview to hook itself to these newly minted links?

peace

TiltedCerebellum (talkcontribs)

With respect, what you are asking for is not clear at all. The tile doesn't explain it. Please explain (and if possible provide examples) to what you are trying to accomplish and where. This sounds like a customization rather than an issue with the MediaWiki software, you might try:

Professional development and consulting

Reply to "can i hook "page preview" to script-generated content?"

Mistake during MediaWiki install

3
96.228.162.28 (talkcontribs)

Hi all, this is probably going to sound dumb but I made an error during MediaWiki 1.34.2 installation. I accidentally clicked enter to continue while my database field was blank. Now I get the error "Database must be null or a non-empty string" and there is no way for me to complete the installation. Is there any known fix for this? Trying to get our wiki set back up and I'm not sure how to progress. Thanks so much for your time.

96.228.162.28 (talkcontribs)

more specifically, I see the page:

MediaWiki 1.34.2

LocalSettings.php not found.

Please complete the installation and download LocalSettings.php.

but when I click to complete the installation I get that error.

Bawolff (talkcontribs)

You should be able to go back a step in the installer.

If all else fails, delete cookies and restart installer.

Summary by TiltedCerebellum

User is in the wrong place

84.65.50.144 (talkcontribs)

Hi

I filled out an application for an account a few weeks ago. I haven't heard anything back. Is there a way I can find out: if this has been received, is being processed or has been denied?


Thanks,


Andy

Majavah (talkcontribs)

Where did you apply for an account?

84.65.50.144 (talkcontribs)

From Special:RequestAccount The top right hand menu on the site

Malyacko (talkcontribs)

Whatever website this is about, you'll have to contact that website, I'm afraid. This is the forum for the software called MediaWiki. MediaWiki is used by many websites out there, but we do not run these websites.

84.65.50.144 (talkcontribs)

OK thank you - this was the address edutechwiki.unige.ch en Special:RequestAccount - with gaps

So you are not a part of this?

Bawolff (talkcontribs)

We are not. We make the software they use, but they are totally separate.

190.140.176.33 (talkcontribs)

Hello,

Is there a way to remove the most used passwords restriction when creating accounts?

Bawolff (talkcontribs)

See $wgPasswordPolicy

From a security perspective its probably a bad idea to do that due to the risk of dictionary attacks.

190.140.176.33 (talkcontribs)

Thank you. I have a school wiki, and I prefer short/easy passwords. Which parameter should I use to remove the restriction?

Bawolff (talkcontribs)

$wgPasswordPolicy['policies']['default']=[]; would remove all restrictions (including length) for normal users but not admins. See thecdoc page for more options.