Convert index.php into config file and move server to class file #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The primary motivation for this change is to allow integration into a third party application. This is the first step which does not really change behavior of the server, but allows further refactoring into a nice library.
I would like to see integration in some kind of advanced gallery or something: User sets up automatic backup of his phone into a private gallery and then he can move selected photos to public galleries.
Making this project usable as a library makes it easy to follow changes in the API (protocol) while PhotoBackup developers don't have to waste time with updating complex server implementations.
Changes
Fixes #2: index.php is now considered a configuration file (which loads
the server at the end). To avoid conflicts during update the index.php
is not committed to repository, instead a index.php.example is provided.
It is also possible to move index.php somewhere outside the document
root and include it from the real index.php (see instructions in the
index.php.example).
The whole project is now a Composer package. Composer is not neccessary
when running this as standalone server, but it allows to use this
project as a library.
Also, it fixes #6 - a missing parameter in checking for duplicates.