I'm trying to override the text inside the <title> tag for certain pages, specifically on the upload Special:Upload pages with the value specified in the wpDestFile url paramter. Is this possible and if so what hook would I use? I was thinking I might be able to use BeforePageDisplay but I don't think that allows me to modify content in the head.
Project:Support desk
From mediawiki.org
Jump to navigationJump to search
Are you using $out->setHTMLTitle()?
Im pretty sure beforePageDisplay is the correct hook.
Thank you very much, that was the hook. I have the hardest time understanding function documentation page and often rely too much on the manual in MediaWiki for the hook.
I am running Rocky Linux release 9.4 and have installed the following extensions:
cd /var/www/html/mediawiki/extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/LDAPAuthentication2
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/LDAPProvider
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/LDAPAuthorization
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Auth_remoteuser
Added the following code at the bottom of the LocalSettings.php file:
wfLoadExtensions( [
'PluggableAuth',
'Auth_remoteuser',
'LDAPProvider',
'LDAPAuthentication2',
'LDAPAuthorization',
'LDAPUserInfo'
] );
created ../ldapprovider.json
{
"LDAP": {
"connection": {
"server": "auth1.b.com",
"port": "636",
"enctype": "ssl",
"user": "cn=read-only-admin,dc=b,dc=com",
"pass": "KvNCxxxx94QIiyZ",
"options": {
"LDAP_OPT_DEREF": 1
},
"basedn": "dc=b,dc=com",
"groupbasedn": "ou=group,dc=b,dc=com",
"userbasedn": "ou=people,dc=b,dc=com",
"searchattribute": "uid",
"searchstring": "uid=USER-NAME,ou=people,dc=b,dc=com",
"usernameattribute": "uid",
"realnameattribute": "cn",
"emailattribute": "mail"
}
}
}
I can login locally but LDAP doesn't work. I can login from the OS level e.g. su - ldapuser1 on this machine so I know there is an active connection.
If I run the maintenance scripts I get an error e.g.
php maintenance/run.php ./extensions/LDAPProvider/maintenance/ShowUserGroups.php --conf /var/www/html/mediawiki
PHP Fatal error: Uncaught MediaWiki\Settings\SettingsBuilderException: None of the built-in formats are suitable for '/var/www/html/mediawiki' in /var/www/html/mediawiki/includes/Settings/Source/FileSource.php:125
Stack trace:
#0 /var/www/html/mediawiki/includes/Settings/SettingsBuilder.php(472): MediaWiki\Settings\Source\FileSource->load()
#1 /var/www/html/mediawiki/includes/Settings/SettingsBuilder.php(442): MediaWiki\Settings\SettingsBuilder->loadRecursive()
#2 /var/www/html/mediawiki/includes/Setup.php(223): MediaWiki\Settings\SettingsBuilder->apply()
#3 /var/www/html/mediawiki/maintenance/run.php(49): require_once('...')
#4 {main}
thrown in /var/www/html/mediawiki/includes/Settings/Source/FileSource.php on line 125
Most likely some incompatibility with MediaWiki 1.42. The LDAP extensions are mainly developed against the LTS branch which currently is 1.39.
Are there any additional configs? Like for $LDAPProviderDomainConfigs
or $LDAPProviderDomainConfigProvider
?
Maybe try using a PHP inline config with $LDAPProviderDomainConfigProvider
as shown here: Extension:LDAPProvider#Dynamic_PHP_array
I used $LDAPProviderDomainConfigs = "$IP/../ldapprovider.json"; and created this file as per the example. I also tried with the LDAPProviderDomainConfigProvider but neither works.
I think I will try to rebuild using 1.39
How do I delete my account?
@RiendeJongste: You've posted this to mediawiki.org, not to whatever wiki you're trying to delete your account on. (I'm assuming you don't want to delete your account here, as it looks like you only just created it to post this.) You'll need to contact the admins of wherever it is you want your account deleted.
I'm sure I'm using the wrong term, I wish I knew the right one so I could search for how to do this rather than make a whole new topic.
I want to create the box that appears in the top right corner of many pages, with notable images and/or facts about the page. Example circled here, in a screenshot I took of The Daily Show's page.
Thanks for your help!
That's called an infobox.
Wikipedia uses complex series of templates to create them. It can be complicated to copy them to your own wiki. See Manual:Importing_Wikipedia_infoboxes_tutorial for instructions.
Sometimes it can be easier to just make your own. Some people use Templates (combined with normal HTML styling) or extensions like Extension:PortableInfobox
Hi. I have a suggestion about adding safe interactive JavaScript elements to Wikiversity to make lessons more engaging. Where is the best place to discuss something like this?
See v:Wikiversity:Colloquium. (Assuming you mean the English version)
Dear Wikipedia Team,
I am writing to bring to your attention a concerning issue regarding the use of Wikipedia's digital core within the Russian internet zone. The product, known as RU WIKI, is being utilized in violation of Wikipedia's stated guidelines. It is primarily being used for advertising purposes, which undermines the principles of a free encyclopedia. Additionally, basic user data protection standards are not being followed.
In essence, this digital hybrid is a poor imitation of Wikipedia's product, tarnishing the core principles of the Free Encyclopedia. It also serves as a profit-making tool for a select group of individuals, which is deeply troubling.
I urge you to investigate this matter and take appropriate actions to protect the integrity of Wikipedia and its community.
Sincerely, Hyppolite Dumoulin
MediaWiki (the software) and Wikimedia (the hoster of Wikipedia) are not affiliated with ruwiki. There is little that can be done to stop them unless they use any of the Wikipedia related trademarks.
I have an older script "Werbung.php" which was intecrated per
require_once( "$IP/extensions/Werbung/Werbung.php" );
$wgHooks['ParserBeforeStrip'][]='Werbung';
in the LocalSettings.php and now don't work under version 1.42.
Unfortunately I can't find any hint in error.log of PHP for the problem. What's the best way to fix this update-problem?
Thanks in advance.
It is probably no longer compatible. You would have to ask the author of Werbung.php to release a newer version, or update the code yourse to be conpatible with newer versions of Mediawiki.
Thank your for this information. The author is not available. Perhaps someone has a hint as to what should be adapted here (ins the (in the manageable code):
function getPOIs($cmd) { require_once("/usr/www/users/data.php"); $mysqli = new mysqli($DBHost, $DBUser, $DBPass, $DBName); #Aufbau des Kommandos:<!-- Karte;latitude;longitude;zoom;NumberOfPOIs --> $c = preg_split('/;/', $cmd[0]); $latitude = $c[1]; $longitude = $c[2]; $zoom = $c[3]; $c4 = intval($c[4]); #30.5.15 Anzahl der POIs begrenzen $maxNumberOfPOIs = $c4; if ($c4 == 0) $maxNumberOfPOIs = 50; # POI Anzahl if ($c4 > 1500) $maxNumberOfPOIs = 1500; $map = "{{#display_map: "; $query = "select src from vaPOIs2 order by sqrt( power(lat-$latitude,2) + power(lon-$longitude,2) ) limit $maxNumberOfPOIs"; $result = $mysqli->query($query); while($row = $result->fetch_row()) { $map .= $row[0] . "\n"; } $map = trim ($map); $map = trim ($map, ';'); $map .= "|service=openlayers|center=$latitude, $longitude|width=100%|zoom=$zoom}}"; return $map; } #funct getPOIs function Werbung(&$parser, &$text) { $text = preg_replace_callback ('/<!-- Karte.* -->/', "getPOIs", $text); echo $text; return(true); }
This code looks very simple. Apparently it just composes an invocation of Extension:Maps, based on some database content. But I don't think we can discuss it here on the SupportDesk.
Maybe you want to check out the Professional_development_and_consulting page.
Thanks for the tip. My idea with the board here was just to get an approach to solving the problem. I thought that some people would have to fix similar problems with an update...
You will need to update the "Werbung" extension. There is a guide available that may help you: Manual:Extension_registration/Migration
I had already tried a few things - unfortunately always without success:
1. with Manual:Hooks/de to replace $wgHooks['ParserBeforeStrip'][]='Werbung';
-> Werbung ( $parser, $text );
2. Manual:Hooks/ParserBeforeInternalParse extensions.json -> add:
"HookHandlers": {
"main": {
"class": "MediaWiki\\Extension\\Werbung",
}
},
"Hooks": {
"ParserBeforeStrip": "Werbung",
"services": [ "UserNameUtils" ]
}
alternativ:
"Hooks": {
"ParserBeforeStrip": "MediaWiki\\Extension\\Werbung\\Hooks::onParserBeforeStrip"
},
(at least there was no error message with this version)
But I probably just don't have the right approach ?
The error probably went away because your changes made it fail before the error was encountered.
You should probably post any error message you got.
I have found the error messages of the function
function Werbung(&$parser, &$text) {
$text = preg_replace_callback ('//', "getPOIs", $text);
#echo $text;
#echo "<br><brblblb lblbllbd lbalbab.<br><br>";
return(true);
}
which I set in the LocalSettings.php
Werbung ( $parser, $text );
(instead of the old Hook #$wgHooks['ParserBeforeStrip'][]='Werbung';)
Deprecated: preg_replace_callback(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /usr/www/users/abc/archiv24/extensions/Werbung/Werbung.php on line 49
Notice: Headers already sent, should send headers earlier than require [Called from MediaWiki\Request\HeaderCallback::warnIfHeadersSent in /usr/www/users/veikkoc/archiv24/includes/Request/HeaderCallback.php at line 94] in /usr/www/users/abc/archiv24/includes/debug/MWDebug.php on line 492
Warning: session_name(): Session name cannot be changed after headers have already been sent in /usr/www/users/abc/archiv24/includes/Setup.php on line 472
You can not call something like Werbung ( $parser, $text );
within LocalSettings.php
. There is neither a $parser
nor a $text
in this context. You need to register the method as a hook handler.
The messages are (more or less) unrelated. I guess you have an empty line somewhere before a <?php
or after a ?>
.
After installing MediaWiki on my website it's working good. I found several extra apps... installed them and enjoy using them. So far ... so good.
This morning i see a very lot (about 21000) new users who has nothing to do with this website. I have deleted them all by using PhP Admin / page 2 / eh3j-user. It looklikes a "user-bomb" was used to attack my website. Is there a way to avoid such a "user-bomb"?
# Settings for UserPageEditProtection
$wgOnlyUserEditUserPage = false; // edit only by owner of the page
$wgGroupPermissions['sysop']['editalluserpages'] = false; // edit only by sysop-group
$wgGroupPermissions['userpageeditor']['editalluserpages'] = false; // edit only by userpageeditor-group
$wgGroupPermissions['Autoconfirmed users']['editalluserpages'] = true; // edit only by Autoconfirmed users-group
# Settings for ConfirmAccount
$wgMakeUserPageFromBio = false; // Extension by default use content of the person's bio as default content for userpage. This behavior can be disabled.
$wgConfirmAccountRequestFormItems['Biography']['enabled'] = true; // To disable the biography in form.
$wgConfirmAccountRequestFormItems['Biography']['minWords'] = 10; // By default, a 10 word biography is required for the new user to submit the request form.
$wgGroupPermissions['sysop']['createaccount'] = true; // Sysops can still create accounts directly, if not disabled by set.
Ai ai ... now i can't login anymore. When i try i get this message:
There appears to be a problem with your login session. Your action has been halted as a precaution against a security risk (which consists of possible hijacking of this session). Please try submitting the form again.
Found out that my database had reached the maximum size of 2 GB. I managed to reduce it a bit with PhPMyAdmin by emptying the cache and log-files. Now i can login again :-)
I'll try to install the Captcha protection.
Thanks alot for the advice!
I want to make some pages protected so only a custom user group can edit them. How can I achieve this?
He querido actualizar mi wiki de la versión 1.34.0 a la versión 1.42.1 y para hacerlo hice una actualización intermedia a la versión 1.39.8 como se recomienda en el manual de actualización. Al hacerlo encuentro que las páginas cuyo nombre contiene tildes, diéresis, ñ o caracteres similares aparecen vacías o sus links de entrada no aparecen en las listas. Cómo puedo solucionarlo?
It depends on the cause.
First off, run cleanupUsersWithNoId.php followed by migrateActors.php --force
If that doesnt help, check how page names are encoded in db, if they are proper utf-8. A link to your wiki might be helpful.