/** * Sets the state of a specific version of this Mailing to "published" * * @param int $version (optional) Specific version or ALWAYS_LATEST_APPROVED_VERSION (constant) to always publish the lastest approved version * @return int|false New version of the Mailing or FALSE in case of an error */ function publishVersion($version = 0) { if ($version == 0) { $version = $this->getVersion(); } $result = parent::publishVersion($version); if ($result) { $published = false; if ($version == ALWAYS_LATEST_APPROVED_VERSION) { $version = $this->getLatestApprovedVersion(); if ($version) { $published = true; } } else { $published = true; } if ($published) { $this->history->add(HISTORYTYPE_MAILING, NULL, $version, 'TXT_PAGE_H_PUBLISH'); sMailingMgr()->callExtensionHook("onPublish", $this->_id, $version); if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/MAILING_PUBLISH") == "true") { Singleton::FC()->emptyBucket(); } } } return $result; }