Skip to content

Commit e00deb4

Browse files
committed
* Fix VCS test
* Fix file system permission check
1 parent fc43a2c commit e00deb4

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

inc/manager/class-package-manager.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,10 @@ public function get_package_metadata( $package_slug, $json_encode = false ) {
10931093
}
10941094

10951095
public function set_package_metadata( $package_slug, $metadata ) {
1096+
WP_Filesystem();
1097+
1098+
global $wp_filesystem;
1099+
10961100
$dir = upserv_get_data_dir( 'metadata' );
10971101
$filename = sanitize_file_name( $package_slug . '.json' );
10981102
$file_path = trailingslashit( $dir ) . $filename;
@@ -1104,10 +1108,6 @@ public function set_package_metadata( $package_slug, $metadata ) {
11041108
if ( empty( $data ) ) {
11051109

11061110
if ( ! has_filter( 'upserv_did_delete_package_metadata' ) && is_file( $file_path ) ) {
1107-
WP_Filesystem();
1108-
1109-
global $wp_filesystem;
1110-
11111111
$result = (bool) $wp_filesystem->delete( $file_path );
11121112
} else {
11131113
$result = apply_filters( 'upserv_did_delete_package_metadata', false, $package_slug );

lib/package-update-checker/Vcs/BitbucketApi.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ public static function test( $url, $app_password = null ) {
5555
return $response;
5656
}
5757

58-
if ( $response && isset( $response->username ) && $instance->user_name === $response->username ) {
58+
if (
59+
$response &&
60+
isset( $response->username ) &&
61+
trailingslashit( $instance->user_name ) === trailingslashit( $response->username )
62+
) {
5963
return true;
6064
}
6165

lib/package-update-checker/Vcs/GitHubApi.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public static function test( $url, $access_token = null ) {
6767
return false;
6868
}
6969

70-
if ( isset( $response->html_url ) && $response->html_url === $url ) {
70+
if (
71+
isset( $response->html_url ) &&
72+
trailingslashit( $url ) === trailingslashit( $response->html_url )
73+
) {
7174
return true;
7275
}
7376

lib/package-update-checker/Vcs/GitLabApi.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ public static function test( $url, $access_token = null ) {
135135
return $response;
136136
}
137137

138-
return $response && isset( $response->path ) && $instance->user_name === $response->path;
138+
return $response &&
139+
isset( $response->path ) &&
140+
trailingslashit( $instance->user_name ) === trailingslashit( $response->path );
139141
}
140142

141143
/**

readme.txt

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ This section describes how to install the plugin and get it working.
6767

6868
= 1.0.4 =
6969
* More flexibility when parsing `Require License` header
70+
* Fix VCS test
71+
* Fix file system permission check
7072

7173
= 1.0.3 =
7274
* Minor Package API fix

0 commit comments

Comments
 (0)