Storing a database in synchronization with images on the file system [PHP / Postgresql / Linux]

backstory

I support and process a couple of PHP applications, and there is one topic that I have not yet found an elegant solution on, so I'm looking for some input that can lead me to a better way to do this.

CURRENT STATE

Several of my applications allow users to store images in addition to a lot of data. All data falls into the PostgreSQL cluster, however I prefer not to save the images in the database for better performance and easier maintenance. Images get their metadata stored in the database (such as the original file name, width / height, etc.), and as soon as the database transaction succeeds, I move the image in the file system to the image directory (stored as .jpg).

PROBLEM

All these functions are great, but since many applications are used, and several people use the Internet at the same time, and PHP error and exception handling is not the most reliable in all scenarios, I sometimes worry about the impossibility of transferring image storage (in the file system) inside a database transaction (since its occurrence in the file system). I am also concerned that if the image file is damaged / modified / deleted in the file system, the database records will not be properly updated (no referential integrity).

SOLUTIONS

So far I have come to the following:

A) ( , ) . - , , , - ( 60 orso). , PostgreSQL. , .

B) ( , postgres) , . - .

C) PHP ORM Flourishlib, , ( , $file- > rename() , , , ). , , ORM (Propel), , 2 .

Sooo

, , "", , , . , .

+5
2

-, .

: integrety, - . , , db , - . - , , ;) ...

: integrety . inotofy php PHPInotify. , , - .

+1

Flourish Advanced Download. fFile, . , ( fEmail, ), , /.

0

All Articles