PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/base/services/s3compatible.php +14 -2 1.3.12 → 1.4.2 View file →
@@ -633,9 +633,9 @@
633 633 * Upload Single
634 634 * @since 1.0.0
635 635 * @return boolean
636 636 */
637 - public function uploadSingle($absolute_source_path, $relative_source_path, $prefix='') {
637 + public function uploadSingle($absolute_source_path, $relative_source_path, $prefix='', $is_private = false) {
638 638 if (
639 639 isset($absolute_source_path) && !empty($absolute_source_path) &&
640 640 isset($relative_source_path) && !empty($relative_source_path)
641 641 ) {
@@ -640,9 +640,16 @@
640 640 isset($relative_source_path) && !empty($relative_source_path)
641 641 ) {
642 642 $file_name = wp_basename( $relative_source_path );
643 643 if ($file_name) {
644 - $upload_path = Utils::generate_object_key($relative_source_path, $prefix);
644 + $upload_path = Utils::generate_object_key($relative_source_path, $prefix, $is_private);
645 + if ($upload_path === false) {
646 + return [
647 + 'success' => false,
648 + 'code' => 200,
649 + 'message' => esc_html__('This file is marked private, but the private-media add-on is not currently active — reupload skipped to avoid exposing it.', 'media-cloud-sync')
650 + ];
651 + }
645 652 return $this->execute_upload($absolute_source_path, $upload_path);
646 653 }
647 654 return [
648 655 'success' => false,
@@ -1065,7 +1072,12 @@
1065 1072 * Get domain URL
1066 1073 */
1067 1074 public function get_domain($region = '') {
1068 1075 return $this->config['endpoint'];
1076 + }
1077 +
1078 + /** Exposes the already-constructed SDK client for StreamWrapper's registration — avoids reconstructing one from credentials. */
1079 + public function get_client() {
1080 + return $this->S3CompatibleClient;
1069 1081 }
1070 1082
1071 1083 }