WordPress.org

Make WordPress Core

Ticket #28013: wp.maintenance.patch

File wp.maintenance.patch, 760 bytes (added by hnhn2, 4 years ago)

treat .maintenance file deletion as file DELETE instead of RMDIR

  • wp-admin/includes/class-wp-upgrader.php

    diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
    a b  
    816816                        $this->skin->feedback('maintenance_start');
    817817                        // Create maintenance file to signal that we are upgrading
    818818                        $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
    819                         $wp_filesystem->delete($file);
     819                        $wp_filesystem->delete($file, false, 'f');
    820820                        $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
    821                 } elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
     821                } else {
    822822                        $this->skin->feedback('maintenance_end');
    823                         $wp_filesystem->delete($file);
     823                        $wp_filesystem->delete($file, false, 'f');
    824824                }
    825825        }
    826826