MishkaCmsMigration.Targets.BlogCollection (Mishka CMS Migration v0.0.1)

Copy Markdown View Source

The "category" items of a source written as the Blog's categories (MishkaBlog.Collection), through the :create and :update an admin's own category form runs, on the run's site and as the admin who pressed Import: the admin needs the Blog's admin:dashboard:blog:post, and the Blog's own rules decide the rest, such as one slug per site and how a slug is written (its slugify).

An item's title is the category's name, its "slug" and "description" the category's own (an empty description is none), and its parent the category's parent category: the walk writes the parent first, whichever the source lists first, so a nested category lands under the one it sat under (MishkaCmsMigration.Target, "An item's parent"). A category is active, as a WordPress category is live once it exists, and in the language the item names (a site that runs Polylang or WPML names one), joined as one group with the categories that are its other editions, or, for an item that names none, in the language the site leads with (MishkaCmsMigration.Targets.Helpers.Editions). An item in a language the site does not publish in waits for an admin's decision.

A category the run's site already has, with the slug as the Blog writes it, in any language, waits for an admin's decision ("slug_taken", MishkaCmsMigration.Targets.Helpers.BySlug). Connect to the existing record makes the item that category: it is not written, the posts that name it are linked to it, the categories that sat under it in the source go under it, the report says "connected", and the category is kept as it is, now and on every later run. Import as new with another slug writes the item as a category of its own, its slug followed by its source id, and the report says "another_slug".

Defined only where Mishka Blog is loaded, and supervised by MishkaCmsMigration.Application only then; on a node without the Blog its items wait for it ("blog_missing").

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for MishkaInstaller.Event.Hook.enable/0.

Callback implementation for MishkaInstaller.Event.Hook.get/0.

Optional. See MishkaInstaller.Event.Hook.health_check/0. Override to report health.

Callback implementation for MishkaInstaller.Event.Hook.register/0.

Callback implementation for MishkaInstaller.Event.Hook.restart/0.

Callback implementation for MishkaInstaller.Event.Hook.start/0.

Callback implementation for MishkaInstaller.Event.Hook.stop/0.

Types

error_return()

@type error_return() ::
  {:error, [%{action: atom(), field: atom(), message: String.t()}]}

okey_return()

@type okey_return() :: {:ok, struct() | map() | module() | [any()]}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

config()

@spec config() :: keyword()

config(key)

@spec config(atom()) :: any()

enable()

@spec enable() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.enable/0.

get()

@spec get() :: keyword()

Callback implementation for MishkaInstaller.Event.Hook.get/0.

health_check()

@spec health_check() :: :ok | {:degraded, term()} | {:error, term()}

Optional. See MishkaInstaller.Event.Hook.health_check/0. Override to report health.

on_dependency_error(error)

@spec on_dependency_error(term()) :: term()

Optional. See MishkaInstaller.Event.Hook.on_dependency_error/1. Override to react.

register()

@spec register() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.register/0.

restart()

@spec restart() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.restart/0.

start()

@spec start() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.start/0.

start_link(args \\ [])

stop()

@spec stop() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.stop/0.

unregister()

@spec unregister() :: okey_return() | error_return()

Callback implementation for MishkaInstaller.Event.Hook.unregister/0.