]> git.mxchange.org Git - quix0rs-gnu-social.git/commit - lib/util.php
Refactor on File::processNew
authorStephen Paul Weber <singpolyma@singpolyma.net>
Mon, 2 Nov 2015 05:15:08 +0000 (05:15 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Mon, 2 Nov 2015 05:15:08 +0000 (05:15 +0000)
commita9b1b60a97a77ba291edde4fd78bf71695f13c46
tree412b79e0f37e0cda57c9eb3f197cc4e8a27fad89
parent2c8536dbf0ef8955987138a4c108bd83cd2ca0a2
Refactor on File::processNew

The code was so involved there was even a comment asking for a refactor.

Now, File_redirection::where always returns a nice File_redirection
object instead of an array or string or nothing.  The object is
either one which already existed or else a new, unsaved object.

Instead of duplicating "does it exist" checks everywhere, do it in
File_redirection::where.  You either get what exists or something to save.

An unsaved File_redirection may be paired with an unsaved File.
You will want to save the File first (using ->saveFile()) and put the
id in File_redirection#file_id before saving.
classes/File.php
classes/File_redirection.php
lib/util.php
plugins/Oembed/OembedPlugin.php
plugins/Oembed/classes/File_oembed.php
plugins/StoreRemoteMedia/StoreRemoteMediaPlugin.php