@@ -57,6 +57,27 @@ public function getUpHost($accessKey, $bucket)
57
57
return $ scheme . $ host ;
58
58
}
59
59
60
+ public function getUpHostV2 ($ accessKey , $ bucket )
61
+ {
62
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
63
+ if ($ err != null ) {
64
+ return array (null , $ err );
65
+ }
66
+
67
+ if ($ this ->useHTTPS === true ) {
68
+ $ scheme = "https:// " ;
69
+ } else {
70
+ $ scheme = "http:// " ;
71
+ }
72
+
73
+ $ host = $ region ->srcUpHosts [0 ];
74
+ if ($ this ->useCdnDomains === true ) {
75
+ $ host = $ region ->cdnUpHosts [0 ];
76
+ }
77
+
78
+ return array ($ scheme . $ host , null );
79
+ }
80
+
60
81
public function getUpBackupHost ($ accessKey , $ bucket )
61
82
{
62
83
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -74,6 +95,27 @@ public function getUpBackupHost($accessKey, $bucket)
74
95
return $ scheme . $ host ;
75
96
}
76
97
98
+ public function getUpBackupHostV2 ($ accessKey , $ bucket )
99
+ {
100
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
101
+ if ($ err != null ) {
102
+ return array (null , $ err );
103
+ }
104
+
105
+ if ($ this ->useHTTPS === true ) {
106
+ $ scheme = "https:// " ;
107
+ } else {
108
+ $ scheme = "http:// " ;
109
+ }
110
+
111
+ $ host = $ region ->cdnUpHosts [0 ];
112
+ if ($ this ->useCdnDomains === true ) {
113
+ $ host = $ region ->srcUpHosts [0 ];
114
+ }
115
+
116
+ return array ($ scheme . $ host , null );
117
+ }
118
+
77
119
public function getRsHost ($ accessKey , $ bucket )
78
120
{
79
121
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -87,6 +129,22 @@ public function getRsHost($accessKey, $bucket)
87
129
return $ scheme . $ region ->rsHost ;
88
130
}
89
131
132
+ public function getRsHostV2 ($ accessKey , $ bucket )
133
+ {
134
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
135
+ if ($ err != null ) {
136
+ return array (null , $ err );
137
+ }
138
+
139
+ if ($ this ->useHTTPS === true ) {
140
+ $ scheme = "https:// " ;
141
+ } else {
142
+ $ scheme = "http:// " ;
143
+ }
144
+
145
+ return array ($ scheme . $ region ->rsHost , null );
146
+ }
147
+
90
148
public function getRsfHost ($ accessKey , $ bucket )
91
149
{
92
150
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -100,6 +158,22 @@ public function getRsfHost($accessKey, $bucket)
100
158
return $ scheme . $ region ->rsfHost ;
101
159
}
102
160
161
+ public function getRsfHostV2 ($ accessKey , $ bucket )
162
+ {
163
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
164
+ if ($ err != null ) {
165
+ return array (null , $ err );
166
+ }
167
+
168
+ if ($ this ->useHTTPS === true ) {
169
+ $ scheme = "https:// " ;
170
+ } else {
171
+ $ scheme = "http:// " ;
172
+ }
173
+
174
+ return array ($ scheme . $ region ->rsfHost , null );
175
+ }
176
+
103
177
public function getIovipHost ($ accessKey , $ bucket )
104
178
{
105
179
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -113,6 +187,22 @@ public function getIovipHost($accessKey, $bucket)
113
187
return $ scheme . $ region ->iovipHost ;
114
188
}
115
189
190
+ public function getIovipHostV2 ($ accessKey , $ bucket )
191
+ {
192
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
193
+ if ($ err != null ) {
194
+ return array (null , $ err );
195
+ }
196
+
197
+ if ($ this ->useHTTPS === true ) {
198
+ $ scheme = "https:// " ;
199
+ } else {
200
+ $ scheme = "http:// " ;
201
+ }
202
+
203
+ return array ($ scheme . $ region ->iovipHost , null );
204
+ }
205
+
116
206
public function getApiHost ($ accessKey , $ bucket )
117
207
{
118
208
$ region = $ this ->getRegion ($ accessKey , $ bucket );
@@ -126,6 +216,22 @@ public function getApiHost($accessKey, $bucket)
126
216
return $ scheme . $ region ->apiHost ;
127
217
}
128
218
219
+ public function getApiHostV2 ($ accessKey , $ bucket )
220
+ {
221
+ list ($ region , $ err ) = $ this ->getRegionV2 ($ accessKey , $ bucket );
222
+ if ($ err != null ) {
223
+ return array (null , $ err );
224
+ }
225
+
226
+ if ($ this ->useHTTPS === true ) {
227
+ $ scheme = "https:// " ;
228
+ } else {
229
+ $ scheme = "http:// " ;
230
+ }
231
+
232
+ return array ($ scheme . $ region ->apiHost , null );
233
+ }
234
+
129
235
private function getRegion ($ accessKey , $ bucket )
130
236
{
131
237
$ cacheId = "$ accessKey: $ bucket " ;
@@ -147,4 +253,25 @@ private function getRegion($accessKey, $bucket)
147
253
}
148
254
return $ region ;
149
255
}
256
+
257
+ private function getRegionV2 ($ accessKey , $ bucket )
258
+ {
259
+ $ cacheId = "$ accessKey: $ bucket " ;
260
+
261
+ if (isset ($ this ->regionCache [$ cacheId ])) {
262
+ $ region = $ this ->regionCache [$ cacheId ];
263
+ } elseif (isset ($ this ->zone )) {
264
+ $ region = $ this ->zone ;
265
+ $ this ->regionCache [$ cacheId ] = $ region ;
266
+ } else {
267
+ $ region = Zone::queryZone ($ accessKey , $ bucket );
268
+ if (is_array ($ region )) {
269
+ list ($ region , $ err ) = $ region ;
270
+ return array ($ region , $ err );
271
+ }
272
+ $ this ->regionCache [$ cacheId ] = $ region ;
273
+ }
274
+
275
+ return array ($ region , null );
276
+ }
150
277
}
0 commit comments