PhotoBackup / server-php

The PHP PhotoBackup server implementation
MIT License
8 stars 4 forks source link

Convert index.php into config file and move server to class file #8

Open jkufner opened 8 years ago

jkufner commented 8 years ago

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.

Zegnat commented 8 years ago

This bumps PHP requirements to 5.4? I think the current requirement is somewhere in the low PHP 4s.

Most of my hesitation to include these bigger updates has been addressed in the other issue. Though I do like the idea of creating a easily includable class for other projects to use, I am not sure if this repository is the right place for it.

Then again, that's just what I envisioned.

jkufner commented 8 years ago

It does not require anything else except namespaces. Namespaces were introduced in PHP 5.3, which is over 7 years old (30 Jun 2009) and there are no security fixes for it for two years. I've put 5.4 requirement there because of many very useful features I usually need (and don't remember how old they are), but it can be changed to 5.3 if you really wish.

(See the other issue about the vision.)