User:Rogerhc
- mediawiki-l, the MediaWiki mailing list.
- #mediawiki connect - the IRC channel.
- Support desk
Rogerhc | talk | talk archive
Hi! I'm Roger. I move slowly so the bird doesn't see me.
Here are my MediaWiki bookmarks and notes
β π β
Φ β π π π π΄ πΈ π π΅ π» π
- DB <-the magic
- the dark magic ->> https://doc.wikimedia.org/mediawiki-core/master/php/index.html
- the light magic ..> https://doc.wikimedia.org/
- forbidden: Special:AllMessages
Advertising
[edit ]- https://www.guyrutenberg.com/2014/10/13/displaying-google-adsense-in-mediawiki/ -- guyrutenberg's LocalSettings snip for Google Adsense ads
- Manual:Hooks
Cloudflare
[edit ]Roger manages Teflpedia's Cloudflare settings at https://cloudflare.com.
Cloudflare is a reverse-proxy content distribution network (CDN) between our users and our MediaWiki instance that helps us serve pages to people but not be swamped by bandwidth drain from data scrapers.
Teflpedia is configured with unorthodox Short URL, no /w/ and no /wiki/ in our URLs. π€¦ So our Cloudflare settings may be different from other wikis.
Cache Rules
[edit ]Teflpedia uses these Cloudflare Cache Rules to avoid caching dynamic parts of the wiki.
Cloudflare free plan > Caching > Cache Rules [+ Create rule]:
Cache Everything for Anonymous Filter Expression: (http.host eq "teflpedia.com") and not (http.cookie contains "--------") and not (http.request.uri.path contains "Special:") and not (http.request.uri.query contains "action=") Action:Eligible for cache, Edge TTL: 1 day
Replace ------- with a logged-in user cookie name (not it's value), maybe the cookie name ending in _____UserName.
Cloudflare Cache Rules order of precedence is last rule to apply takes precedence.[1] This is different from the older Page Rules order of first rule to apply takes precedence and skips the rest. We are using Cache Rules, so last rule to apply takes precedence. We are using only one expression made of four elements. The four elements could alternatively be separated into separate Cache Rules each with its own expressions, in which case the "Eligible for cache" action would need to be in the first Cache Rule so that the rules following it could override it.
LocalSettings.php
[edit ]And server side in LocalSettings.php:
## Cloudflare 2025εΉ΄08ζ31ζ₯ Roger ## https://www.cloudflare.com/ips/ $wgUseCdn = true; $wgCdnServersNoPurge = [ // IPv4 ranges from Cloudflare '173.245.48.0/20', '103.21.244.0/22', '103.22.200.0/22', '103.31.4.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20', '188.114.96.0/20', '197.234.240.0/22', '198.41.128.0/17', '162.158.0.0/15', '104.16.0.0/13', '104.24.0.0/14', '172.64.0.0/13', '131.0.72.0/22', // IPv6 ranges from Cloudflare '2400:cb00::/32', '2606:4700::/32', '2803:f800::/32', '2405:b500::/32', '2405:8100::/32', '2a06:98c0::/29', '2c0f:f248::/32' ];
Keep Cloudflare IPs Current
[edit ]The list of Cloudflare IP addresses in $wgCdnServersNoPurge is a critical security measure. It ensures that only trusted Cloudflare servers can send cache purge requests to our MediaWiki instance, preventing malicious actors from poisoning our cache.
Cloudflare occasionally updates its IP ranges. To ensure our server-side configuration remains secure and functional, it is important to periodically update this list.
To update the IP addresses:
- Go to the official Cloudflare IP list page: https://www.cloudflare.com/ips/
- Copy all the IP addresses and ranges from both the IPv4 and IPv6 sections.
- Paste the updated list into the $wgCdnServersNoPurge array in our LocalSettings.php file, replacing the old list. If the IPs in the PHP snip above no longer matches the list at https://www.cloudflare.com/ips/ then please notify Roger (talk) so he will update it.
Go outside and play! :) --Roger (talk) 00:13, 2 September 2025 (UTC)
See also
[edit ]Bot notes
[edit ]Out of date?
- Extension:MassEditRegex (beta) -- an alternative to Pywikipediabot?
- Manual:Pywikipediabot/Basic_use
- Use on non-WMF wikis
- Download from http://toolserver.org/~pywikipedia/nightly/ or see http://pywikipediabot.sourceforge.net/
- Pywikipediabot was recommended for editing category names, at Stack Overflow with a note to:
- (Check catlib.py for the category manipulation code, and category.py for an end-user-friendly mass category modification bot.)
Sysadmin Notes
[edit ]Upgrading MediaWiki, backups, changing webhosts, etc.
- Manual:Configuration settings
- Manual:Using custom namespaces
- Manual:$wgAllowSpecialInclusion
- Manual:$wgNamespacesToBeSearchedDefault
MariaDB / MySQL
[edit ]- Intro -- https://mariadb.com/kb/en/introduction-to-relational-databases/
- Basics -- https://mariadb.com/kb/en/a-mariadb-primer/#the-basics-of-a-database
- Useful queries -- https://mariadb.com/kb/en/useful-mariadb-queries/
Maintenance
[edit ]- Manual:update.php clears objectcache table, among other things
- Manual:Reduce size of the database -> Manual:Reduce_size_of_the_database#Compress_old_revisions <- check database size (roger_tp 367.98 MB), run this (done), check database size (____). May take cPanel a while to update the size list.
Upgrade
[edit ]- /fresh install 1.43.1 LTS (2025)
- /upgrade 1.39.1 LTS to 1.43.1 LTS (2025)
- /upgrade 1.35.1 LTS to 1.39.1 LTS (2023)
- /upgrade 1.31.1 LTS to 1.35.1 LTS (2021)
SSL self-cert test wiki
[edit ]- /Create SSL self-cert in cPanel -- how I create free self-authenticated SSL certificate for my test wiki
DefaultSettings.php
[edit ]includes/DefaultSettings.php --Don't edit--copy stuff to LocalSettings.php and modify there instead
Manual:Configuring file uploads
Manual:Configuring_file_uploads#Set_maximum_size_for_file_uploads
$wgMaxUploadSize = 1024*1024*100; # 100MB --default if not overridden by lower php.ini default of 2MB or 8MB (See above link)
auto-confirmed users (timestamp: 2020 MW 1.31)
[edit ]Manual:$wgAutoConfirmAge -- default is 0; so set it to something
Manual:$wgAutoConfirmCount -- default is 0; so set it to something
Manual:DefaultSettings.php --Don't edit--copy stuff to LocalSettings.php and modify there instead
Default (snip from DefaultSettings.php):
// Implicit group for all logged-in accounts $wgGroupPermissions['user']['move'] = true; $wgGroupPermissions['user']['move-subpages'] = true; $wgGroupPermissions['user']['move-rootuserpages'] = true; // can move root userpages $wgGroupPermissions['user']['move-categorypages'] = true; $wgGroupPermissions['user']['movefile'] = true; $wgGroupPermissions['user']['read'] = true; $wgGroupPermissions['user']['edit'] = true; $wgGroupPermissions['user']['createpage'] = true; $wgGroupPermissions['user']['createtalk'] = true; $wgGroupPermissions['user']['writeapi'] = true; $wgGroupPermissions['user']['upload'] = true; $wgGroupPermissions['user']['reupload'] = true; $wgGroupPermissions['user']['reupload-shared'] = true; $wgGroupPermissions['user']['minoredit'] = true; $wgGroupPermissions['user']['editmyusercss'] = true; $wgGroupPermissions['user']['editmyuserjson'] = true; $wgGroupPermissions['user']['editmyuserjs'] = true; $wgGroupPermissions['user']['purge'] = true; $wgGroupPermissions['user']['sendemail'] = true; $wgGroupPermissions['user']['applychangetags'] = true; $wgGroupPermissions['user']['changetags'] = true; $wgGroupPermissions['user']['editcontentmodel'] = true; // Implicit group for accounts that pass $wgAutoConfirmAge $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true; $wgGroupPermissions['autoconfirmed']['editsemiprotected'] = true;
Customize in LocalSettings.php: 1. take away (set to false) move rights for group 'user', 2. give those instead to group 'autoconfirmed', 3. Set $wgAutoConfirmAge AND $wgAutoConfirmCount:
// Implicit group for all logged-in accounts $wgGroupPermissions['user']['move'] = false; $wgGroupPermissions['user']['move-subpages'] = false; $wgGroupPermissions['user']['move-rootuserpages'] = false; $wgGroupPermissions['user']['move-categorypages'] = false; $wgGroupPermissions['user']['movefile'] = false; // Implicit group for accounts that pass $wgAutoConfirmAge AND $wgAutoConfirmCount $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true; $wgGroupPermissions['autoconfirmed']['editsemiprotected'] = true; $wgGroupPermissions['autoconfirmed']['move'] = true; $wgGroupPermissions['autoconfirmed']['move-subpages'] = true; $wgGroupPermissions['autoconfirmed']['move-rootuserpages'] = true; // can move root userpages $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true; $wgGroupPermissions['autoconfirmed']['movefile'] = true; // Seconds since 'user' account created $wgAutoConfirmAge = 86400*2; // two days // Edit count $wgAutoConfirmCount = 2; // two edits
Pages
[edit ]- Compatibility -- PHP and Database requirements charts
Short URL
[edit ]- Manual:Short_URL -- Overview
- Manual:Short URL/Apache -- Apache
- https://shorturls.redwerks.org/ -- This configuration tool WORKS for MW1.35.1!
Apache
[edit ]- https://httpd.apache.org/docs/2.4/rewrite/intro.html -- Apache mod_rewrite intro
- https://httpd.apache.org/docs/current/mod/mod_rewrite.html -- Apache mod_rewrite doc
- https://httpd.apache.org/docs/current/expr.html#vars -- %{REQUEST_FILENAME} -- the values of the named HTTP request headers.
Testing
[edit ]Subpage titles
[edit ]Subpage titles, initial /Subpage letter is case sensitive.
Subpage links
[edit ]Fancy subpage links:
need work
[edit ]Manual
[edit ]- Manual:Using_custom_namespaces#Removing_custom_namespaces
- Manual:Backing up a wiki
- Category:Manual
- Manual:Skins
- Manual:Start
- Manual:Contents
- Manual:Combating_spam -- Rob Church started this page 4/30/2007
- Manual:$wgSpamRegex
Help
[edit ]- m:Help:Calculation
- Help:Extension:ParserFunctions
- Help:Magic_words
- Help:Start
- Help:Contents
- Help:Tables - User:Rogerhc/Tables 2 col