Mediawiki: how to allow new account creation through facebook only? - mediawiki

Is there a way to allow new account creations on mediawiki only through the facebook extension? I.e. I want to disable regular account creation (unless done by sysops) through Special:UserLogin/signup, while still allowing the facebook extension to automatically create new accounts as needed.
Everything I've tried so far completely blocks account creation in all cases (except for sysops). Specifically, when I disable regular account creation through wgGroupPermissions, as in:
$wgGroupPermissions['*']['createaccount'] = false;
then the facebook extension throws the following error:
Non-string key given
Backtrace:
#0 /var/www-wiki.kostumekult.com/html/includes/GlobalFunctions.php(1183): MessageCache->get(Array, true, false)
#1 /var/www-wiki.kostumekult.com/html/includes/GlobalFunctions.php(1163): wfMsgGetKey(Array, true, false, true)
#2 /var/www-wiki.kostumekult.com/html/includes/GlobalFunctions.php(1081): wfMsgReal(Array, Array)
#3 /var/www-wiki.kostumekult.com/html/extensions/Facebook/FacebookUser.php(41): wfMsg(Array)
#4 /var/www-wiki.kostumekult.com/html/extensions/Facebook/FacebookUser.php(327): FacebookUserException->__construct(Array, 'createaccount')
#5 /var/www-wiki.kostumekult.com/html/extensions/Facebook/SpecialConnect.php(235): FacebookUser->createUser('rommel.hoop.1', '')
#6 /var/www-wiki.kostumekult.com/html/includes/SpecialPageFactory.php(458): SpecialConnect->execute('ChooseName')
#7 /var/www-wiki.kostumekult.com/html/includes/Wiki.php(240): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#8 /var/www-wiki.kostumekult.com/html/includes/Wiki.php(640): MediaWiki->performRequest()
#9 /var/www-wiki.kostumekult.com/html/includes/Wiki.php(547): MediaWiki->main()
#10 /var/www-wiki.kostumekult.com/html/index.php(57): MediaWiki->run()
#11 {main}

Add
$wgFbDisableLogin = true;
to your LocalSettings.php.

Related

Magento 2: "main.CRITICAL: Exception message: Invalid header value detected" after creating customer with special character

After a customer tries to register with a special character in their name (accent), he/she receives the following message "We can't save the customer." and in debug.log I get the following errors:
[2020-01-02 12:11:19] main.CRITICAL: Exception message: Invalid header value detected
Trace: <pre>#1 Zend\Mail\Header\AbstractAddressList->getFieldValue(true) called at [vendor/zendframework/zend-mail/src/Header/AbstractAddressList.php:209]
#2 Zend\Mail\Header\AbstractAddressList->toString() called at [vendor/zendframework/zend-mail/src/Headers.php:427]
#3 Zend\Mail\Headers->toString() called at [vendor/zendframework/zend-mail/src/Message.php:546]
#4 Zend\Mail\Message->toString() called at [vendor/magento/framework/Mail/EmailMessage.php:217]
#5 Magento\Framework\Mail\EmailMessage->toString() called at [vendor/magento/framework/Mail/EmailMessage.php:209]
#6 Magento\Framework\Mail\EmailMessage->getRawMessage() called at [app/code/Mageplaza/Smtp/Mail/Transport.php:107]
#7 Mageplaza\Smtp\Mail\Transport->aroundSendMessage(&Magento\Email\Model\Transport\Interceptor#0000000051b4369900000000733b30a0#, &Closure#0000000051b436f900000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#8 Magento\Email\Model\Transport\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-email/Model/Mail/TransportInterfacePlugin.php:48]
#9 Magento\Email\Model\Mail\TransportInterfacePlugin->aroundSendMessage(&Magento\Email\Model\Transport\Interceptor#0000000051b4369900000000733b30a0#, &Closure#0000000051b436f900000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#10 Magento\Email\Model\Transport\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#11 Magento\Email\Model\Transport\Interceptor->___callPlugins('sendMessage', array(), NULL) called at [generated/code/Magento/Email/Model/Transport/Interceptor.php:26]
#12 Magento\Email\Model\Transport\Interceptor->sendMessage() called at [vendor/magento/module-customer/Model/EmailNotification.php:274]
#13 Magento\Customer\Model\EmailNotification->sendEmailTemplate(&Magento\Customer\Model\Data\Customer#0000000051b4362f00000000733b30a0#, 'customer/create_...', 'customer/create_...', array('customer' => &Magento\Customer\Model\Data\CustomerSecure#0000000051b434c000000000733b30a0#, 'back_url' => NULL, 'store' => &Magento\Store\Model\Store\Interceptor#0000000051b435c400000000733b30a0#), 1) called at [vendor/magento/module-customer/Model/EmailNotification.php:398]
#14 Magento\Customer\Model\EmailNotification->newAccount(&Magento\Customer\Model\Data\Customer#0000000051b4362f00000000733b30a0#, 'registered', NULL, 1) called at [vendor/magento/module-customer/Model/AccountManagement.php:963]
#15 Magento\Customer\Model\AccountManagement->sendEmailConfirmation(&Magento\Customer\Model\Data\Customer#0000000051b4362f00000000733b30a0#, NULL) called at [vendor/magento/module-customer/Model/AccountManagement.php:921]
#16 Magento\Customer\Model\AccountManagement->createAccountWithPasswordHash(&Magento\Customer\Model\Data\Customer#0000000051b4362f00000000733b30a0#, '2a93ede7eb5cddf6...', NULL) called at [generated/code/Magento/Customer/Model/AccountManagement/Interceptor.php:141]
#17 Magento\Customer\Model\AccountManagement\Interceptor->createAccountWithPasswordHash(&Magento\Customer\Model\Data\Customer#0000000051b434c500000000733b30a0#, '2a93ede7eb5cddf6...', NULL) called at [vendor/magento/module-customer/Model/AccountManagement.php:832]
#18 Magento\Customer\Model\AccountManagement->createAccount(&Magento\Customer\Model\Data\Customer#0000000051b434c500000000733b30a0#, 'HerrlichKraftvol...', NULL) called at [generated/code/Magento/Customer/Model/AccountManagement/Interceptor.php:128]
#19 Magento\Customer\Model\AccountManagement\Interceptor->createAccount(&Magento\Customer\Model\Data\Customer#0000000051b434c500000000733b30a0#, 'HerrlichKraftvol...', NULL) called at [vendor/magento/module-customer/Controller/Account/CreatePost.php:353]
#20 Magento\Customer\Controller\Account\CreatePost->execute() called at [generated/code/Magento/Customer/Controller/Account/CreatePost/Interceptor.php:50]
#21 Magento\Customer\Controller\Account\CreatePost\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
#22 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#23 Magento\Customer\Controller\Account\CreatePost\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#24 Magento\Customer\Controller\Account\CreatePost\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#25 Magento\Customer\Controller\Account\CreatePost\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#), array(array('designLoader', 'customerNotifica...', 'catalog_app_acti...', 'tax-app-action-d...', 'weee-app-action-...', 'customer_account', 'storeCheck', 'contextPlugin', 'customer-app-act...'), array('customer_account'))) called at [generated/code/Magento/Customer/Controller/Account/CreatePost/Interceptor.php:65]
#26 Magento\Customer\Controller\Account\CreatePost\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/App/FrontController.php:159]
#27 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#, &Magento\Customer\Controller\Account\CreatePost\Interceptor#0000000051b4333b00000000733b30a0#) called at [vendor/magento/framework/App/FrontController.php:99]
#28 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#29 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#30 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94]
#31 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#0000000051b4317300000000733b30a0#, &Closure#0000000051b4315800000000733b30a0#, &Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#32 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73]
#33 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#0000000051b4317300000000733b30a0#, &Closure#0000000051b4315800000000733b30a0#, &Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#34 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#35 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#), NULL) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#36 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000051b4309c00000000733b30a0#) called at [vendor/magento/framework/App/Http.php:137]
#37 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#38 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#39 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#0000000051b430f100000000733b30a0#) called at [index.php:39]
We already tried updating Zend, but this did not resolve the issue.
This is a bug of Magento version 2.3.3. It does not allow the use of special characters such as ã, ơ in store email address or sender mail.
This is a modified path
vendor\magento\framework\Mail\EmailMessage.php
Please replace function with this :
public function toString(): string
{
$this->message->setEncoding('utf-8');
return $this->message->toString();
}
In vendor/magento/framework/Mail/Template/TransportBuilder.php find the function prepareMessage(), find the below line
$this->message = $this->emailMessageInterfaceFactory->create($this->messageData);
and add this line before it:
$this->messageData['encoding'] = $mimePart->getCharset();
So it looks something like
$this->messageData['encoding'] = $mimePart->getCharset();
$this->message = $this->emailMessageInterfaceFactory->create($this->messageData);
return $this;

MediaWiki: Database schema error when searching

I installed MediaWiki on my Mac with MAMP (PHP7.2.10 and MySQL 5.7.23 InnoDB). No error occured and everything except the search works. It shows the following error instead of a result:
[c1af9047a60a292a781befdd] /mediawiki/index.php?search=test&title=Spezial%3ASuche&go=Seite Wikimedia\Rdbms\DBQueryError from line 1457 of /Users/xxx/www/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SHOW GLOBAL VARIABLES LIKE 'ft\_min\_word\_len'
Function: SearchMySQL::minSearchLength
Error: 1682 Native table 'performance_schema'.'global_variables' has the wrong structure (localhost)
Backtrace:
#0 /Users/xxx/www/mediawiki/includes/libs/rdbms/database/Database.php(1427): Wikimedia\Rdbms\Database->makeQueryException(string, integer, string, string)
#1 /Users/xxx/www/mediawiki/includes/libs/rdbms/database/Database.php(1200): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(446): Wikimedia\Rdbms\Database->query(string, string)
#3 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(402): SearchMySQL->minSearchLength()
#4 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(104): SearchMySQL->normalizeText(string)
#5 /Users/bxxx/www/mediawiki/includes/search/SearchMySQL.php(299): SearchMySQL->parseQuery(string, boolean)
#6 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(273): SearchMySQL->queryMain(array, string, boolean)
#7 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(188): SearchMySQL->getQuery(string, boolean)
#8 /Users/xxx/www/mediawiki/includes/search/SearchMySQL.php(178): SearchMySQL->searchInternal(string, boolean)
#9 /Users/xxx/www/mediawiki/includes/specials/SpecialSearch.php(318): SearchMySQL->searchTitle(string)
#10 /Users/xxx/www/mediawiki/includes/specials/SpecialSearch.php(185): SpecialSearch->showResults(string)
#11 /Users/xxx/www/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialSearch->execute(NULL)
#12 /Users/xxx/www/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)
#13 /Users/xxx/www/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#14 /Users/xxx/www/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()
#15 /Users/xxx/www/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()
#16 /Users/xxx/www/mediawiki/index.php(42): MediaWiki->run()
#17 {main}
A first attempt was to start the web updater, but /mwconfig/ only allows the download of the LocalSettings.php. No way to actually start it.
Any ideas? Thank you!
I think its a generell Problem with the MySQL installation. Reinstalling the server fixed it.

How can I fix backtrace errors in a MediaWiki database?

While I attempted to create a database for my second wiki as a part of a wiki family I have been planning on, I have experienced various errors and access messages. One of these has to do with the user. Even though I have checked all the privileges I could see in my MySQL database manager, the backtrace shows that there are still missing permissions. Please give me information on how to fix these errors and explain what parts of the permissions are missing.
Backtrace:
#0 /home/gjlxrtap/public_html/mw19/includes/libs/rdbms/database/Database.php(979): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#1 /home/gjlxrtap/public_html/mw19/includes/libs/rdbms/database/Database.php(1343): Wikimedia\Rdbms\Database->query(string, string)
#2 /home/gjlxrtap/public_html/mw19/includes/libs/rdbms/database/Database.php(1411): Wikimedia\Rdbms\Database->select(string, array, array, string, array, array)
#3 /home/gjlxrtap/public_html/mw19/includes/user/User.php(1287): Wikimedia\Rdbms\Database->selectRow(string, array, array, string, array)
#4 /home/gjlxrtap/public_html/mw19/includes/user/User.php(496): User->loadFromDatabase(integer)
#5 /home/gjlxrtap/public_html/mw19/includes/libs/objectcache/WANObjectCache.php(892): User->{closure}(boolean, integer, array, NULL)
#6 [internal function]: WANObjectCache->{closure}(boolean, integer, array, NULL)
#7 /home/gjlxrtap/public_html/mw19/includes/libs/objectcache/WANObjectCache.php(1012): call_user_func_array(Closure, array)
#8 /home/gjlxrtap/public_html/mw19/includes/libs/objectcache/WANObjectCache.php(898): WANObjectCache->doGetWithSetCallback(string, integer, Closure, array, NULL)
#9 /home/gjlxrtap/public_html/mw19/includes/user/User.php(521): WANObjectCache->getWithSetCallback(string, integer, Closure, array)
#10 /home/gjlxrtap/public_html/mw19/includes/user/User.php(441): User->loadFromCache()
#11 /home/gjlxrtap/public_html/mw19/includes/user/User.php(405): User->loadFromId(integer)
#12 /home/gjlxrtap/public_html/mw19/includes/session/UserInfo.php(88): User->load()
#13 /home/gjlxrtap/public_html/mw19/includes/session/CookieSessionProvider.php(119): MediaWiki\Session\UserInfo::newFromId(string)
#14 /home/gjlxrtap/public_html/mw19/includes/session/SessionManager.php(487): MediaWiki\Session\CookieSessionProvider->provideSessionInfo(WebRequest)
#15 /home/gjlxrtap/public_html/mw19/includes/session/SessionManager.php(190): MediaWiki\Session\SessionManager->getSessionInfoForRequest(WebRequest)
#16 /home/gjlxrtap/public_html/mw19/includes/WebRequest.php(735): MediaWiki\Session\SessionManager->getSessionForRequest(WebRequest)
#17 /home/gjlxrtap/public_html/mw19/includes/session/SessionManager.php(129): WebRequest->getSession()
#18 /home/gjlxrtap/public_html/mw19/includes/Setup.php(762): MediaWiki\Session\SessionManager::getGlobalSession()
#19 /home/gjlxrtap/public_html/mw19/includes/WebStart.php(114): require_once(string)
#20 /home/gjlxrtap/public_html/mw19/index.php(40): require(string)
#21 {main}

MediaWiki MWException - Global default '' is invalid for field stubthreshold

When I click on the Preferences link in our local MediaWiki (1.26.3), hosted on CentOS, I receive the following error:
Internal error
[fbd0dcc9] /index.php/Special:Preferences MWException from line 149 of /var/www/mediawiki-1.26.3/includes/Preferences.php: Global default '' is invalid for field stubthreshold
Backtrace:
#0 /var/www/mediawiki-1.26.3/includes/Preferences.php(101): Preferences::loadPreferenceValues(User, RequestContext, array)
#1 /var/www/mediawiki-1.26.3/includes/Preferences.php(1264): Preferences::getPreferences(User, RequestContext)
#2 /var/www/mediawiki-1.26.3/includes/specials/SpecialPreferences.php(67): Preferences::getFormObject(User, RequestContext)
#3 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPage.php(384): SpecialPreferences->execute(NULL)
#4 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#5 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)
#6 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(714): MediaWiki->performRequest()
#7 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(508): MediaWiki->main()
#8 /var/www/mediawiki-1.26.3/index.php(41): MediaWiki->run()
#9 {main}
Any assistance to resolve the issue is appreciated.
This error can appear for a number of reasons, but the most common is probably an invalid or missing value in $wgDefaultUserOptions in LocalSettings.php.
Default user settings can be changed like this:
$wgDefaultUserOptions['editsection'] = 0;
However, if you add something like this:
$wgDefaultUserOptions = array( 'editsection' => 0, 'watchdefault' => 1, 'watchmoves' => 1, ... );
while everything might seem to work just fine, as you have now overwritten the whole default array, you risk running into an error the next time a new user setting is added in the software, on a MediaWiki upgrade.
The error can also occur because of an extension that uses the UserGetDefaultOptions hook to modify default settings, or because one of the values given in $wgDefaultUserOptions is simply invalid.

Fatal exception of type MWException

I recently installed MediaWiki in localhost on Debian 7 System. But after the installation, I got the exception Fatal exception of type MWException. I reviewed all reported bugs, but they do not apply to me.
PHP 5.4.4
phpmyaddmin....
As written in the comments, edit your LocalSettings.php file and add this line at the very end:
$wgShowExceptionDetails = true;
Try reloading the page that gives you that error. You're likely to see what's called a backtrace... here is my example:
#0 /Users/user/www/extensions/LocalisationUpdate/LocalisationUpdate.class.php(553): LocalisationUpdate::filename('it')
#1 /Users/user/www/extensions/LocalisationUpdate/LocalisationUpdate.class.php(36): LocalisationUpdate::readFile('it')
#2 [internal function]: LocalisationUpdate::onRecache(Object(LocalisationCache), 'it', Array)
#3 /Users/user/www/includes/Hooks.php(255): call_user_func_array('LocalisationUpd...', Array)
#4 /Users/user/www/includes/GlobalFunctions.php(3883): Hooks::run('LocalisationCac...', Array)
#5 /Users/user/www/includes/cache/LocalisationCache.php(796): wfRunHooks('LocalisationCac...', Array)
#6 /Users/user/www/includes/cache/LocalisationCache.php(426): LocalisationCache->recache('it')
#7 /Users/user/www/includes/cache/LocalisationCache.php(310): LocalisationCache->initLanguage('it')
#8 /Users/user/www/includes/cache/LocalisationCache.php(245): LocalisationCache->loadItem('it', 'fallback')
#9 /Users/user/www/languages/Language.php(3978): LocalisationCache->getItem('it', 'fallback')
#10 /Users/user/www/languages/Language.php(230): Language::getFallbacksFor('it')
#11 /Users/user/www/languages/Language.php(189): Language::newFromCode('it')
#12 /Users/user/www/includes/Setup.php(497): Language::factory('it')
#13 /Users/user/www/includes/WebStart.php(161): require_once('/Users/user/3d...')
#14 /Users/user/www/index.php(55): require('/Users/user/3d...')
#15 {main}
The first line is the one that stopped the execution, causing the exception. If you can identify the problem (in my case it's the LocalisationUpdate extension) it can be very easy to fix. Again, in my case it's enough to open again LocalSettings.php and comment out or delete the line:
require_once( "$IP/extensions/LocalisationUpdate/LocalisationUpdate.php" );
There could be a problem with caching, try to use
$wgMainCacheType = CACHE_NONE;