os-js / osjs-filemanager-application

OS.js File Manager Application

Home Page:https://manual.os-js.org/v3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement of the delete function

MortezaBiabani opened this issue · comments

commented

Hi,

Suppose we delete a file in the file manager by mistake, how can we restore it? Do we need something like Recycle Bin?
Is it possible to embed a general delete function like Windows (restore function delete or shift+delete)?

Best,
Morteza

It's possible to implement a trash can, but that would be in osjs-client and osjs-server. Since the VFS supports arbitrary storage connections it would have to work in a special way:

  • Custom virtual mountpoint that has a database of deleted files
  • Remving a file will place the path into the database, and the file gets renamed to something special (ex pattern: README.__trash__.md)
  • Files with this pattern is hidden from readdir results

Restoration would just be the opposite of this.

commented

These steps you mentioned are operational.

It seems better to put a database for this in OS.js. It also matters where the database is located. Next, when we were dealing with larger data, backup, and data recovery seemed to be the next challenge.

Where has the deleted file in OS.js been so far? Could we access them with other apps? If this were to be done, could we consider it a bug?

What do you think of the idea of using MySQL (npm i mysql) in writing adapters? What is your proposed architecture? You do not want to add a package to the OS.js for trash?

best,
Morteza

Where has the deleted file in OS.js been so far?

Once deleted, it's gone. The VFS uses by default the host filesystem -- so it depends on that.

What do you think of the idea of using MySQL (npm i mysql) in writing adapters?

There's already a database settings adapter that supports mysql.