WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Upgrader::maintenance_mode() WP 2.8.0

Toggle maintenance mode for the site.

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

Это метод класса: WP_Upgrader

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_Upgrader = new WP_Upgrader();
$var = $WP_Upgrader->maintenance_mode( $enable );
$enable(true/false)
True to enable maintenance mode, false to disable.
По умолчанию: false

Заметки

  • Global. WP_Filesystem_Base. $wp_filesystem Subclass

Список изменений

С версии 2.8.0 Введена.

Код WP Upgrader::maintenance mode: wp-admin/includes/class-wp-upgrader.php WP 5.2.4

<?php
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 );
		$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
	} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
		$this->skin->feedback( 'maintenance_end' );
		$wp_filesystem->delete( $file );
	}
}