1,376 changes: 1,376 additions & 0 deletions docs/gh-pages/src/api/cm4all-wp-impex-oas.json

Large diffs are not rendered by default.

733 changes: 733 additions & 0 deletions docs/gh-pages/src/api/cm4all-wp-impex-oas.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/gh-pages/src/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

All ImpEx features are exposed by it's WordPress REST API endpoint.

The REST API is available at `/wp-json/cm4all-wp-impex/v1/`.
See [ImpEx REST API documentation](./cm4all-wp-impex-oas.md).

The REST API is also available as [OpenAPI Specification Format](https://swagger.io/specification/v2/) : Download [ImpEx OpenAPI Specification](http://0.0.0.0:3000/api/cm4all-wp-impex-oas.json) here.

You can explore the ImpEx Rest API using any HTTP Rest API Client.

Expand Down
731 changes: 731 additions & 0 deletions docs/gh-pages/src/api/swagger-api.md

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions docs/gh-pages/src/basic-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- toc -->

# Basic usage

ImpEx separates Import and Export in 2 steps using the ImpEx Dashboard screen.

![ImpEx Dashboard screen](./impex-screenshot.png)

## Export

- You need to create a snapshot first.

The snapshot will contain the current data (defined by the used [ImpEx profile](explanation-of-terms.html#profile)) of the WordPress instance.

- Now you can download the snapshot to your local machine.

## Import

- Upload snapshot from your local machine to the WordPress instance.

Uploading does not modify your current WordPress contents.

- If you now import the snapshot, the contents of your WordPress instance will be updated with the snapshot data.

> Using the [impex-cli](./impex-cli.html) command line tool will combine both steps in one. You just export or import a local directory containing the snapshot in [ImpEx Export Format](./migrating-content.html#preparation). [impex-cli](./impex-cli.html) manages the temporary snapshot handling for you.
12 changes: 12 additions & 0 deletions docs/gh-pages/src/explanation-of-terms.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ This page will clarify their meaning.

The name of the plugin stands for **Imp**ort / **Ex**port => in short **ImpEx**.

## Snapshot

A snapshot is a copy of the content to be imported/exported.

It resides in a separate WordPress database table managed by the ImpEx plugin.

> Attachments/media will be saved in a private sub-directory of the WordPress uploads folder.
You can imagine a snapshot like a server side copy of the content.

You can import / export as many snapshots as you want.

## Provider

Provider handle content for ImpEx. They are used to load (import) or extract (export) data for ImpEx.
Expand Down
5 changes: 1 addition & 4 deletions docs/gh-pages/src/impex-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,17 @@ Example usage:
impex-cli.php import \
-username=<adminuser> -password='<password>' \
-rest-url=http://localhost:8888/wp-json \
-profile=all \
~/tmp/my-export
```
This snippet will upload the whole exported data in the directory and imports them using the `all` profile at the WordPress installation.

#### `profile` option

An ImpEx import profile defines what data should be imported.
An ImpEx import profile defines what data should be imported. If not provided, the import will fallback to default import profile `all`.

> To get a list of available ImpEx import profiles see impex-cli operation [`import-profiles`](#export-profiles)
You will usually use the predefined `all` import profile.

#### `directory` argument

The `directory` argument specifies the directory where the import data resides.
Expand Down
10 changes: 5 additions & 5 deletions impex-cli/impex-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function help($options, $message = null, ...$args)
import import wordpress data exported by impex from a directory
options:
-profile=[export-profile] (required) export profile to use
-profile=[import-profile] (default='all') export profile to use
arguments:
[directory] (required) impex export directory to import from
Expand Down Expand Up @@ -343,10 +343,10 @@ function sanitizeFilename($string, $force_lowercase = true, $anal = false)

function import($options, $import_directory, ...$args)
{
$profile = $options['profile'] ?? null;
if (!$profile) {
_die($options, "Import failed: missing option 'profile'");
}
$profile = $options['profile'] ?? 'all';
// if (!$profile) {
// _die($options, "Import failed: missing option 'profile'");
// }

[$profiles] = import_profile($options, 'list');
$profiles = array_column($profiles, 'name');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cm4all-wp-impex",
"version": "1.3.4",
"version": "1.3.5",
"scripts": {
"dev": "make dev",
"build": "make",
Expand Down
6 changes: 3 additions & 3 deletions packages/@cm4all-wp-impex/generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This package provides a foundation of JavaScript functions/classes for transform

The framework does not require a WordPress instance. It rather offers an extensible platform for generating WordPress content consumable by the [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex).

> [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex) is a Open Source WordPress plugin for importing / exporting WordPress data.
> [ImpEx](https://github.com/IONOS-WordPress/cm4all-wp-impex) is a [Open Source WordPress plugin for importing / exporting WordPress data](https://github.com/IONOS-WordPress/cm4all-wp-impex).
> _[`@cm4all-wp-impex/generator`](https://www.npmjs.com/@cm4all-wp-impex/generator) is part of the [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex) project._
[Watch the tutorial on YouTube](https://img.youtube.com/vi/pjG69RmULYo/2.jpg):
[Watch the tutorial on YouTube](https://www.youtube.com/watch?v=pjG69RmULYo):

[![Watch the video](https://img.youtube.com/vi/pjG69RmULYo/2.jpg)](https://www.youtube.com/watch?v=pjG69RmULYo)

Expand All @@ -23,7 +23,7 @@ The [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex)

- functions to [create file/folder structure expected](https://ionos-wordpress.github.io/cm4all-wp-impex/migrating-content.html) by the [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex)

Last but not least [`@cm4all-wp-impex/generator`](https://www.npmjs.com/@cm4all-wp-impex/generator) includes a [full featured example transforming a complete static website into a WordPress content](https://github.com/IONOS-WordPress/cm4all-wp-impex/tree/develop/packages/%40cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion) consumable by [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex). The [example](https://github.com/IONOS-WordPress/cm4all-wp-impex/tree/develop/packages/%40cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion) is the perfect starting point for creating your own WordPress content generator.
Last but not least [`@cm4all-wp-impex/generator`](https://www.npmjs.com/@cm4all-wp-impex/generator) includes a [full featured example transforming a complete static website into WordPress content](https://github.com/IONOS-WordPress/cm4all-wp-impex/tree/develop/packages/%40cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion) consumable by [ImpEx WordPress plugin](https://github.com/IONOS-WordPress/cm4all-wp-impex). The [example](https://github.com/IONOS-WordPress/cm4all-wp-impex/tree/develop/packages/%40cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion) is the perfect starting point for creating your own WordPress content generator.

# Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ The conversion process is implemented in a single file `./index.js` :

The conversion process is implemented in less than 240 lines of code thanks to package [`@cm4all-wp-impex/generator`](https://www.npmjs.com/@cm4all-wp-impex/generator).

You can run the conversion script by executing `./index.js`
You can run the conversion script by executing `./index.js` (can be found at the GitHub repository : [packages/@cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion\index.js](https://github.com/IONOS-WordPress/cm4all-wp-impex/blob/develop/packages/%40cm4all-wp-impex/generator/examples/impex-complete-static-homepage-conversion/index.js)

> Ensure the right nodejs version is active before using `nvm install` and to install the required NodeJS dependencies using `npm ci`.
> Ensure that you've installed the script dependencies by entering directory `cm4all-wp-impex/packages/@cm4all-wp-impex/generator` and executing `npm ci`.
The result is a folder `generated-impex-import/` containing the generated [ImpEx export folder layout](https://ionos-wordpress.github.io/cm4all-wp-impex/migrating-content.html#preparation) containing the ImpEx slice JSON files and media files.

This export can now be imported into WordPress using [ImpEx CLI](https://ionos-wordpress.github.io/cm4all-wp-impex/impex-cli.html) :

```sh
impex-cli.php import -username=<adminusername> -password=<adminpassword> -rest-url=<your-wordpress-rest-api-endpoint> -profile=all ./generated-impex-export/
impex-cli.php import -username=<adminusername> -password=<adminpassword> -rest-url=<your-wordpress-rest-api-endpoint> ./generated-impex-export/
```

_(Replace the `<placeholder>` with your own values.)_
Expand Down
6 changes: 3 additions & 3 deletions packages/@cm4all-wp-impex/generator/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@cm4all-wp-impex/generator",
"version": "1.3.4",
"description": "Foundation for transforming any data to Gutenberg block annotated WordPress content into WordPress ImpEx plugin (https://github.com/IONOS-WordPress/cm4all-wp-impex) export format",
"version": "1.3.5",
"description": "Transforming any data to Gutenberg block annotated WordPress content by generating WordPress ImpEx plugin (https://github.com/IONOS-WordPress/cm4all-wp-impex) files",
"keywords": [
"cm4all-wp-impex",
"transform",
Expand All @@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/IONOS-WordPress/cm4all-wp-impex/tree/develop/packages/%40cm4all-wp-impex/generator"
"url": "https://github.com/IONOS-WordPress/cm4all-wp-impex.git"
},
"author": {
"name": "Lars Gersmann",
Expand Down
4 changes: 2 additions & 2 deletions plugins/cm4all-wp-impex-example/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Plugin Name: cm4all-wp-impex-example
* Plugin URI: http://dev.intern.cm-ag/trinity/research/cm4all-wp-impex
* Description: Example plugin contributing additional Importer/Exporter facilities to ImpEx plugin
* Version: 1.3.4
* Version: 1.3.5
* Tags: import, export, migration
* Requires PHP: 8.0
* Requires at least: 5.7
* Tested up to: 5.9
* Tested up to: 6.0
* Author: Lars Gersmann, CM4all
* Author URI: https://cm4all.com
* Domain Path: /languages
Expand Down
4 changes: 2 additions & 2 deletions plugins/cm4all-wp-impex/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Plugin Name: cm4all-wp-impex
* Plugin URI: https://github.com/IONOS-WordPress/cm4all-wp-impex
* Description: ImpEx contributes extendable Import / Export functionality to WordPress
* Version: 1.3.4
* Version: 1.3.5
* Tags: import, export, migration
* Requires PHP: 8.0
* Requires at least: 5.7
* Tested up to: 5.9
* Tested up to: 6.0
* Author: Lars Gersmann, CM4all
* Author URI: https://cm4all.com
* Domain Path: /languages
Expand Down
24 changes: 6 additions & 18 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,23 @@

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Set\ValueObject\DowngradeSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector;

return static function (ContainerConfigurator $containerConfigurator): void {
return static function (RectorConfig $rectorConfig): void {
// get parameters
$parameters = $containerConfigurator->parameters();
$parameters = $rectorConfig->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/dist/cm4all-wp-impex-php7.4.0'
]);
$parameters->set(Option::PARALLEL, false);

$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80);

// Define what rule sets will be applied
// $containerConfigurator->import(SetList::CODE_QUALITY);
$containerConfigurator->import(DowngradeLevelSetList::DOWN_TO_PHP_80);
$containerConfigurator->import(DowngradeSetList::PHP_80);

// get services (needed for register a single rule)
//$services = $containerConfigurator->services();
//$services->set(DowngradeNamedArgumentRector::class);


// register a single rule
// $services->set(TypedPropertyRector::class);
$rectorConfig->import(DowngradeLevelSetList::DOWN_TO_PHP_80);
$rectorConfig->import(DowngradeSetList::PHP_80);
};