Publisher
Publisher

Handles publication of blog entries, including updates and deletions.

Functions
keepEditHistory
public function keepEditHistory(
$val null
)

Set or get whether publication should retain edit history.

Parameters
val

Boolean for whether to turn on edit history or null for fetch.

Returns

True if edit history is on, false otherwise.

publishArticle
public function publishArticle(
BlogEntry $entry,
DateTime $time null
)

Publish the entry as an article.

Same as publishEntry(), but publishes the entry as an article outside of the normal blog listing structure.  Throws on failure.

Parameters
entry

(BlogEntry) The entry to publish

time
DateTime$

(DateTime) Optional publication time, default is now.

Throws

Exception or EntryRenameFailed

unpublish
public function unpublish(
BlogEntry $entry
)

Unpublish the entry.

Moves the entry from a published blog entry or article to an unpublished draft entry.  Throws on failure or if the entry is not published.

Parameters
entry

(BlogEntry) The entry to unpublish

Throws

Exception or EntryRenameFailed

createDraft
public function createDraft(
BlogEntry $entry,
DateTime $time null
)

Save the entry as a new draft.

Saves a new entry in the drafts folder.  Throws on failure or if the entry already exists.

Parameters
entry

(BlogEntry) The entry to persist as a draft.

time
DateTime$

(DateTime) Optional creation time

Throws

CouldNotCreateDirectory or EntryAlreadyExists or EntryWriteFailed

update
public function update(
BlogEntry $entry,
DateTime $time null
)

Update an existing entry on disk.

Writes out the state of the entry without changing its publication status.  Throws if the update fails or the entry does not already exist.

Parameters
entry

(BlogEntry) The entry to update.

time
DateTime$

(DateTime) The optional time when the entry is updated.

Throws

EntryDoesNotExist or EntryWriteFailed or EntryRenameFailed

delete
public function delete(
BlogEntry $entry,
DateTime $time null
)

Completely delete an entry.

Applies to both published and draft entries.  Throws on failure of if the entry has not been saved.

Parameters
entry

(BlogEntry) The entry to delete.

time
DateTime$

(DateTime) The optional deletion time, used for history.

Throws

EntryDoesNotExist or EntryDeleteFailed