Last modified: 2013-11-14 14:29:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44291, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42291 - Can't save non-default content model with $wgContentHandlerUseDB disabled: model is wikitext , default for EtherpadLite:Pad.modals.initsocketfail.cause/fr is text
Can't save non-default content model with $wgContentHandlerUseDB disabled: mo...
Status: NEW
Product: MediaWiki
Classification: Unclassified
ContentHandler (Other open bugs)
1.21.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 39480
  Show dependency treegraph
 
Reported: 2012-11-20 13:07 UTC by Niklas Laxström
Modified: 2013-11-14 14:29 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2012-11-20 13:07:36 UTC
Can't save non-default content model with $wgContentHandlerUseDB disabled: model is wikitext , default for EtherpadLite:Pad.modals.initsocketfail.cause/fr is text
Backtrace:
#0 /www/dev.translatewiki.net/w/includes/Revision.php(1262): Revision->checkContentModel()
#1 /www/dev.translatewiki.net/w/includes/WikiPage.php(1852): Revision->insertOn(Object(DatabaseMysql))
#2 /www/dev.translatewiki.net/w/includes/WikiPage.php(1571): WikiPage->doEditContent(Object(TextContent), 'Importing a new...', 48, false, Object(User))
#3 [internal function]: WikiPage->doEdit('La cause de ce ...', 'Importing a new...', 48, false, Object(User))
#4 /www/dev.translatewiki.net/w/includes/Article.php(1944): call_user_func_array(Array, Array)
#5 /www/dev.translatewiki.net/w/extensions/Translate/utils/MessageUpdateJob.php(40): Article->__call('doEdit', Array)
#6 /www/dev.translatewiki.net/w/extensions/Translate/utils/MessageUpdateJob.php(40): Article->doEdit('La cause de ce ...', 'Importing a new...', 48, false, Object(User))
#7 /www/dev.translatewiki.net/w/maintenance/runJobs.php(83): MessageUpdateJob->run()
#8 /www/dev.translatewiki.net/w/maintenance/doMaintenance.php(110): RunJobs->execute()
#9 /www/dev.translatewiki.net/w/maintenance/runJobs.php(116): require_once('/www/dev.transl...')
#10 {main}


I've had this code in my LocalSettings for a while:

$wgHooks['ContentHandlerDefaultModelFor'][] = function( $title, &$model ) {
	if ( $title->getNamespace() >= 1200 ) {
		$model = CONTENT_MODEL_TEXT;
	}
	return true;
};

Somehow the code seems to be treating pages with trailing whitespace differently from other pages.
Comment 1 Niklas Laxström 2012-11-20 13:17:20 UTC
Apparently it is not trailing whitespace. I thought so because the first one was:
Can't save non-default content model with $wgContentHandlerUseDB disabled: model is wikitext , default for EtherpadLite:Pad.share.link/fr is text
Backtrace:
#0 /www/dev.translatewiki.net/w/includes/Revision.php(1262): Revision->checkContentModel()
#1 /www/dev.translatewiki.net/w/includes/WikiPage.php(1852): Revision->insertOn(Object(DatabaseMysql))
#2 /www/dev.translatewiki.net/w/includes/WikiPage.php(1571): WikiPage->doEditContent(Object(TextContent), 'Importing a new...', 48, false, Object(User))
#3 [internal function]: WikiPage->doEdit('Lien ', 'Importing a new...', 48, false, Object(User))
#4 /www/dev.translatewiki.net/w/includes/Article.php(1944): call_user_func_array(Array, Array)
#5 /www/dev.translatewiki.net/w/extensions/Translate/utils/MessageUpdateJob.php(40): Article->__call('doEdit', Array)
#6 /www/dev.translatewiki.net/w/extensions/Translate/utils/MessageUpdateJob.php(40): Article->doEdit('Lien ', 'Importing a new...', 48, false, Object(User))
#7 /www/dev.translatewiki.net/w/maintenance/runJobs.php(83): MessageUpdateJob->run()
#8 /www/dev.translatewiki.net/w/maintenance/doMaintenance.php(110): RunJobs->execute()
#9 /www/dev.translatewiki.net/w/maintenance/runJobs.php(116): require_once('/www/dev.transl...')
#10 {main}


So it is even more mysterious while most of the messages work fine, but these few fail.
Comment 2 Niklas Laxström 2012-11-20 13:19:17 UTC
Sorry for going back and worth, it is the trailing whitespace, content was just truncated in the above backtrace.
Comment 3 Daniel Kinzler 2012-11-20 13:48:45 UTC
Some extension tells mediawiki that this page is not wikitext (probably using the TitleIsWikitextPage hook). Then, something else tries to save content of the page, telling mediawiki that the content *is* wikitext. But $wgContentHandlerUseDB = false gives mediawiki no way to record that fact, so it fails.

If the content of the page really is not wikitext, but (as currently assumed) plain text, set the content model accordingly when editing.
Comment 4 Daniel Kinzler 2012-11-20 13:50:48 UTC
Ah, sorry, didn't look at your code right. It's of course not TitleIsWikitextPage in that case but your handler for ContentHandlerDefaultModelFor telling mediawiki that this page isn't wikitext. 

The question is now, when where and why it is treated as wikitext and fails.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links