[Mediawiki-l] Page Table

Rob Church robchur at gmail.com
Sat Feb 18 16:04:04 UTC 2006


When passing the title to the article, use the appropriate function to
build a title given the namespace number and title text, e.g.

$article = new Article( Title::makeTitle( $namespace, $title ) );


Rob Church

On 17/02/06, Amruta Lonkar <amrutasl at gmail.com> wrote:
> I forgot to type this in the previous mail. Also i am trying to add the page
> to a specific namespace . Can you suggest what i need to add to your code to
> do that?
>
> On 2/17/06, Amruta Lonkar <amrutasl at gmail.com> wrote:
> >
> > So is it not ecessary to insert anything in the page table?. You return
> > the $revid in your code, will that be necessary if i just want to create a
> > page with the text?
> >
> > Thanks,
> > Amruta
> >
> >
> >  On 2/17/06, Hugh Prior <mediawiki at localpin.com> wrote:
> > >
> > > I have created a little function (I think based on the same stuff Rob
> > > Church
> > > suggested a while back) which does what I need in terms of creating a
> > > page
> > > calling other existing stuff.  I offer it here for whatever use you can
> > > make
> > > of it:
> > >
> > > /**
> > > * Create a wiki page
> > > */
> > > function createWikiPage($wikiPageName, $pageText="(Page text default in
> > > createWikiPage)") {
> > > $dbw =& wfGetDB( DB_MASTER );
> > >
> > > # Process each message
> > > $title = new Title();
> > > $title = $title->newFromText($wikiPageName);
> > >
> > > $article = new Article( $title );
> > > $newid = $article->insertOn( $dbw );
> > > # FIXME: set restrictions
> > > $revision = new Revision( array(
> > > 'page'      => $newid,
> > > 'text'      => $pageText,
> > > 'user'      => 0,
> > > 'user_text' => "This page automatically created by ".__FILE__,
> > > 'comment'   => '',
> > > ) );
> > > $revid = $revision->insertOn( $dbw );
> > > $article->updateRevisionOn( $dbw, $revision );
> > >
> > > $dbw->commit();
> > >
> > > return $revid;
> > > }
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > MediaWiki-l mailing list
> > > MediaWiki-l at Wikimedia.org
> > > http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
> > >
> >
> >
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>



More information about the MediaWiki-l mailing list