Creating wiki pages directly by program

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating wiki pages directly by program

Hugh Prior
I would like to be able to create wiki pages by just calling a function to
which I pass the name of the new page and the text which I want on the page.
I have managed a solution where I just hack directly into the tables
(bypassing all the mediawiki code), but started to hit code translation type
problems, so I think it is best to do it building on all the wisdom already
built into the mediawiki code.

The sort of "createPage()" function which I have so far got, but which does
not work, is as follows:

/**
* Pass the name of the new page and the content and create the page
*/
function createPage($wikiPageName, $pageText) {
  $title = new Title();
  $title = $title->newFromText($wikiPageName);
  $article = new Article($title);
  $article->insertNewArticle($pageText, "No summary", false, false);
}

Anybody done this before?  Any ideas what I need to do specifically to get
this working?

I have tried to trace through what the "index.php" file does when creating a
page, but it's not easy to follow particularly because of the way in which
the parameters are often implicit (e.g. via POST of form data).

Thanks for any help!



Hugh Prior



_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Creating wiki pages directly by program

Rob Church
A good place to look for a simple example is the
maintenance/InitialiseMessages.inc include file, which contains a
chunk that shows how to create/edit pages in a programmatic fashion.


Rob Church

On 02/02/06, Hugh Prior <[hidden email]> wrote:

> I would like to be able to create wiki pages by just calling a function to
> which I pass the name of the new page and the text which I want on the page.
> I have managed a solution where I just hack directly into the tables
> (bypassing all the mediawiki code), but started to hit code translation type
> problems, so I think it is best to do it building on all the wisdom already
> built into the mediawiki code.
>
> The sort of "createPage()" function which I have so far got, but which does
> not work, is as follows:
>
> /**
> * Pass the name of the new page and the content and create the page
> */
> function createPage($wikiPageName, $pageText) {
>   $title = new Title();
>   $title = $title->newFromText($wikiPageName);
>   $article = new Article($title);
>   $article->insertNewArticle($pageText, "No summary", false, false);
> }
>
> Anybody done this before?  Any ideas what I need to do specifically to get
> this working?
>
> I have tried to trace through what the "index.php" file does when creating a
> page, but it's not easy to follow particularly because of the way in which
> the parameters are often implicit (e.g. via POST of form data).
>
> Thanks for any help!
>
>
>
> Hugh Prior
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Require an email address

Strahn
As everything here is written in English, I repeat my question.
 
About: User administration
How do I require an email address be specified at registration?

Greetings from Germany,
Dennis

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Require an email address

Brion Vibber
Strahn wrote:
> As everything here is written in English, I repeat my question.
>  
> About: User administration
> How do I require an email address be specified at registration?

This isn't supported at this time, but if you hack around it can be made to
work. Ask the guys running wiki.creativecommons.org for their patch.

-- brion vibber (brion @ pobox.com)


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

signature.asc (257 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Creating wiki pages directly by program

Gilad Ravid
In reply to this post by Hugh Prior
Hi,

You can use Perl program to submit the HTML forms. I used it to upload few
hundreds of HTML pages to wiki. The main function looks:

my $response=$browser->post("$server/index.php?title=$title&action=submit",
@ns_headers,Content_Type=>'form-data',Content=>[
                        wpTextbox1=>$clean_pageU,
                        wpSummary=>'',
                        wpSave=>"Save page",
                        wpSection=>'',
                        wpEdittime=>'',
                        wpEditToken=>$editToken
                ]);

Where the variable $clean_PageU include all the page text.


Gilad



============================================
Facts are stubborn things, but statistics are more pliable.
--Mark Twain
 
Dr. Gilad Ravid
Tel: +972-8-6472772
Mobile: +972-54-4905391
http://www.ravid.org/gilad
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Hugh Prior
Sent: Thursday, February 02, 2006 4:56 PM
To: [hidden email]
Subject: [Mediawiki-l] Creating wiki pages directly by program

I would like to be able to create wiki pages by just calling a function to
which I pass the name of the new page and the text which I want on the page.

I have managed a solution where I just hack directly into the tables
(bypassing all the mediawiki code), but started to hit code translation type

problems, so I think it is best to do it building on all the wisdom already
built into the mediawiki code.

The sort of "createPage()" function which I have so far got, but which does
not work, is as follows:

/**
* Pass the name of the new page and the content and create the page
*/
function createPage($wikiPageName, $pageText) {
  $title = new Title();
  $title = $title->newFromText($wikiPageName);
  $article = new Article($title);
  $article->insertNewArticle($pageText, "No summary", false, false);
}

Anybody done this before?  Any ideas what I need to do specifically to get
this working?

I have tried to trace through what the "index.php" file does when creating a

page, but it's not easy to follow particularly because of the way in which
the parameters are often implicit (e.g. via POST of form data).

Thanks for any help!



Hugh Prior



_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.0/248 - Release Date: 01/02/2006
 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.0/249 - Release Date: 02/02/2006
 

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Email platform questions

malcolm stanley
In reply to this post by Brion Vibber
Slightly different question
 
In Joomla! I can configure email so it uses my Yahoo! smtp account for outbound email
That works a treat for authentication and relieves me of having to understand sendmail :-)
 
In Mediawiki the assumption appears to be that mail is working on the host server:
I can find very little documentation on the subject and what documentation there is does not directly answer my question, which is:
 
'how do I configure mediawiki to use a third party smtp mail service for outbound email?'
 
Thanks
 
Malcolm

----- Original Message ----
From: Brion Vibber <[hidden email]>
To: MediaWiki announcements and site admin list <[hidden email]>
Sent: Friday, February 03, 2006 3:23:11 AM
Subject: Re: [Mediawiki-l] Require an email address


Strahn wrote:
> As everything here is written in English, I repeat my question.
>  
> About: User administration
> How do I require an email address be specified at registration?

This isn't supported at this time, but if you hack around it can be made to
work. Ask the guys running wiki.creativecommons.org for their patch.

-- brion vibber (brion @ pobox.com)
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Email platform questions

Brion Vibber
malcolm stanley wrote:
> In Joomla! I can configure email so it uses my Yahoo! smtp account for outbound email
> That works a treat for authentication and relieves me of having to understand sendmail :-)
>  
> In Mediawiki the assumption appears to be that mail is working on the host server:
> I can find very little documentation on the subject and what documentation there is does not directly answer my question, which is:
>  
> 'how do I configure mediawiki to use a third party smtp mail service for outbound email?'

Set $wgSMTP, and make sure PEAR::Mail is installed and in the include_path.

See the doc comment in DefaultSettings.php.

-- brion vibber (brion@  pobox.com)


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

signature.asc (257 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Email platform questions

malcolm stanley
Brion

Thank you for your reply
however, I still find this confusing and hope you will
bear with me

you said in your reply:
Set $wgSMTP, and make sure PEAR::Mail is installed and
in the
include_path.

See the doc comment in DefaultSettings.php.

a) I am using netBSD. In pkgsrc there is a
pear-mail_mime pkg but not a pear-mail pkg. Do you
know if they are the same thing?

b) in the DefaultSettings.php the relevant section is:

/**
 * SMTP Mode
 * For using a direct (authenticated) SMTP server
connection.
 * Default to false or fill an array :
 * <code>
 * "host" => 'SMTP domain',
 * "IDHost" => 'domain for MessageID',
 * "port" => "25",
 * "auth" => true/false,
 * "username" => user,
 * "password" => password
 * </code>
 *
 * @global mixed $wgSMTP
 */
$wgSMTP                         = false;

this is confusing: do I uncomment the array or the
code block, or not? when I uncomment it I get errors
thrown...

Also, it is unclear what value IDHost should have or
represent.

finally, is it correct that username and password are
not in quotes?

Thanks in advance and sorry to be such a pain...

/malcolm

--- Brion Vibber <[hidden email]> wrote:

> malcolm stanley wrote:
> > In Joomla! I can configure email so it uses my
> Yahoo! smtp account for outbound email
> > That works a treat for authentication and relieves
> me of having to understand sendmail :-)
> >  
> > In Mediawiki the assumption appears to be that
> mail is working on the host server:
> > I can find very little documentation on the
> subject and what documentation there is does not
> directly answer my question, which is:
> >  
> > 'how do I configure mediawiki to use a third party
> smtp mail service for outbound email?'
>
> Set $wgSMTP, and make sure PEAR::Mail is installed
> and in the include_path.
>
> See the doc comment in DefaultSettings.php.
>
> -- brion vibber (brion@  pobox.com)
>
> > _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
>
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Email platform questions

Brion Vibber
malcolm stanley wrote:
> a) I am using netBSD. In pkgsrc there is a
> pear-mail_mime pkg but not a pear-mail pkg. Do you
> know if they are the same thing?

I wouldn't know.

Check in your PHP dir (perhaps /usr/local/lib/php) for a 'Mail' subdirectory and
'Mail.php'. If it's not there, you may have to install it; you can use the pear
installer:

  pear install Mail

> this is confusing: do I uncomment the array or the
> code block, or not? when I uncomment it I get errors
> thrown...

It's not a code block, it's some pseudocode description.

> Also, it is unclear what value IDHost should have or
> represent.

It's apparently the hostname to use in constructing a message id. I'm not
totally certain how necessary it is.

> finally, is it correct that username and password are
> not in quotes?

String literals are in quotes. Variables are not in quotes. Constants are not in
quotes.

-- brion vibber (brion @ pobox.com)


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

signature.asc (257 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Email platform questions

malcolm stanley
Got it
thanks...

--- Brion Vibber <[hidden email]> wrote:

> malcolm stanley wrote:
> > a) I am using netBSD. In pkgsrc there is a
> > pear-mail_mime pkg but not a pear-mail pkg. Do you
> > know if they are the same thing?
>
> I wouldn't know.
>
> Check in your PHP dir (perhaps /usr/local/lib/php)
> for a 'Mail' subdirectory and
> 'Mail.php'. If it's not there, you may have to
> install it; you can use the pear
> installer:
>
>   pear install Mail
>
> > this is confusing: do I uncomment the array or the
> > code block, or not? when I uncomment it I get
> errors
> > thrown...
>
> It's not a code block, it's some pseudocode
> description.
>
> > Also, it is unclear what value IDHost should have
> or
> > represent.
>
> It's apparently the hostname to use in constructing
> a message id. I'm not
> totally certain how necessary it is.
>
> > finally, is it correct that username and password
> are
> > not in quotes?
>
> String literals are in quotes. Variables are not in
> quotes. Constants are not in
> quotes.
>
> -- brion vibber (brion @ pobox.com)
>
> > _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
>
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l