Ansel_Gallery::save PHP Method

save() public method

Saves any changes to this object to the backend permanently.
public save ( )
    public function save()
    {
        // Check for invalid characters in the slug.
        $slug = $this->get('slug');
        if ($slug && preg_match('/[^a-zA-Z0-9_@]/', $slug)) {
            throw new InvalidArgumentException(sprintf(_("Could not save gallery, the slug, \"%s\", contains invalid characters."), $slug));
        }
        // Check for slug uniqueness
        if (!empty($this->_oldSlug) && $slug != $this->_oldSlug) {
            if ($GLOBALS['injector']->getInstance('Ansel_Storage')->galleryExists(null, $slug)) {
                throw InvalidArgumentException(sprintf(_("Could not save gallery, the slug, \"%s\", already exists."), $slug));
            }
        }
        if ($GLOBALS['conf']['ansel_cache']['usecache']) {
            $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_Gallery' . $this->id);
        }
        try {
            $this->_share->save();
        } catch (Horde_Share_Exception $e) {
            Horde::log($e->getMessage(), 'ERR');
            throw new Ansel_Exception($e);
        }
    }