1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-02 07:54:27 +00:00

Add rpc mkdir_with_parents()

This commit is contained in:
“cuihaikuo”
2017-08-14 10:59:08 +08:00
parent 62023c10a3
commit cf19311a0d
5 changed files with 41 additions and 0 deletions

View File

@@ -5110,4 +5110,28 @@ seafile_get_trash_repo_owner (const char *repo_id, GError **error)
return seaf_get_trash_repo_owner (repo_id); return seaf_get_trash_repo_owner (repo_id);
} }
int
seafile_mkdir_with_parents (const char *repo_id, const char *parent_dir,
const char *new_dir_path, const char *user,
GError **error)
{
if (!repo_id || !parent_dir || !new_dir_path || !user) {
g_set_error (error, 0, SEAF_ERR_BAD_ARGS, "Argument should not be null");
return -1;
}
if (!is_uuid_valid (repo_id)) {
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid repo id");
return -1;
}
if (seaf_repo_manager_mkdir_with_parents (seaf->repo_mgr, repo_id,
parent_dir, new_dir_path,
user, error) < 0) {
return -1;
}
return 0;
}
#endif /* SEAFILE_SERVER */ #endif /* SEAFILE_SERVER */

View File

@@ -730,6 +730,10 @@ int
seafile_post_dir (const char *repo_id, const char *parent_dir, seafile_post_dir (const char *repo_id, const char *parent_dir,
const char *new_dir_name, const char *user, const char *new_dir_name, const char *user,
GError **error); GError **error);
int
seafile_mkdir_with_parents (const char *repo_id, const char *parent_dir,
const char *new_dir_path, const char *user,
GError **error);
/** /**
* delete a file/directory from the repo on server. * delete a file/directory from the repo on server.

View File

@@ -968,3 +968,8 @@ class SeafServerThreadedRpcClient(ccnet.RpcClientBase):
@searpc_func("string", ["string"]) @searpc_func("string", ["string"])
def get_trash_repo_owner(repo_id): def get_trash_repo_owner(repo_id):
pass pass
@searpc_func("int", ["string", "string", "string", "string"])
def seafile_mkdir_with_parents (repo_id, parent_dir, relative_path, username):
pass
mkdir_with_parents = seafile_mkdir_with_parents

View File

@@ -678,6 +678,9 @@ class SeafileAPI(object):
def get_trash_repo_owner (self, repo_id): def get_trash_repo_owner (self, repo_id):
return seafserv_threaded_rpc.get_trash_repo_owner(repo_id) return seafserv_threaded_rpc.get_trash_repo_owner(repo_id)
def mkdir_with_parents (self, repo_id, parent_dir, relative_path, username):
return seafserv_threaded_rpc.mkdir_with_parents(repo_id, parent_dir, relative_path, username)
seafile_api = SeafileAPI() seafile_api = SeafileAPI()
class CcnetAPI(object): class CcnetAPI(object):

View File

@@ -233,6 +233,11 @@ static void start_rpc_service (CcnetClient *client, int cloud_mode)
"seafile_post_dir", "seafile_post_dir",
searpc_signature_int__string_string_string_string()); searpc_signature_int__string_string_string_string());
searpc_server_register_function ("seafserv-threaded-rpcserver",
seafile_mkdir_with_parents,
"seafile_mkdir_with_parents",
searpc_signature_int__string_string_string_string());
searpc_server_register_function ("seafserv-threaded-rpcserver", searpc_server_register_function ("seafserv-threaded-rpcserver",
seafile_del_file, seafile_del_file,
"seafile_del_file", "seafile_del_file",