mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-11 07:19:06 -04:00
Allow item_rest::put() to replace the current data file. Remove
data_rest::put() altogether; it's no longer necessary.
This commit is contained in:
@@ -58,18 +58,6 @@ class data_rest_Core {
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function put($request) {
|
||||
$item = rest::resolve($request->url);
|
||||
access::required("edit", $item);
|
||||
|
||||
if ($item->is_album()) {
|
||||
throw new Rest_Exception("Bad Request", 400, array("errors" => array("type" => "invalid")));
|
||||
}
|
||||
|
||||
$item->set_data_file($request->file);
|
||||
$item->save();
|
||||
}
|
||||
|
||||
static function resolve($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
if (!access::can("view", $item)) {
|
||||
|
||||
@@ -126,6 +126,12 @@ class item_rest_Core {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the data file, if required
|
||||
if (($item->is_photo() || $item->is_movie()) && isset($request->file)) {
|
||||
$item->set_data_file($request->file);
|
||||
}
|
||||
|
||||
$item->save();
|
||||
|
||||
if (isset($request->params->members) && $item->sort_column == "weight") {
|
||||
|
||||
Reference in New Issue
Block a user