Plugin_Upgrader::active_before()
最后更新于:2021-11-25 20:37:20
Plugin_Upgrader::active_before( bool|GC_Error$return, array$plugin)Turns on maintenance mode before attempting to background update an active plugin.
参数
- $return
-
(bool|GC_Error) (Required) Upgrade offer return.
- $plugin
-
(array) (Required) Plugin package arguments.
响应
(bool|GC_Error) The passed in $return param or GC_Error.
源文件
文件: gc-admin/includes/class-plugin-upgrader.php
public function active_before( $return, $plugin ) {
if ( is_gc_error( $return ) ) {
return $return;
}
// Only enable maintenance mode when in cron (background update).
if ( ! gc_doing_cron() ) {
return $return;
}
$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
// Only run if plugin is active.
if ( ! is_plugin_active( $plugin ) ) {
return $return;
}
// Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) {
$this->maintenance_mode( true );
}
return $return;
}