Hi,
for my extension I also deliver some test pages. Currently I'am exporting the test pages into a XML file and the wiki adminstrator could import them with importDump.php.
Is there a way that the extension automatically integrates some pages into the wiki (of course into my own namespace)?
Thanks in advance
Sigbert
On Thu, 10 Jul 2014 10:56:28 +0200, Sigbert Klinke sigbert@wiwi.hu-berlin.de wrote:
for my extension I also deliver some test pages. Currently I'am exporting the test pages into a XML file and the wiki adminstrator could import them with importDump.php.
Is there a way that the extension automatically integrates some pages into the wiki (of course into my own namespace)?
You could probably do it as part of the extension installation/upgrade process (which happens when the user executes `php maintenance/update.php`). I'm not sure how to set it up, but it should be possible.
You might also want to see how the main page is created during MediaWiki installation, see the Installer::createMainpage() method in /includes/installer/Installer.php.
On 14-07-10 04:56 AM, Sigbert Klinke wrote:
Hi,
for my extension I also deliver some test pages. Currently I'am exporting the test pages into a XML file and the wiki adminstrator could import them with importDump.php.
Is there a way that the extension automatically integrates some pages into the wiki (of course into my own namespace)?
I use something like the following:
<?php
$titleObj = Title::newFromText( "SomeNamespace:Some Article Title" ); $articleObj = new Article( $titleObj );
if( $articleObj ) { $flags = EDIT_MINOR; $articleObj->doEdit( 'This is the article text.', 'This is the edit summary.', $flags ); }
?>
Cheers, Rob.
On Jul 10, 2014, at 7:41 AM, Robert Cummings wrote:
On 14-07-10 04:56 AM, Sigbert Klinke wrote:
Hi,
for my extension I also deliver some test pages. Currently I'am exporting the test pages into a XML file and the wiki adminstrator could import them with importDump.php.
Is there a way that the extension automatically integrates some pages into the wiki (of course into my own namespace)?
I use something like the following:
<?php
$titleObj = Title::newFromText( "SomeNamespace:Some Article Title" ); $articleObj = new Article( $titleObj );
I would use WikiPage instead of Article, since a lot of the Article based hooks have been deprecated since 1.21
if( $articleObj ) { $flags = EDIT_MINOR; $articleObj->doEdit( 'This is the article text.', 'This is the edit summary.', $flags ); }
?>
Cheers, Rob. -- Phone: 613-822-9060 +++ Cell: 613-600-2836 E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized.
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
===================================== Jim Hu Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
On 14-07-10 10:23 AM, Jim Hu wrote:
On Jul 10, 2014, at 7:41 AM, Robert Cummings wrote:
On 14-07-10 04:56 AM, Sigbert Klinke wrote:
Hi,
for my extension I also deliver some test pages. Currently I'am exporting the test pages into a XML file and the wiki adminstrator could import them with importDump.php.
Is there a way that the extension automatically integrates some pages into the wiki (of course into my own namespace)?
I use something like the following:
<?php
$titleObj = Title::newFromText( "SomeNamespace:Some Article Title" ); $articleObj = new Article( $titleObj );
I would use WikiPage instead of Article, since a lot of the Article based hooks have been deprecated since 1.21
Thanks for the tip, we haven't jumped to 21 yet :)
Cheers, Rob.
Hi,
I'am using now:
$titleObj = Title::newFromText('Extension:Test2');
if (!$titleObj->exists()) {
$articleObj = new WikiPage($titleObj);
$articleObj->doEdit(file_get_contents($filename), 'Generated from extension');
}
But I'am getting the following warning and error with MediaWiki 1.23.0 when calling Title::newFromText :
PHP Warning: spl_object_hash() expects parameter 1 to be object, null given ... PHP Catchable fatal error: Argument 1 passed to MediaWikiTitleCodec::__construct() must be instance of Language, null given, ...
Any ideas?
Sigbert
mediawiki-l@lists.wikimedia.org