Child pages
  • UAPI Functions - WordPressInstanceManager::configure_autoupdate
Skip to end of metadata
Go to start of metadata

Description

This function configures a WordPress® cPAddon instance's automatic updates settings. If you enable automatic updates for a legacy WordPress cPAddon instance, the function will convert it to use the RPM-based WordPress cPAddon.

Important:

This function changes the instance's automatic update setting in the wp-config.php file. Before you run this function, you should verify that a filter does not exist for the automatic update settings. Use the get_instance_by_id function and view the autoupdate.core.has_filter return to determine if a filter exists.

Note:

You must install the WordPress Manager cPanel plugin to access this API function.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/WordPressInstanceManager/configure_autoupdate?id=cPanel__Blogs__WordPressX.0.1491917088&autoupdate.core.major=0&autoupdate.core.minor=0


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Configure a single WordPress instance's automatic update settings.
 $instances = $cpanel->uapi(
    'WordPressInstanceManager', 'configure_autoupdate',
	    array(
        'id'         			=> 'cPanel__Blogs__WordPressX.0.1491917088',
		'autoupdate.core.major'	=> '0',
		'autoupdate.core.minor' => '0',
        )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Configure a single WordPress instance's automatic update settings.
my $instances = $cpliveapi->uapi(
    'WordPressInstanceManager', 'get_instance_by_id',
	    {
        'id'        			=> 'cPanel__Blogs__WordPressX.0.1491917088',
		'autoupdate.core.major'	=> '0',
		'autoupdate.core.minor' => '0',
        }
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Configure a single WordPress instance's automatic update settings.. -->
[% data = execute( 'WordPressInstanceManager', 'configure_autoupdate'{ 'id' => 'cPanel__Blogs__WordPressX.0.1491917088','autoupdate.core.major' => '0', 'autoupdate.core.minor' => '0', } ); %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username WordPressInstanceManager configure_autoupdate id=cPanel__Blogs__WordPressX.0.1491917088 autoupdate.core.major=0 autoupdate.core.minor=0


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 

 Output (JSON)
{
   "apiversion" : 3,
   "result" : {
      "messages" : null,
      "data" : {
         "before" : {
            "admin_username" : "wpadmin",
            "id" : "cPanel__Blogs__WordPress.1.1509732223",
            "db_prefix" : "example",
            "homedir" : "/home/example",
            "db_type" : "mysql",
            "db_username" : "example_wp1",
            "db_name" : "example_wp1",
            "available_version" : 4.1,
            "admin_url" : "example.com/wordpress-41/wp-login.php",
            "db_server" : "localhost",
            "addon_config" : "/home/example/.cpaddons/cPanel::Blogs::WordPress.1.yaml",
            "addon_name" : "cPanel::Blogs::WordPress",
            "addon_type" : "legacy",
            "current_version" : 4.1,
            "full_path" : "/home/example/public_html/wordpress-41",
            "initial_install_version" : "4.1",
            "domain" : "example.com",
            "site_url" : "example.com/wordpress-41",
            "rel_path" : "wordpress-41"
         },
         "after" : {
            "db_username" : "example_wp1",
            "db_name" : "example_wp1",
            "db_type" : "mysql",
            "homedir" : "/home/example",
            "migrated_from" : "cPanel::Blogs::WordPress",
            "addon_config" : "/home/example/.cpaddons/cPanel::Blogs::WordPressX.2.yaml",
            "admin_url" : "example.com/wordpress-41/wp-login.php",
            "db_server" : "localhost",
            "available_version" : 4.9.1,
            "admin_username" : "wpadmin",
            "db_prefix" : "example",
            "id" : "cPanel__Blogs__WordPressX.2.1509732223",
            "domain" : "example.com",
            "rel_path" : "wordpress-41",
            "site_url" : "example.com/wordpress-41",
            "migrated_on" : "1513965986",
            "addon_type" : "modern",
            "addon_name" : "cPanel::Blogs::WordPressX",
            "initial_install_version" : "4.1",
            "full_path" : "/home/example.com/public_html/wordpress-41",
            "current_version" : 4.9.1
         }
      },
      "errors" : null,
      "status" : 1,
      "metadata" : {}
   },
   "func" : "configure_autoupdate",
   "module" : "WordPressInstanceManager"
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
idstring

Required

The cPAddon instance's unique ID.

Note:

You can retrieve an instance ID with the get_instances function.

A valid instance ID.cPanel__Blogs__WordPressX.0.1491917088
autoupdate.core.majorBoolean

Required

Whether to enable automatic updates for major releases.

  • 1 — Enable.
  • 0 — Disable.
0
autoupdate.core.minorBoolean

Required

Whether to enable automatic updates for minor releases.

  • 1 — Enable.
  • 0 — Disable.
0

 

Returns

This function returns only metadata if a conversion to the RPM-based WordPress cPAddon is unnecessary.

Note:

Previous to WordPress Manager version 1.1.3, this function only returned metadata.


ReturnTypeDescriptionPossible valueExample
beforehashA hash that contains the instance's information before conversion.

A hash that contains the admin_username, id, db_prefix, homedir, db_type, db_username, db_name ,available_version, admin_url, db_server, addon_config, addon_name, addon_type, current_version, full_path, initial_install_version, domain, site_url, and rel_path returns.


admin_username

stringThe instance's administrator username.A valid string.

wpadmin

id

stringThe instance's unique ID.A valid string.cPanel__Blogs__WordPress.1.1509732223

db_prefix

stringThe instance's database prefix.A valid string.

example

homedir

stringThe cPanel account's home directory.An absolute file path./home/example

db_type

stringThe instance's database type.

mysql

mysql

db_username

stringThe instance's database username.A valid string.example_wp1

db_name

stringThe instance's database name.A valid string.example_wp1

available_version

stringThe latest WordPress version.

A WordPress version number.

4.9.1

admin_url

stringThe instance's administrator login URL.A valid URL.example.com/wordpress-41/wp-login.php

db_server

stringThe instance's database server network path.A valid network path.localhost

addon_config

stringThe instance's cPAddon YAML file path.An absolute file path./home/example/.cpaddons/cPanel::Blogs::WordPress.1.yaml

addon_name

stringThe instance's cPAddon name.A valid string.cPanel::Blogs::WordPress

addon_type

stringThe instance's cPAddon type.

legacy is this only possible value.

legacy

current_version

stringThe instance's WordPress version.

A WordPress version number.

4.1

full_path

stringThe instance's full installation path.An absolute file path./home/example/public_html/wordpress-41

initial_install_version

stringThe instance's original installation version.

A WordPress version number.

4.1

domain

stringThe instance's domain name.A valid domain.example.com

site_url

stringThe instance's URL.A valid URL.example.com/wordpress-41

rel_path

stringThe relative file path to the instance's document root.A relative file path.wordpress-41
afterhashA hash that contains the instance's information after conversion.

A hash that contains the db_username, db_name, db_type, homedir, migrated_from, addon_config, admin_urldb_server, available_version, admin_username, db_prefixid, domain, rel_path, site_url, migrated_on, addon_type, addon_name, initial_install_version, full_path, and current_version returns.


db_username

stringThe converted instance's database username.A valid string.example_wp1

db_name

stringThe converted instance's database name.A valid string.example_wp1

db_type

stringThe converted instance's database type.mysql is the only possible value.mysql

homedir

stringThe cPanel account's home directory.An absolute file path. /home/example

migrated_from

stringThe instance's original installation cPAddon name.cPanel::Blogs::WordPress is the only possible value.cPanel::Blogs::WordPress

addon_config

stringThe converted instance's cPAddon YAML file path.An absolute file path./home/example/.cpaddons/cPanel::Blogs::WordPressX.2.yaml

admin_url

stringThe converted instance's administrator login URL.A valid URL.example.com/wordpress-41/wp-login.php

db_server

stringThe converted instance's database server network path.A valid network path.locahost

available_version

stringThe latest WordPress version.A valid WordPress version.4.9.1

admin_username

stringThe instance's administrator username.A valid string.wpadmin

db_prefix

stringThe converted instance's database prefix.A valid string.example

id

stringThe converted instance's unique ID.A valid string.cPanel__Blogs__WordPressX.2.1509732223

domain

stringThe converted instance's domain.A valid domain.example.com

rel_path

stringThe converted instance's relative file path to the instance's document root.A relative file path.wordpress-41

site_url

stringThe converted instance's URL.A valid URL. example.com/wordpress-41

migrated_on

stringThe time the system converted the instance.

The date in Unix epoch time.

1513965986

addon_type

stringThe converted instance's cPAddon type.modern is this only possible value.modern

addon_name

stringThe converted instance's cPAddon name.cPanel::Blogs::WordPressX is the only possible value.cPanel::Blogs::WordPressX

initial_install_version

stringThe instance's original installation version.A WordPress version number.4.1

full_path

stringThe instance's full installation path.An absolute file path./home/example.com/public_html/wordpress-41

current_version

stringThe instance's WordPress version.A WordPress version number.4.9.1