Extension talk:Page Forms/MediaWiki red links code change

Add topic
From mediawiki.org
Latest comment: 15 years ago by Yaron Koren in topic Newer versions of MW

Newer versions of MW[edit]

Is this core hack still necessary in newer versions of MediaWiki? If so, can we insert a hook into the codebase from which an extension could do the job instead? --Jimbojw (talk | blog) 15:48, 1 August 2008 (UTC)Reply

Now that I think about it, I think the same could be achieved by a function hooking into ArticleFromTitle. It would go something like this:
  1. Check to see that "action=edit" and "redlink=1", if not return true
  2. Run $title through sffAddDataLink() (or something similar to find whether there's a default form), if not, return true
  3. Create an instance of SFAddData with the form and target members preloaded (would have to code in support for preloaded vars rather than ripping from URL) and use it to overwrite $article, return false
Alternatively, the ArticleFromTitle hook could instead issue an HTTP 301 or 302 redirect to Special:AddData, using the output from sffAddDataLink(). This would require no change to SemantiForms at all except for the addition of the new hook. In either case, it should be possible to solve the redlink-directly-to-form problem in all supported versions of MediaWiki without any core hacking at all :) --Jimbojw (talk | blog) 16:14, 1 August 2008 (UTC)Reply

Hi,

The core hack is not necessary in versions 1.13 and above of MediaWiki, and possibly not in 1.12 either (I don't know either way, though I suspect it's still necessary in 1.12). Unfortunately, there are a few problems that I think make a solution like the one you've suggested impossible, as nice as it would be: first, I don't want to ever overwrite the ability to do normal editing on a page; and second, different pages linking to the same nonexistent page may have contradictory information about what form that page should use - thus, I think only the linking page should specify what form the nonexistent page should get, as opposed to the nonexistent page having that knowledge itself. Yaron Koren 14:39, 4 August 2008 (UTC)Reply