File tree 1 file changed +8
-4
lines changed
lib/OpenCloud/ObjectStore/Resource
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -180,15 +180,17 @@ public function delete($deleteObjects = false)
180
180
public function deleteWithObjects ($ secondsToWait = null )
181
181
{
182
182
// If container is empty, just delete it
183
- $ numObjects = $ this ->getObjectCount ( );
184
- if ($ numObjects === 0 ) {
183
+ $ numObjects = ( int ) $ this ->retrieveMetadata ()-> getProperty ( ' Object-Count ' );
184
+ if (0 === $ numObjects ) {
185
185
return $ this ->delete ();
186
186
}
187
+
187
188
// If timeout ($secondsToWait) is not specified by caller,
188
189
// try to estimate it based on number of objects in container
189
190
if (null === $ secondsToWait ) {
190
191
$ secondsToWait = round ($ numObjects / 2 );
191
- }
192
+ }
193
+
192
194
// Attempt to delete all objects and container
193
195
$ endTime = time () + $ secondsToWait ;
194
196
$ containerDeleted = false ;
@@ -208,9 +210,11 @@ public function deleteWithObjects($secondsToWait = null)
208
210
}
209
211
}
210
212
}
213
+
211
214
if (!$ containerDeleted ) {
212
- throw new ContainerException ('Container could not be deleted. ' );
215
+ throw new ContainerException ('Container and all its objects could not be deleted. ' );
213
216
}
217
+
214
218
return $ response ;
215
219
}
216
220
You can’t perform that action at this time.
0 commit comments