diff --git a/src/libraries/external/epi/EpiRoute.php b/src/libraries/external/epi/EpiRoute.php index 8b0d57b25..0618efd12 100644 --- a/src/libraries/external/epi/EpiRoute.php +++ b/src/libraries/external/epi/EpiRoute.php @@ -24,6 +24,7 @@ class EpiRoute const httpGet = 'GET'; const httpOptions = 'OPTIONS'; const httpPost= 'POST'; + const httpHead= 'HEAD'; /** * get('/', 'function'); @@ -35,6 +36,7 @@ class EpiRoute public function get($route, $callback, $isApi = false) { $this->addRoute($route, $callback, self::httpGet, $isApi); + $this->addRoute($route, array($this, 'void'), self::httpHead, $isApi); } /** @@ -99,6 +101,14 @@ public function load($file) } } + /** + * EpiRoute::void + * Used for HEAD requests as the route handler + * @name void + * @author Jaisen Mathai + */ + public function void() { } + /** * EpiRoute::run($_GET['__route__'], $_['routes']); * @name run diff --git a/src/libraries/models/Photo.php b/src/libraries/models/Photo.php index 36d2b90c9..56b5d613b 100644 --- a/src/libraries/models/Photo.php +++ b/src/libraries/models/Photo.php @@ -724,7 +724,12 @@ public function replace($id, $localFile, $name, $attributes = array()) $this->logger->info('Could not purge photo versions from the database'); return false; } + // delete all photos from the original photo object (includes paths to existing photos) + // check if skipDeleteOriginal is passed in and remove from $photo and $attributes to preserve + if($skipOriginal === '1') + unset($photo['pathOriginal']); + $delFilesResp = $this->fs->deletePhoto($photo); if(!$delFilesResp) {