WP_Upgrader::maintenance_mode

Advertisement

Summery Summery

Toggle maintenance mode for the site.

Syntax Syntax

WP_Upgrader::maintenance_mode( bool $enable = false )

Description Description

Creates/deletes the maintenance file to enable/disable maintenance mode.

Parameters Parameters

$enable

(Optional) True to enable maintenance mode, false to disable.

Default value: false

Source Source

File: wp-admin/includes/class-wp-upgrader.php

	 * @since 2.8.0
	 *
	 * @global WP_Filesystem_Base $wp_filesystem Subclass
	 *
	 * @param bool $enable True to enable maintenance mode, false to disable.
	 */
	public function maintenance_mode( $enable = false ) {
		global $wp_filesystem;
		$file = $wp_filesystem->abspath() . '.maintenance';
		if ( $enable ) {
			$this->skin->feedback( 'maintenance_start' );
			// Create maintenance file to signal that we are upgrading.
			$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
			$wp_filesystem->delete( $file );

Advertisement

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Advertisement

Leave a Reply