Hi all,
I’m trying set set up a MediaWiki installation where some of the settings from LocalSettings.php can be edited through the interface by bureaucrats. For practise, I’m trying to set it up in my localhost using wamp. The process is not as simple as getting the content from the URL, as this grabs all the HTML code for the page, not just the content of the page, so I’ve found that the best option is probably to use the database. As an example, we will use $wgSitename. The best option that I have thought of is as follows:
Create the interface page, for example, MediaWiki:Sitename.
In LocalSettings.php
Step 1
Query the page table for the entry with the namespace 8 (which is the MediaWiki: namespace) in the page_namespace column, and Sitename in the page_title column.
This gets us the MediaWiki:Sitename entry if you’re following me so far (I’m not the best at this).
Once you have this, find the value of page_latest for that entry. Create an array from this value (such as $mw1Sitename).
Step 2
In the revision table, find the entry with the value from Step 1 ($mw1Sitename) in the rev_id column, to find the value of the rev_text_id column for that entry. This value becomes $mw2Sitename.
Step 3
In the text table, find the entry with the value from Step 2 ($mw2Sitename) in the old_id column, to find the value of the old_text column for that entry. This value becomes $mw3Sitename.
The value of $mw3Sitename then becomes the value of $wgSitename, and it should work, now changing the content of the MediaWiki:Sitename page to Test Wiki should change all the appropriate vales in the database, and the value for $wgSitename should become Test Wiki. This can’t be done directly (in one step) because each of the database values changes every time the page is edited.
I’ve researched about the MediaWiki database and have found that this method is how MediaWiki itself actually loads the content for pages.
Could anyone please provide the code that I would use to do this, or a better method? Thanks!