@@ -53,6 +53,27 @@ public function getUpHost($accessKey, $bucket)
53
53
return $ scheme . $ host ;
54
54
}
55
55
56
+ public function getUpHostV2 ($ accessKey , $ bucket )
57
+ {
58
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
59
+ if ($ err != null ) {
60
+ return array (null , $ err );
61
+ }
62
+
63
+ if ($ this ->useHTTPS === true ) {
64
+ $ scheme = "https:// " ;
65
+ } else {
66
+ $ scheme = "http:// " ;
67
+ }
68
+
69
+ $ host = $ region ->srcUpHosts [0 ];
70
+ if ($ this ->useCdnDomains === true ) {
71
+ $ host = $ region ->cdnUpHosts [0 ];
72
+ }
73
+
74
+ return array ($ scheme . $ host , null );
75
+ }
76
+
56
77
public function getUpBackupHost ($ accessKey , $ bucket )
57
78
{
58
79
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -70,6 +91,27 @@ public function getUpBackupHost($accessKey, $bucket)
70
91
return $ scheme . $ host ;
71
92
}
72
93
94
+ public function getUpBackupHostV2 ($ accessKey , $ bucket )
95
+ {
96
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
97
+ if ($ err != null ) {
98
+ return array (null , $ err );
99
+ }
100
+
101
+ if ($ this ->useHTTPS === true ) {
102
+ $ scheme = "https:// " ;
103
+ } else {
104
+ $ scheme = "http:// " ;
105
+ }
106
+
107
+ $ host = $ region ->cdnUpHosts [0 ];
108
+ if ($ this ->useCdnDomains === true ) {
109
+ $ host = $ region ->srcUpHosts [0 ];
110
+ }
111
+
112
+ return array ($ scheme . $ host , null );
113
+ }
114
+
73
115
public function getRsHost ($ accessKey , $ bucket )
74
116
{
75
117
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -83,6 +125,22 @@ public function getRsHost($accessKey, $bucket)
83
125
return $ scheme . $ region ->rsHost ;
84
126
}
85
127
128
+ public function getRsHostV2 ($ accessKey , $ bucket )
129
+ {
130
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
131
+ if ($ err != null ) {
132
+ return array (null , $ err );
133
+ }
134
+
135
+ if ($ this ->useHTTPS === true ) {
136
+ $ scheme = "https:// " ;
137
+ } else {
138
+ $ scheme = "http:// " ;
139
+ }
140
+
141
+ return array ($ scheme . $ region ->rsHost , null );
142
+ }
143
+
86
144
public function getRsfHost ($ accessKey , $ bucket )
87
145
{
88
146
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -96,6 +154,22 @@ public function getRsfHost($accessKey, $bucket)
96
154
return $ scheme . $ region ->rsfHost ;
97
155
}
98
156
157
+ public function getRsfHostV2 ($ accessKey , $ bucket )
158
+ {
159
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
160
+ if ($ err != null ) {
161
+ return array (null , $ err );
162
+ }
163
+
164
+ if ($ this ->useHTTPS === true ) {
165
+ $ scheme = "https:// " ;
166
+ } else {
167
+ $ scheme = "http:// " ;
168
+ }
169
+
170
+ return array ($ scheme . $ region ->rsfHost , null );
171
+ }
172
+
99
173
public function getIovipHost ($ accessKey , $ bucket )
100
174
{
101
175
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -109,6 +183,22 @@ public function getIovipHost($accessKey, $bucket)
109
183
return $ scheme . $ region ->iovipHost ;
110
184
}
111
185
186
+ public function getIovipHostV2 ($ accessKey , $ bucket )
187
+ {
188
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
189
+ if ($ err != null ) {
190
+ return array (null , $ err );
191
+ }
192
+
193
+ if ($ this ->useHTTPS === true ) {
194
+ $ scheme = "https:// " ;
195
+ } else {
196
+ $ scheme = "http:// " ;
197
+ }
198
+
199
+ return array ($ scheme . $ region ->iovipHost , null );
200
+ }
201
+
112
202
public function getApiHost ($ accessKey , $ bucket )
113
203
{
114
204
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -122,6 +212,22 @@ public function getApiHost($accessKey, $bucket)
122
212
return $ scheme . $ region ->apiHost ;
123
213
}
124
214
215
+ public function getApiHostV2 ($ accessKey , $ bucket )
216
+ {
217
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
218
+ if ($ err != null ) {
219
+ return array (null , $ err );
220
+ }
221
+
222
+ if ($ this ->useHTTPS === true ) {
223
+ $ scheme = "https:// " ;
224
+ } else {
225
+ $ scheme = "http:// " ;
226
+ }
227
+
228
+ return array ($ scheme . $ region ->apiHost , null );
229
+ }
230
+
125
231
private function getRegion ($ accessKey , $ bucket )
126
232
{
127
233
$ cacheId = "$ accessKey: $ bucket " ;
@@ -143,4 +249,25 @@ private function getRegion($accessKey, $bucket)
143
249
}
144
250
return $ region ;
145
251
}
252
+
253
+ private function getRegionV2 ($ accessKey , $ bucket )
254
+ {
255
+ $ cacheId = "$ accessKey: $ bucket " ;
256
+
257
+ if (isset ($ this ->regionCache [$ cacheId ])) {
258
+ $ region = $ this ->regionCache [$ cacheId ];
259
+ } elseif (isset ($ this ->zone )) {
260
+ $ region = $ this ->zone ;
261
+ $ this ->regionCache [$ cacheId ] = $ region ;
262
+ } else {
263
+ $ region = Zone::queryZone ($ accessKey , $ bucket );
264
+ if (is_array ($ region )) {
265
+ list ($ region , $ err ) = $ region ;
266
+ return array ($ region , $ err );
267
+ }
268
+ $ this ->regionCache [$ cacheId ] = $ region ;
269
+ }
270
+
271
+ return array ($ region , null );
272
+ }
146
273
}
0 commit comments