Beispiel #1
0
/**
 * Reset icon URLs if access_id has changed
 * 
 * @param string     $event  "update:after"
 * @param string     $type   "object"|"group"
 * @param ElggObject $entity Entity
 * @return void
 * @access private
 */
function _elgg_filestore_touch_icons($event, $type, $entity)
{
    $original_attributes = $entity->getOriginalAttributes();
    if (!array_key_exists('access_id', $original_attributes)) {
        return;
    }
    if ($entity instanceof \ElggFile) {
        // we touch the file to invalidate any previously generated download URLs
        $entity->setModifiedTime();
    }
    $sizes = array_keys(elgg_get_icon_sizes($entity->getType(), $entity->getSubtype()));
    foreach ($sizes as $size) {
        $icon = $entity->getIcon($size);
        if ($icon->exists()) {
            $icon->setModifiedTime();
        }
    }
}