XML-RPC functions

XML-RPC functions

XML-RPC functions -- XML-RPC function API documentation

What XML-RPC functions are available in a standard channel?

A standard PEAR channel should support this list of XML-RPC functions:

Channels can also implement channel.listAll, but we recommend that this only be implemented by pear.php.net and pecl.php.net channels, as the command is utilized by the update-channels command to retrieve an official list of channels.

logintest

The logintest xml-rpc function is called by the login command, and should return a boolean TRUE

package.getDownloadURL

false|struct packageinfo

an array of format:

array(
        'channel' => channel name,
        'package' => package name,
        ['version' => specific version to retrieve,]
        ['state' => specific state to retrieve,]
     )

if both version and state are set, the version index should be ignored.

string preferred_state = stable

The client-side preferred_state. This should be used to exclude releases that are too unstable.

string installed_version = false

The current installed version of the package on the client-side. This will either be a version string, or false if the package is not installed. Use this to ensure that older versions are never returned (as defined by version_compare(possible_version, installed_version, "<")).

The package.getDownloadURL function should return an array with either two or three indices.

  • "version" => version of the release returned

  • "info" => the complete package.xml contents from the release

  • "url" => a URL from which to download this release. If no releases exist that fit the constraints defined by preferred_state, installed_version, and the version/state indices of packageinfo, then do not return this index, and instead return the version and package.xml of the latest release.

    The url entry should NOT append .tgz or .tar, but should be something like "http://pear.php.net/get/PEAR-1.4.0" instead of "http://pear.php.net/get/PEAR-1.4.0.tgz"

Note that version 1.0 of package.getDownloadURL did not have the installed_version parameter. Version 1.1 of package.getDownloadURL does - that is the only difference between the two versions.

package.getDepDownloadURL

string xsdversion

This should be either '1.0' or '2.0', and should match the version attribute from the top-level <package version="X.0"> tag. This should be used to determine how to process the second parameter.

struct dependency

if the first parameter xsdversion is '1.0', this should be an array of format:

array(
        'name' => package name
        'type' => 'pkg' - anything else is an error
        'rel' => 'has', 'ge', 'le', 'lt', 'le', 'not', 'ne'
        ['version' => specific version to retrieve,]
     )

if xsdversion is '2.0', this should be an array of format:

array(
        'name' => package name
        'channel' => package channel - see notes below
        ['min' => minimum version (inclusive),]
        ['max' => maximum version (inclusive),]
        ['exclude' => single version to exclude (string),
                      or array of versions to exclude,]
     )

Note that you must always verify that the channel matches your channel. If your channel server is not at pear.php.net or pecl.php.net, you must reject all xsdversion='1.0' requests, and all xsdversion='2.0' requests where the channel is not your channel.

struct parentpackage

This is information on the parent package, and is an array of format:

array(
        'channel' => channel name,
        'package' => package name,
        'version' => specific version to retrieve,
     )

string preferred_state = stable

The client-side preferred_state. This should be used to exclude releases that are too unstable.

string installed_version = false

The current installed version of the dependency on the client-side. This will either be a version string, or false if the package is not installed. Use this to ensure that older versions are never returned (as defined by version_compare(possible_version, installed_version, "<")).

Like package.getDownloadURL, package.getDepDownloadURL should return an array with either two or three indices.

  • "version" => version of the release returned

  • "info" => the complete package.xml contents from the release

  • "url" => a URL from which to download this release. If no releases exist that fit the constraints defined by preferred_state, installed_version, and the version/state indices of packageinfo, then do not return this index, and instead return the version and package.xml of the latest release.

    The url entry should NOT append .tgz or .tar, but should be something like "http://pear.php.net/get/PEAR-1.4.0" instead of "http://pear.php.net/get/PEAR-1.4.0.tgz"

Note that version 1.0 of package.getDepDownloadURL did not have the installed_version parameter. Version 1.1 of package.getDepDownloadURL does - that is the only difference between the two versions.

package.info

string package

Package name to retrieve information about

string field = null

specific field to retrieve information about. If null, this should return an array with this indices, although others could be set as well:

<?php
array(
    'name' => 'package name',
    'category' => 'category name',
    'license' => 'package license',
    'summary' => 'package summary',
    'description' => 'package description',
    'releases' =>
    array( // all releases indexed by version
        '0.1' =>
        array(
          'license' => 'release license',
          'summary' => 'release summary',
          'description' => 'release description',
          'releasedate' => 'date of release',
          'releasenotes' => 'release notes',
          'state' => 'release stability',
          // the next index is optional
          'deps' =>
          array(
            array( // release dependencies of latest release
              'type' => 'dep type from package.xml <dep>',
              'relation' => 'rel from package.xml <dep>',
              'version' => 'version from package.xml <dep>, or empty string',
              'name' => 'name from package.xml <dep>',
              'optional' => 'yes or no',
            ),
            // and so on with all deps
          ),
        ),
        // and so on with all releases
        // releases should be ordered by releasedate DESC
    ),
);
?>

The second parameter, if set, must be one of these choices:

  • authors - a current list of package maintainers in format:

    <?php
    array(
        'handle1' =>
        array(
          'name' => 'Maintainer Name',
          'email' => 'maintainer@example.com',
          'role' => 'role from package.xml (lead, developer, contributor, helper)',
        ),
        'handle2' =>
        array(
          'name' => 'Maintainer Name 2',
          'email' => 'maintainer2@example.com',
          'role' => 'role from package.xml (lead, developer, contributor, helper)',
        ),
        // etc.
    );
    ?>

  • category - the category this package is in

  • description - the description of the latest release

  • license - package license of latest release

  • notes - release notes of the latest release

  • releases - an array of the format documented above, containing information on all releases

  • summary - summary from latest release

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.