Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into 3.0.x

  • Loading branch information...
commit 72545003b78873989a23e2da6343afe3dee38acd 2 parents 9318f76 + 8d15e5c
@bharat bharat authored
View
17 modules/gallery/helpers/item.php
@@ -92,16 +92,15 @@ static function make_album_cover($item) {
// When albums are album covers themselves, we hotlink directly to the target item. This
// means that when we change an album cover, the grandparent may have a deep link to the old
- // album cover. So find any albums that had the old item as their album cover and switch them
- // over to the new item.
+ // album cover. So find any parent albums that had the old item as their album cover and
+ // switch them over to the new item.
if ($old_album_cover_id) {
- foreach (ORM::factory("item")
- ->where("album_cover_item_id", "=", $old_album_cover_id)
- ->find_all() as $other_album) {
- if (access::can("edit", $other_album)) {
- $other_album->album_cover_item_id = $parent->album_cover_item_id;
- $other_album->save();
- graphics::generate($other_album);
+ foreach ($item->parents(array(array("album_cover_item_id", "=", $old_album_cover_id)))
+ as $ancestor) {
+ if (access::can("edit", $ancestor)) {
+ $ancestor->album_cover_item_id = $parent->album_cover_item_id;
+ $ancestor->save();
+ graphics::generate($ancestor);
}
}
}
View
3  modules/gallery/libraries/ORM_MPTT.php
@@ -152,8 +152,9 @@ function parent() {
*
* @return array ORM
*/
- function parents() {
+ function parents($where=null) {
return $this
+ ->merge_where($where)
->where("left_ptr", "<=", $this->left_ptr)
->where("right_ptr", ">=", $this->right_ptr)
->where("id", "<>", $this->id)
Please sign in to comment.
Something went wrong with that request. Please try again.