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

DRAFT of "file attachments" #5202

Closed
wants to merge 39 commits into from
Closed

DRAFT of "file attachments" #5202

wants to merge 39 commits into from

Conversation

crossan007
Copy link
Contributor

@crossan007 crossan007 commented Mar 28, 2020

What's this PR do?

creates a new database table for "files" and one for "file associations"
Files can be created / deleted / retrieved from both the person and family(v2) views.
Files associated with a person are displayed on the person page.
Files associated with a family are displayed on the V2 family page.

A rudimentary WebDAV implementation is provided as well to provide file access via external client.

The underlying file storage mechanism is as follows:

File storage implementation

  1. At file create time, the SHA256 is calculated
  2. A UserData directory is created in the src folder (if it doesn't already exist)
  3. Within UserData, a top-level subdirectory is created with the first character of the SHA256 hash of the file; A second-level subdirectory is then created with the second character of the hash in like-manner. (This avoids a large-gathering of files in one folder, and prevents users from creating files with "stupid characters" that make things messy server-side)
  4. The filename, hash, size, and created/modified dates are persisted to the SQL database.

file retrieval implementation

  1. The file is requested by id.
  2. The given file id's hash is fetched from SQL
  3. The file is identified on disk by hash (according to the folder structure above)
  4. The hash is checked.
  5. IF the hash matches, the file is served by the file model using the Slim Response object

Screenshots (if appropriate)

image

image

image

Related Issues:

#122
#350
#4658
#4800
#4786
#4498

@crossan007 crossan007 changed the title DRAFT of "file attachments DRAFT of "file attachments" Mar 28, 2020
@crossan007 crossan007 requested a review from MrClever March 28, 2020 03:37
@crossan007 crossan007 added this to the Backlog milestone Mar 28, 2020
src/webdav/index.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@MrClever MrClever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out and tested the web-facing functionality on my dev system successfully. Also the directory creation needs to use the correct mode (0755) instead of 600.

I haven't looked into the WEBDAV functionality yet, but I can see the path (/CRM/wbdav) being buried in the code causing problems:

  • users changing code will trigger a file integrity warning
  • obscure config requirement; ideally users shouldn't need to go beyond Include/Config.php and the system settings in the web interface.

@DawoudIO DawoudIO closed this Jun 20, 2022
@DawoudIO DawoudIO deleted the feature/files branch October 25, 2023 15:56
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

Successfully merging this pull request may close these issues.

3 participants