public static function server_local(array $params = array()) { $validation = Validation::factory($params)->rule('path', 'not_empty')->rule('path', 'is_dir')->rule('web', 'not_empty')->rule('url_type', 'in_array', array(':value', array(Flex\Storage\Server::URL_HTTP, Flex\Storage\Server::URL_SSL, Flex\Storage\Server::URL_STREAMING))); if (!$validation->check()) { throw new Kohana_Exception('Upload server local params had errors: :errors', array(':errors' => join(', ', Arr::flatten($validation->errors())))); } $server = new Flex\Storage\Server_Local($validation['path'], $validation['web']); if (isset($validation['url_type'])) { $server->url_type($validation['url_type']); } return $server; }
public function test_recursive_rmdir() { shell_exec('rm -rf ' . $this->dir . 'testdir1'); mkdir($this->dir . 'testdir1'); mkdir($this->dir . 'testdir1/test'); mkdir($this->dir . 'testdir1/test/test_dir'); file_put_contents($this->dir . 'testdir1/test/test_file', 'test'); Flex\Storage\Server_Local::recursive_rmdir($this->dir . 'testdir1'); $this->assertFileNotExists($this->dir . 'testdir1'); }