Last modified: 2014-09-11 15:04:29 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 T58569, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56569 - "Create pages with form" and sfEditFormPreloadText
"Create pages with form" and sfEditFormPreloadText
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Unprioritized normal with 3 votes (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-04 17:01 UTC by Nathan Douglas
Modified: 2014-09-11 15:04 UTC (History)
2 users (show)

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


Attachments

Description Nathan Douglas 2013-11-04 17:01:11 UTC
sfEditFormPreloadText hooks don't seem to be getting called when pages are created via the Create_pages_with_form property.

MW: 1.21.1
SMW: 1.8.0.5
SF: 2.6

Steps to reproduce:
1.  Make a sfEditFormPreloadText extension.
2.  Demonstrate that it works correctly by making a couple hundred articles using it in the conventional fashion.
3.  Insert subtle logging statement like die("I'm getting called!"); into first line of function.
4.  Add [[Create pages with form::<formname>]] statement to Property:Some_property.
5.  Run jobs and note that pages are getting created via the form but the preload function is not getting called or else the script would die, obv.
Comment 1 Yaron Koren 2013-11-04 17:20:28 UTC
Re-assigning to Stephan - this seems more like your territory. What do you think?
Comment 2 Nathan Douglas 2013-11-04 23:45:39 UTC
Looking at the actual code, there's clearly no wfRunHooks call along the code path invoked by this function, so it's not a matter of a bug.  

It would seem to be a fairly simple problem to solve -- just add in the wfRunHooks call before the call to formHTML() in... uh... whatever function I saw that was invoked in response to the Creates_pages_with_form property.  

However, my nice little attempted patch didn't work.  And furthermore, replacing the variable with 'WHEEEEEEEEEEEEEE!!!!' still led to pages created with e.g. {{Form_Template|param1=arg}} rather than the expected 'WHEEEEEEEEEEEEEE!!!!' (or even containing that string at all... I thought it might be thrown in free text or something, but it wasn't).  

In other words, there's something going on in formHTML() that I hadn't anticipated, and I don't have the patience or knowledge to tinker with that function :/
Comment 3 Nathan Douglas 2013-11-04 23:47:12 UTC
Not that you don't know any of that, but I thought I'd mention it to show I'm making a good-faith effort to contribute and not just whining :)
Comment 4 Gerrit Notification Bot 2013-11-05 21:05:00 UTC
Change 93813 had a related patch set uploaded by Foxtrott:
fix bug 56569 ("Create pages with form" and sfEditFormPreloadText)

https://gerrit.wikimedia.org/r/93813
Comment 5 s7eph4n 2013-11-05 21:07:10 UTC
Nathan, could you try, if the patched version works as expected?
Comment 6 Gerrit Notification Bot 2013-11-05 21:17:27 UTC
Change 93813 merged by Yaron Koren:
fix bug 56569 ("Create pages with form" and sfEditFormPreloadText)

https://gerrit.wikimedia.org/r/93813
Comment 7 Nathan Douglas 2013-11-05 21:42:27 UTC
Sorry, folks, it doesn't work for me.  

It doesn't seem as though SFFormLinker::createLinkedPage() or SFCreatePageJob go through the API, but that could just be my lack of familiarity with the code and using a glorified text editor instead of a real IDE :/
Comment 8 Gerrit Notification Bot 2013-11-05 22:14:39 UTC
Change 93865 had a related patch set uploaded by Foxtrott:
fix bug 56569 ("Create pages with form" and sfEditFormPreloadText)

https://gerrit.wikimedia.org/r/93865
Comment 9 s7eph4n 2013-11-05 22:16:08 UTC
Seems I fixed a different bug with the first patch. Could you try the new patch, please?
Comment 10 Nathan Douglas 2013-11-05 22:31:27 UTC
Still not working.  For the record, that's very close to the patch I attempted and mentioned briefly in comment #2.  formHTML() hates my guts?

FWIW, the pages created for this test previously existed but were deleted (since they didn't contain the desired data).  Just in case the presence of a deleted article is a possibly confounding issue...
Comment 11 Nathan Douglas 2013-11-06 00:12:12 UTC
Actually, just noticed that Change 93813 seems to break my extension -- from what I can tell, the $preloadContent variable is populated correctly but never inserted.  Never utilized by formHTML()?
Comment 12 Nathan Douglas 2013-11-20 14:16:32 UTC
To reiterate, I think this commit may break all sfEditFormPreloadText extensions.
Comment 13 Nathan Douglas 2014-01-08 01:03:48 UTC
A new sfEditFormPreloadText extension doesn't work either. This is with the latest commit (#c1b52276c2492a51 or so).
Comment 14 Nathan Douglas 2014-05-09 20:13:19 UTC
Still doesn't work.  Am I the only person who uses sfEditFormPreloadText?  

Maybe what I should do is turn my extensions into regular text preloading extensions, create and save the page, *then* edit it with the form.
Comment 15 cariaso 2014-05-12 02:39:55 UTC
You are not the only one. An important feature of SNPedia is impacted by this. 

This is a regression of 
https://bugzilla.wikimedia.org/show_bug.cgi?id=47150
Comment 16 Nathan Douglas 2014-05-12 19:41:06 UTC
Thanks for the information, cariaso.  I'm glad to have some more of the context to flesh out this cluster of issues.
Comment 17 cariaso 2014-08-04 04:10:00 UTC
I spent some time looking at this, and am confident that the function which is hooked to 'sfEditFormPreloadText'

is being called for existing pages

is _not_ being called for non existent pages
Comment 18 cariaso 2014-08-04 04:37:43 UTC
The problem originates near
SF_FormEditAction.php Line 157


static function displayForm( $action, $article ) {
	        // @todo: This looks like bad code. If we can't find a form, we
		// should be showing an informative error page rather than
		// making it look like an edit form page does not exist.
                $title = $article->getTitle();
		$form_names = SFFormLinker::getDefaultFormsForPage( $title );
                if ( count( $form_names ) == 0 ) {
	                return true;
		}

notice the @todo comment, suggesting this code was never quite finished. returning true here, bails out before the 
                SFFormEdit::printForm( $form_name, $page_name );
a few lines further down in the code. 

for pages which exist, they eventually get down to the hook code via this route.

#0 [internal function]: prefillForm(string, Title, Title)
#1 /var/www/html/includes/Hooks.php(206): call_user_func_array(string, array)
#2 /var/www/html/includes/GlobalFunctions.php(4004): Hooks::run(string, array, NULL)
#3 /var/www/html/extensions/SemanticForms/includes/SF_AutoeditAPI.php(834): wfRunHooks(string, array)
#4 /var/www/html/extensions/SemanticForms/includes/SF_AutoeditAPI.php(116): SFAutoeditAPI->doAction()
#5 /var/www/html/extensions/SemanticForms/specials/SF_FormEdit.php(92): SFAutoeditAPI->execute()
#6 /var/www/html/extensions/SemanticForms/includes/SF_FormEditAction.php(173): SFFormEdit::printForm(string, string)
#7 /var/www/html/extensions/SemanticForms/includes/SF_FormEditAction.php(27): SFFormEditAction::displayForm(SFFormEditAction, Article)
#8 /var/www/html/includes/Wiki.php(428): SFFormEditAction->show()
#9 /var/www/html/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
#10 /var/www/html/includes/Wiki.php(588): MediaWiki->performRequest()
#11 /var/www/html/includes/Wiki.php(447): MediaWiki->main()
#12 /var/www/html/index.php(46): MediaWiki->run()
#13 {main}

however empty pages bail out early, and never get the chance to prepopulate their page text.
Comment 19 Gerrit Notification Bot 2014-09-11 08:57:48 UTC
Change 93865 had a related patch set uploaded by Qgil:
fix bug 56569 ("Create pages with form" and sfEditFormPreloadText)

https://gerrit.wikimedia.org/r/93865
Comment 20 Gerrit Notification Bot 2014-09-11 14:37:15 UTC
Change 93865 merged by Yaron Koren:
fix bug 56569 ("Create pages with form" and sfEditFormPreloadText)

https://gerrit.wikimedia.org/r/93865
Comment 21 Nathan Douglas 2014-09-11 15:04:29 UTC
As far as I can tell, this still breaks all sfEditFormPreloadText extensions.

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


Navigation
Links