Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin's WebDAV storage directory is not created if initial_storage directory not present in plugin #301

Open
matthieumarrast opened this issue Jul 24, 2024 · 0 comments

Comments

@matthieumarrast
Copy link
Contributor

Problem

I have removed the default initial_storage directory in my WebDAV plugin, as it is "empty" (I do not deliver my plugin with the default foo.txt provided by metwork in this directory, it seems obvious to me) and I have no initial file(s) to write on the WebDAV.

But without this (useless) initial_storage directory into the plugin, the WebDAV directory (by default ~/var/storage/<plugin>/) is not created, that's annoying...

Solution

In adm/_plugins.postinstall, replace:

if test "${USE_STORAGE}" = "1"; then
    mkdir -p "${MFBASE_NGINX_STORAGE_DIR}"
    if test -d "${PLUGIN_HOME}/initial_storage"; then
        rm -Rf "${MFBASE_NGINX_STORAGE_DIR:?}/${NAME}"
        cp -Rf "${PLUGIN_HOME}/initial_storage" "${MFBASE_NGINX_STORAGE_DIR}/${NAME}"
    fi
fi

by something like this:

if test "${USE_STORAGE}" = "1"; then
    mkdir -p "${MFBASE_NGINX_STORAGE_DIR}/${NAME}"
    if test -d "${PLUGIN_HOME}/initial_storage"; then
        cp -Rf "${PLUGIN_HOME}/initial_storage/*" "${MFBASE_NGINX_STORAGE_DIR}/${NAME}/"
    fi
fi

So the plugin's storage dir is created if not exists (we keep existing one in case it exists) and we copy files from initial_storage (if exists) in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant