Automattic\WooCommerce\Internal\Admin

SiteHealth::is_uploads_directory_protected │ private │ WC 1.0

Check if the WooCommerce uploads directory is protected.

With the "Redirect only" download method files are served directly by design, so only directory browsing is checked. Other methods need the files themselves to be blocked.

Method of the class: SiteHealth{}

No Hooks.

Returns

bool|array{unverified: true}.

Usage

// private - for code of main (parent) class only
$result = $this->is_uploads_directory_protected();

SiteHealth::is_uploads_directory_protected() code WC 11.3.0

private function is_uploads_directory_protected() {
	$status = $this->uses_redirect_download_method() ? $this->get_uploads_directory_browsing_status() : $this->get_uploads_file_access_status();

	if ( 'unverified' === $status ) {
		return array( 'unverified' => true );
	}

	return 'protected' === $status;
}