Theme_Upgrader::delete_old_theme()

最后更新于:2021-11-26 04:13:30

Theme_Upgrader::delete_old_theme( bool$removed, string$local_destination, string$remote_destination, array$theme)

Delete the old theme during an upgrade.

参数

$removed

(bool) (Required)

$local_destination

(string) (Required)

$remote_destination

(string) (Required)

$theme

(array) (Required)

响应

(bool)

源文件

文件: gc-admin/includes/class-theme-upgrader.php

	public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
		global $gc_filesystem;

		if ( is_gc_error( $removed ) ) {
			return $removed; // Pass errors through.
		}

		if ( ! isset( $theme['theme'] ) ) {
			return $removed;
		}

		$theme      = $theme['theme'];
		$themes_dir = trailingslashit( $gc_filesystem->gc_themes_dir( $theme ) );
		if ( $gc_filesystem->exists( $themes_dir . $theme ) ) {
			if ( ! $gc_filesystem->delete( $themes_dir . $theme, true ) ) {
				return false;
			}
		}

		return true;
	}