Skip to content
Docs
Get RestroPress

Function

Installation and upgrades functions

Updated
On this page

Functions that run on installation and upgrade.

31 functions. Each entry shows the signature, parameters, return value and where it is defined. Functions marked internal are hook callbacks, screen renderers and other plumbing that extensions normally do not call.

rpress_trigger_upgrades()#

Runs the legacy version-based upgrade routines from an AJAX request.

Hooked to wp_ajax_rpress_trigger_upgrades. Dies with a 403 unless the user has manage_shop_settings. Runs the v1.3.1, 1.3.4, 1.4, 1.5 and 2.0 upgrades depending on the stored rpress_version, updates that option to the current version, and ends the AJAX request with complete.

rpress_trigger_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 22.

rpress_maybe_resume_upgrade()#

Returns the saved state of an interrupted stepped upgrade.

Reads the rpress_doing_upgrade option.

rpress_maybe_resume_upgrade()

Returns array|false: The saved upgrade arguments, or false when no upgrade is in progress.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 57.

rpress_set_upgrade_complete()#

Records an upgrade action as completed.

Appends the action to the rpress_completed_upgrades option, keeping the list unique. Returns false for an empty action.

rpress_set_upgrade_complete( $upgrade_action = '' )

Parameters

ParameterTypeDefaultDescription
$upgrade_actionstring''Identifier of the completed upgrade.

Returns bool: The result of update_option(), or false when $upgrade_action is empty.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 71.

rpress_v131_upgrades()#

Migrates legacy per-item sale and file download logs into the RPRESS_Logging system.

Skipped when the rpress_logs_upgraded option exists or the stored version is 1.3 or later. Reads the old logs with rpress_get_fooditem_sales_log() and rpress_get_file_fooditem_log() and inserts them as sale and file_fooditem logs, then sets rpress_logs_upgraded.

rpress_v131_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 89.

rpress_v134_upgrades()#

Creates the Transaction Failed page for the v1.3.4 upgrade.

Does nothing when the rpress_settings_general option already has a failure_page. Otherwise inserts the page and stores its ID in that option.

rpress_v134_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 149.

rpress_v14_upgrades()#

Upgrade routine for v1.4: adds the receipt shortcode and converts discounts to posts.

Appends [rpress_receipt] to the success page if missing, and converts the legacy rpress_discounts option into rpress_discount posts with _rpress_discount_* meta, then deletes the option.

rpress_v14_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 175.

rpress_v15_upgrades()#

Upgrade routine for v1.5: sets the tax price options and flushes rewrite rules.

Sets checkout_include_tax and prices_include_tax in the rpress_settings_taxes option.

rpress_v15_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 217.

rpress_v20_upgrades()#

Upgrade routine for v2.0: converts the AJAX cart and cart saving settings.

Sets enable_ajax_cart and enable_cart_saving in the settings from the old disable flags, deletes old _wp_session_expires_% options, and saves rpress_settings.

rpress_v20_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 238.

rpress_v20_upgrade_sequential_payment_numbers()#

Assigns sequential order numbers to existing orders in batches.

Hooked to rpress_upgrade_sequential_payment_numbers. Dies with a 403 unless the user has manage_shop_settings. Processes 100 orders per step and redirects to itself until finished, then redirects to the admin home.

rpress_v20_upgrade_sequential_payment_numbers()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 265.

rpress_v21_upgrade_customers_db()#

Migrates customer data from orders into the customers table in batches.

Hooked to rpress_upgrade_customers_db. Dies with a 403 unless the user has manage_shop_settings. Processes orders step by step with redirects, then updates rpress_version and redirects to the admin home.

rpress_v21_upgrade_customers_db()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 325.

rpress_v226_upgrade_payments_price_logs_db()#

Repairs log meta for orders for the v2.2.6 upgrade.

Dies with a 403 unless the user has manage_shop_settings. Processes in steps with redirects, then updates rpress_version and redirects to the admin home.

rpress_v226_upgrade_payments_price_logs_db()

Note: Ends the request with a redirect. No hook is attached to it in this file.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 405.

rpress_v23_upgrade_payment_taxes()#

Adds tax data to existing orders in batches for the v2.3 upgrade.

Hooked to rpress_upgrade_payment_taxes. Dies with a 403 unless the user has manage_shop_settings. When done, updates rpress_version, marks upgrade_payment_taxes complete and redirects to the admin home.

rpress_v23_upgrade_payment_taxes()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 510.

rpress_v23_upgrade_customer_purchases()#

Associates orders with customers in batches for the v2.3 upgrade.

Hooked to rpress_upgrade_customer_payments_association. Dies with a 403 unless the user has manage_shop_settings. When done, marks upgrade_customer_payments_association complete and redirects to the admin home.

rpress_v23_upgrade_customer_purchases()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 572.

rpress_upgrade_user_api_keys()#

Swaps the stored user API key meta for faster lookups.

Hooked to rpress_upgrade_user_api_keys. Dies with a 403 unless the user has manage_shop_settings. When done, marks upgrade_user_api_keys complete and redirects to the admin home.

rpress_upgrade_user_api_keys()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 723.

rpress_remove_refunded_sale_logs()#

Removes sale logs belonging to refunded orders.

Hooked to rpress_remove_refunded_sale_logs. Dies with a 403 unless the user has manage_shop_settings. Works in batches with redirects, then marks remove_refunded_sale_logs complete and redirects to the admin home.

rpress_remove_refunded_sale_logs()

Note: Ends the request with a redirect.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 788.

rpress_v26_upgrades()#

Creates the customers and customer meta tables.

Calls create_table() on RPRESS()->customers and RPRESS()->customer_meta, suppressing errors.

rpress_v26_upgrades()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 841.

rpress_upgrade_render_update_file_fooditem_log_data()#

Renders the admin screen for the file download log migration.

Echoes HTML. Shows a completed notice when update_file_fooditem_log_data is already done, otherwise a form that starts the RPRESS_File_Download_Log_Migration batch processor.

rpress_upgrade_render_update_file_fooditem_log_data()

Note: Echoes output instead of returning it.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 845.

rpress_register_batch_file_fooditem_log_migration()#

Registers the file download log migration batch processor.

Hooked to rpress_register_batch_exporter. Adds a callback on rpress_batch_export_class_include.

rpress_register_batch_file_fooditem_log_migration()

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 927.

rpress_include_file_fooditem_log_migration_batch_processor()#

Loads the file download log migration class when it is requested.

Hooked to rpress_batch_export_class_include. Requires the migration class file when $class is RPRESS_File_Download_Log_Migration.

rpress_include_file_fooditem_log_migration_batch_processor( $class )

Parameters

ParameterTypeDefaultDescription
$classstringRequiredName of the batch class being loaded.

Internal. Defined in includes/admin/upgrades/upgrade-functions.php, line 931.

rpress_upgrades_screen()#

Renders the RestroPress Upgrades admin screen.

Echoes HTML. Calls rpress_upgrade_render_{action} for the rpress-upgrade query argument when that function exists, otherwise runs the legacy stepped upgrade display and stores progress in rpress_doing_upgrade.

rpress_upgrades_screen()

Note: Echoes output instead of returning it.

Internal. Defined in includes/admin/upgrades/upgrades.php, line 19.

rpress_install()#

Runs the RestroPress installation on plugin activation.

Registered as the activation hook. Calls rpress_run_install() for the current site, or for every site when network-activated on multisite. Sets rpress_show_setup_wizard if it is not already set.

rpress_install( $network_wide = false )

Parameters

ParameterTypeDefaultDescription
$network_wideboolfalseWhether the plugin is being network-activated.

Internal. Defined in includes/install.php, line 29.

rpress_run_install()#

Creates the default pages, options, roles and tables for one site.

Registers post types and taxonomies, flushes rewrite rules, creates missing Checkout, Order Confirmation, Transaction Failed, Orders, Order Online and account pages, merges default settings into rpress_settings, sets rpress_version, adds the shop roles and capabilities, creates the customer tables, and sets the _rpress_installed transient for 30 seconds.

rpress_run_install()

Note: Existing pages recorded in the settings are reused rather than recreated.

Internal. Defined in includes/install.php, line 64.

rpress_new_blog_created()#

Installs RestroPress on a newly created multisite blog.

Hooked to wpmu_new_blog. When the plugin is network-active, switches to the new blog and calls rpress_install().

rpress_new_blog_created( $blog_id, $user_id, $domain, $path, $site_id, $meta )

Parameters

ParameterTypeDefaultDescription
$blog_idintRequiredNew blog ID.
$user_idintRequiredUser ID set as admin.
$domainstringRequiredSite domain.
$pathstringRequiredSite path.
$site_idintRequiredNetwork ID.
$metaarrayRequiredBlog meta.

Internal. Defined in includes/install.php, line 249.

rpress_wpmu_drop_tables()#

Adds the customer tables to the list dropped when a multisite blog is deleted.

Filter callback for wpmu_drop_tables. Adds the customers and customer meta tables when the customers table is installed.

rpress_wpmu_drop_tables( $tables, $blog_id )

Parameters

ParameterTypeDefaultDescription
$tablesarrayRequiredTables WordPress will drop.
$blog_idintRequiredID of the blog being deleted.

Returns array: The tables list including the RestroPress tables.

Internal. Defined in includes/install.php, line 265.

rpress_after_install()#

Creates missing customer tables and fires the post-install action in admin.

Hooked to admin_init. Checks tables at most once a week (_rpress_table_check). Fires rpress_after_install with the _rpress_installed transient value after creating the customers table, then deletes that transient.

rpress_after_install()

Internal. Defined in includes/install.php, line 286.

rpress_maybe_redirect_to_setup_wizard()#

Redirects to the setup wizard once after activation.

Hooked to admin_init. For users with manage_options in the admin, when rpress_show_setup_wizard is set it deletes the option and redirects to admin.php?page=rpress-setup.

rpress_maybe_redirect_to_setup_wizard()

Note: Ends the request with a redirect.

Internal. Defined in includes/install.php, line 312.

rpress_install_roles_on_network()#

Creates the shop roles on sub-sites where they are missing.

Hooked to admin_init. Adds roles and capabilities with RPRESS_Roles when shop_manager does not exist.

rpress_install_roles_on_network()

Internal. Defined in includes/install.php, line 337.

rpress_has_legacy_addon_data_to_migrate()#

Checks whether legacy add-on data needs migrating.

Looks for legacy taxonomy_term_% options, or menu items with addon_category terms but no _addon_items meta.

rpress_has_legacy_addon_data_to_migrate()

Returns bool: True when legacy add-on data exists.

Internal. Defined in includes/install.php, line 357.

rpress_needs_migration()#

Checks whether the legacy add-on migration should run.

Returns false inside iframe requests, once rpress_legacy_addon_migration_completed is set, or when the stored version is 2.6 or later. Otherwise returns the result of rpress_has_legacy_addon_data_to_migrate().

rpress_needs_migration()

Returns bool: True when migration is needed.

Internal. Defined in includes/install.php, line 387.

rpress_db_migration()#

Migrates legacy add-on term data to _addon_items post meta and term meta.

Builds _addon_items for each menu item from its addon_category terms without overwriting existing values, copies taxonomy_term_* option values into _type and _price term meta, deletes those options, and sets rpress_legacy_addon_migration_completed.

rpress_db_migration()

Internal. Defined in includes/install.php, line 416.

rpress_check_migartion()#

Runs the legacy add-on migration when needed and keeps version options set.

Hooked to admin_init. Calls rpress_db_migration() when rpress_needs_migration() is true and updates rpress_version; otherwise sets missing rpress_version and migration flag options.

rpress_check_migartion()

Note: The function name is spelled this way in the source.

Internal. Defined in includes/install.php, line 483.

Was this page helpful?