-
Notifications
You must be signed in to change notification settings - Fork 332
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
Pluggable storage backend #6180
Conversation
Set correct http response header, display error message using "404.tpl"
- add backend related columns in photo table - add system resource storage class - add code to load image data from backend class - return "nosign" image as photo meta with SystemResource backend
storage classes should implement this interface
A note: Commit 58bd75f is not directly related to the feature, but it's something I wanted to add for a while now. |
Concerning the code: Please write boolean values always lowcaps and please always leave a blank between comparator and value. And I guess @MrPetovan will prefer having only Concerning the "404.tpl" I would prefer having a single functionality for throwing HTTP errors. Have a look at |
I could use Another reason is that module code don't need to think "I should die here, or I should call System::httpExit() or System::jsonExit() ?" It just throw and error and let the system decide. Plus, if you are reusing code from a module in, let's say, API calls, and the module stop with System::httpExit(), the api call will return an html page. If the module throws an HTTPException, the api code (which is already using a catch() block for HTTPException) will render the error according to requested api format But if it's not ok, I'll use existing functions. edit: and I don't have to remember http codes :-P |
@fabrixxm We're treading in uncharted territory here. We've never had something as "nice" as we do now, so we do have to iron out some standard behavior. I like the idea of having request-agnostic outputs for modules, but the fact is that API modules and Web modules have two very different approaches to building this output, so I'm not sure we can do something truly universal. |
When not using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adding only a single code standard comment for each violation type per file to avoid spam. Please make sure that there aren't any further violations in the whole file when you fix one.
https://dev.mysql.com/doc/refman/8.0/en/blob.html BLOB and TEXT columns cannot have DEFAULT values.
Edit mod/photos.php to use Photo model
in store() if photo exists, don't update "created" timestamp
It's a little late but have considered https://github.com/thephpleague/glide ? |
Now I should write some documentation ... |
I've wrote some docs. |
Are you done with your changes? What happens if admins don't have any storage backend addon enabled yet? What happens when they do? |
I hope so. I should have changed all the important places about photo management.
They will see only core storage backends: "Filesystem" and "Database"
The new storage backend will be shown as a select option in admin page |
This pull request want to replace in-database data storage with a system of storage backends, selectable by the administrator.
The plan is to keep support for old database storage system, and being able to retrieve data from different backends when admin change the default backend.
A console command will be provided to move data between backends.
The work is focusing on photo handling and storage, but backends are generic and can be used to store attachments data as well.
my plan at the moment is
port mod/photo.php to
\Friendica\Module\Photo
update
\Friendica\Model\Photo
to do CRUD on photo table and handle data via backendsadd admin configurable photo storage backend (db, filesystem)
add a way to write storage backends as addons
update all code related to photo to use
Model\Photo
git grep -n "DBA::.*(.photo"
):add a new console command to move data data between storages
Works to attachments will be in another branch