Skip to content

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

Description

@matthieumarrast

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions