Extension:AddPageService

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
AddPageService

Release status: stable

Implementation User rights, Page action
Description Web service to add pages to the wiki.
Author(s) Fernando Correia (Fernando.correiatalk)
Latest version 1.0.1 (2007-01-31)
MediaWiki 1.8.2, 1.9.1
License No license specified
Download AddPageService.php

Translate the AddPageService extension if possible

Check usage and version matrix; code metrics

Introduction[edit | edit source]

AddPageService is a web service that enables external programs to add or edit pages on the wiki just as a regular user.

AddPageService.png

Features[edit | edit source]

  • Can add or edit pages.
  • Impersonates a wiki user.
  • Requires user name and password.
  • Has the same behavior as a manual edit.
  • Silently replaces invalid characters in page titles.

Installation[edit | edit source]

  1. Install Snoopy. Download it and extract it into some directory.
  2. Install PEAR SOAP. For instance, execute this command in the php directory:
    pear install channel://pear.php.net/soap-0.10.1
    
  3. Download AddPageService.php and save it in the extensions directory of your wiki.

Configuration[edit | edit source]

Edit the "Customization required" section in AddPageService.php:

  1. $wiki_root_url: Must point to the base URL of your wiki.
  2. Snoopy: Specify the correct path for the include directive for the Snoopy class.
  3. $debug_file_name: Specify a full pathname for a temporary debug file or an empty string to disable this feature.
    The debug file shows the wiki response to the request to open the edit form. Most problems can be diagnosed with the error messages in this file.
  4. $strict_title_rules: True to apply more strict rules about valid characters in page titles.
    With this option on, some characters that are valid but may cause problems will be substituted for spaces. For more information see Wikipedia:Naming conventions (technical restrictions).

Test[edit | edit source]

  1. Download TestAddPage.php and save it in the extensions directory of your wiki.
  2. Edit the "Customization required" section in TestAddPage.php:
    • $endpoint: The full URL of the AddPage web service.
    • $user: A valid wiki user name.
    • $password: The password of the $user.
    • $title: The title of the test page to be created.
    • $text: The contents of the test page to be created.
  3. Using the full URL, open TestAddPage.php in your browser. For instance:
    http://server/wiki/extensions/TestAddPage.php
    
  4. The web service answer will be shown. It will be "OK" or an error message.
  5. Verify that the test page shows on the "Recent changes" page on the wiki.

Usage[edit | edit source]

Information about using the web service in external programs:

  • The web service URL will be similar to this:
    http://server/wiki/extensions/AddPageService.php
    
  • The WSDL can be obtained by adding "?wsdl" to the URL, like this:
    http://server/wiki/extensions/AddPageService.php?wsdl
    
  • The web service method to be called is named addPage.
  • It has these parameters:
    1. title: page title (UTF-8 encoded).
    2. text: page text (UTF-8 encoded).
    3. user: wiki user name.
    4. password: wiki user password.
  • Use a high timeout. For instance, 30 seconds. The web service opens several web forms and may take a few seconds to answer.
  • Verify that the method returns "OK". Otherwise, show the returned error message.

Credits[edit | edit source]

Partially based on Bulk Page Creator.

Alternatives[edit | edit source]

Feedback[edit | edit source]

Use the discussion page for feedback, questions, feature requests and bug reports.