function test_deleteContainer()
 {
     $containers = CloudFiles::listContainers();
     $this->assertTrue(in_array('delme', $containers));
     $retval = CloudFiles::deleteContainer('delme');
     $this->assertTrue($retval);
     $containers = CloudFiles::listContainers();
     $this->assertFalse(in_array('delme', $containers));
 }
 /**
  * Get the stream url of a file
  * @param string name of file
  * @param string name of container
  * @return string stream url
  */
 public function stream($name, $container)
 {
     return CloudFiles::stream($name, $container);
 }
 /**
  * Connect to the CloudFiles Service
  * @return boolean success
  * @throws CloudFilesException
  * @throws AuthenticationException
  * @throws InvalidResponseException
  */
 protected static function connect()
 {
     if ($server = self::$server_to_auth_map[self::getConfig('server')]) {
         self::$Authentication = new CF_Authentication(self::getConfig('username'), self::getConfig('api_key'), null, $server);
         self::$Authentication->ssl_use_cabundle();
         self::$Authentication->authenticate();
         $hostname = gethostname();
         // Check to see if this is a rackspace node
         if (stripos($hostname, 'rackspace') === FALSE) {
             $serviceNet = FALSE;
         } else {
             $serviceNet = TRUE;
         }
         self::$Connection = new CF_Connection(self::$Authentication, $serviceNet);
     }
     $retval = !!self::$Connection;
     if (!$retval) {
         self::error("Unable to connect to rackspace, check your settings.");
     }
     return $retval;
 }
 function delete_container()
 {
     $container = $this->getNextParam(null, 'container');
     if (!$container) {
         $this->errorAndExit("Container required");
     }
     $files = CloudFiles::ls($container);
     $this->ProgressBar->start(count($files) + 1);
     foreach ($files as $file) {
         CloudFiles::delete($file, $container);
         $this->ProgressBar->next();
     }
     CloudFiles::deleteContainer($container);
     $this->ProgressBar->next();
     $this->out();
     $this->out("Finished");
 }