From cc7bc90b7ad369c77536cdd00b526d84ed7d275c Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 09:50:18 +0100 Subject: [PATCH 01/26] added error log messages --- .../blueprint.json | 25 ++++++++++++++++--- .../starter-content.xml | 0 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 blueprints/reset-data-and-import-content/starter-content.xml diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 31900d3..03cbdf6 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -1,20 +1,39 @@ { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "meta": { - "title": "Reset data", - "description": "It gets a WordPress installation without any content", + "title": "Reset data and import content", + "description": "It resets dedault data before importing custom content", "author": "juanmaguitar", "categories": ["reset"] }, - "landingPage": "/wp-admin", + "landingPage": "/wp-admin/edit.php", "steps": [ { "step": "login", "username": "admin", "password": "password" }, + { + "step": "runPHP", + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" + }, { "step": "resetData" + }, + { + "step": "runPHP", + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" + }, + { + "step": "importWxr", + "file": { + "resource": "url", + "url": "https://raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/starter-content.xml" + } + }, + { + "step": "runPHP", + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" } ] } diff --git a/blueprints/reset-data-and-import-content/starter-content.xml b/blueprints/reset-data-and-import-content/starter-content.xml new file mode 100644 index 0000000..e69de29 From 4d0c681c8fff72bc8614d833327ee7f8576d73da Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 09:54:27 +0100 Subject: [PATCH 02/26] install debug log manager --- blueprints/reset-data-and-import-content/blueprint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 03cbdf6..7a51290 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -7,6 +7,7 @@ "categories": ["reset"] }, "landingPage": "/wp-admin/edit.php", + "plugins": ["debug-log-manager"], "steps": [ { "step": "login", From a9f1688911359f2db04b9ade234217178827c4c9 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 09:56:50 +0100 Subject: [PATCH 03/26] cleaned spaces --- .../reset-data-and-import-content/blueprint.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 7a51290..bd17929 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -1,8 +1,8 @@ { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "meta": { - "title": "Reset data and import content", - "description": "It resets dedault data before importing custom content", + "title": "Resetdataandimportcontent", + "description": "Itresetsdedaultdatabeforeimportingcustomcontent", "author": "juanmaguitar", "categories": ["reset"] }, @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" }, { "step": "resetData" }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1 ); $posts = get_posts( $args ); error_log( 'Post Title: ' . $post[$posts.length]->post_title );" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" } ] } From c91169f737b0e255d2689343be66644cf8762344 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 09:58:40 +0100 Subject: [PATCH 04/26] fixed space issue --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index bd17929..84bde70 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" }, { "step": "resetData" }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" } ] } From 2ff405a9dc755cba667ed0f03bca5e1713aad4a1 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:02:29 +0100 Subject: [PATCH 05/26] fixed PHP --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 84bde70..9ca890c 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" }, { "step": "resetData" }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$post[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" } ] } From ce91e9a416bba7149d2f5d581642440c726d0851 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:05:40 +0100 Subject: [PATCH 06/26] better log messages --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 9ca890c..77f0635 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post by default');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" }, { "step": "resetData" }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after resetData');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('PostTitle:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after importWxr');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" } ] } From 36bd9685235689e956df986f03e9bea7deba3def Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:08:35 +0100 Subject: [PATCH 07/26] fixed lenght array errors --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 77f0635..ec20342 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post by default');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post by default');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" }, { "step": "resetData" }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after resetData');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after resetData');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after importWxr');error_log($posts.length. ' posts - Last Post title:'.$posts[$posts.length]->post_title);" + "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after importWxr');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" } ] } From 23aa3206fac95d0bc8ff627e18b69c96605d8b5f Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:12:53 +0100 Subject: [PATCH 08/26] prevent no content errors --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index ec20342..a4dab7b 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post by default');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "resetData" }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after resetData');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": "'post','post_status'=>'publish','posts_per_page'=>-1);$posts=get_posts($args);error_log('Last post after importWxr');error_log(count($posts). ' posts - Last Post title:'.$posts[count($posts) - 1]->post_title);" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" } ] } From 71aa266d22791d3287b4492ed1aae2e0937360be Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:15:34 +0100 Subject: [PATCH 09/26] added comments to track snippets of code --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index a4dab7b..d7f555b 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -16,14 +16,14 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "resetData" }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" } ] } From 48e87294931ed53674e186ce8faf4d8ac05836dd Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:17:50 +0100 Subject: [PATCH 10/26] require wp-load always --- blueprints/reset-data-and-import-content/blueprint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index d7f555b..f0c32e7 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -23,7 +23,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "importWxr", @@ -34,7 +34,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" } ] } From 5d8f6473e5383416789a2e3815f47e3e7f17dd81 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:20:03 +0100 Subject: [PATCH 11/26] updated error logs --- blueprints/reset-data-and-import-content/blueprint.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index f0c32e7..f977c19 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -7,7 +7,6 @@ "categories": ["reset"] }, "landingPage": "/wp-admin/edit.php", - "plugins": ["debug-log-manager"], "steps": [ { "step": "login", @@ -23,7 +22,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after resetData'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "importWxr", @@ -34,7 +33,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after importWxr'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" } ] } From 549fd405a947d076858cf7311d4a28d1d01ed1b6 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:25:22 +0100 Subject: [PATCH 12/26] updated starter content --- .../starter-content.xml | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/blueprints/reset-data-and-import-content/starter-content.xml b/blueprints/reset-data-and-import-content/starter-content.xml index e69de29..0e54c64 100644 --- a/blueprints/reset-data-and-import-content/starter-content.xml +++ b/blueprints/reset-data-and-import-content/starter-content.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + My WordPress Website + https://playground.wordpress.net/scope:0.1608808646050726 + + Mon, 10 Jun 2024 12:29:10 +0000 + en-US + 1.2 + https://playground.wordpress.net/scope:0.1608808646050726 + https://playground.wordpress.net/scope:0.1608808646050726 + + + 1 + + + + + + + + + https://wordpress.org/?v=6.5.4 + + + <![CDATA["The Road Not Taken" by Robert Frost]]> + https://playground.wordpress.net/scope:0.1608808646050726/?p=1 + Wed, 05 Jun 2024 16:04:48 +0000 + + http://127.0.0.1:9400/?p=1 + + +

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

+ + + +

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

+ + + +

And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

+ + + +

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.

+]]>
+ + 10 + + + + + + + + + 0 + 0 + + + 0 + + + + + + + + + +
+
+
+ \ No newline at end of file From 4dba3f6ef13ee7eeab5acb8249211e6700fb4965 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 10:30:05 +0100 Subject: [PATCH 13/26] created function --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index f977c19..f32e247 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -15,14 +15,14 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log($message); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found'); }; log_content_state('Last post by default');" }, { "step": "resetData" }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after resetData'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after importWxr'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " Date: Thu, 1 Aug 2024 10:31:28 +0100 Subject: [PATCH 14/26] removed functions --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index f32e247..f977c19 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -15,14 +15,14 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log($message); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found'); }; log_content_state('Last post by default');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "resetData" }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after resetData'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" }, { "step": "importWxr", @@ -33,7 +33,7 @@ }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after importWxr'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" } ] } From 1bea9903b934e57091df33517d50f61a47308b2b Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 11:10:57 +0100 Subject: [PATCH 15/26] import funtion as mu-plugin --- .../blueprint.json | 14 +++++++--- .../log-content-state.php | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 blueprints/reset-data-and-import-content/log-content-state.php diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index f977c19..f0fa01b 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -13,16 +13,24 @@ "username": "admin", "password": "password" }, + { + "step": "writeFile", + "path": "/wordpress/wp-content/mu-plugins/log-content-state.php", + "data": { + "resource": "url", + "url": "raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/log-content-state.php" + } + }, { "step": "runPHP", - "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post by default'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after resetData'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1); $posts = get_posts($args); error_log('Last post after importWxr'); !empty($posts) ? error_log(count($posts) . ' posts - Last Post title: ' . $posts[count($posts) - 1]->post_title) : error_log('No posts found');" + "code": " "post", + "post_status" => "publish", + "posts_per_page" => -1, + ]; + + $posts = get_posts($args); + error_log($message); + + if (!empty($posts)) { + $last_post = $posts[count($posts) - 1]; + error_log( + count($posts) . + " posts - Last Post title: " . + $last_post->post_title + ); + } else { + error_log("No posts found"); + } +} From 49bd8c7ca9981fa8b012f3f8da31f3603fa678bd Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 11:11:27 +0100 Subject: [PATCH 16/26] removed semicolons after comments --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index f0fa01b..2cd33dd 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -23,14 +23,14 @@ }, { "step": "runPHP", - "code": " Date: Thu, 1 Aug 2024 11:13:59 +0100 Subject: [PATCH 17/26] fixed url log-content-state.php --- blueprints/reset-data-and-import-content/blueprint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 2cd33dd..df9e604 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -18,7 +18,7 @@ "path": "/wordpress/wp-content/mu-plugins/log-content-state.php", "data": { "resource": "url", - "url": "raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/log-content-state.php" + "url": "https://raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/log-content-state.php" } }, { From 2906f9718e34e1ff86ef4021e6e3de1bf7c28f3a Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 11:20:27 +0100 Subject: [PATCH 18/26] added namespace --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- .../reset-data-and-import-content/log-content-state.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index df9e604..e1ce115 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -23,14 +23,14 @@ }, { "step": "runPHP", - "code": " Date: Thu, 1 Aug 2024 11:29:00 +0100 Subject: [PATCH 19/26] different mu-plugin approach --- blueprints/reset-data-and-import-content/blueprint.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index e1ce115..a732af4 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -15,11 +15,8 @@ }, { "step": "writeFile", - "path": "/wordpress/wp-content/mu-plugins/log-content-state.php", - "data": { - "resource": "url", - "url": "https://raw.githubusercontent.com/wordpress-juanmaguitar/blueprints/trunk/blueprints/reset-data-and-import-content/log-content-state.php" - } + "path": "/wordpress/wp-content/mu-plugins/log_content_state.php", + "data": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1]; $posts = get_posts($args); error_log($message); if (!empty($posts)) { $last_post = $posts[count($posts) - 1]; error_log(count($posts) . ' posts - Last Post title: ' . $last_post->post_title); } else { error_log('No posts found'); } }" }, { "step": "runPHP", From f5bb1ac3484bef90b7039b5eba75004bb94999d1 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 11:32:06 +0100 Subject: [PATCH 20/26] wp-load required --- blueprints/reset-data-and-import-content/blueprint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index a732af4..ec70441 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -20,14 +20,14 @@ }, { "step": "runPHP", - "code": " Date: Thu, 1 Aug 2024 12:01:12 +0100 Subject: [PATCH 21/26] added wpide plugin --- blueprints/reset-data-and-import-content/blueprint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index ec70441..1b99296 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -7,6 +7,7 @@ "categories": ["reset"] }, "landingPage": "/wp-admin/edit.php", + "plugins": ["wpide"], "steps": [ { "step": "login", From 5a94be057ad062e09ac84f9b25f963508d0a6c71 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 12:05:02 +0100 Subject: [PATCH 22/26] improved comments PHP --- .../reset-data-and-import-content/blueprint.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 1b99296..044cd13 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -1,8 +1,8 @@ { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "meta": { - "title": "Resetdataandimportcontent", - "description": "Itresetsdedaultdatabeforeimportingcustomcontent", + "title": "Reset data and import content", + "description": "It resets dedault data before importing custom content", "author": "juanmaguitar", "categories": ["reset"] }, @@ -17,18 +17,18 @@ { "step": "writeFile", "path": "/wordpress/wp-content/mu-plugins/log_content_state.php", - "data": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1]; $posts = get_posts($args); error_log($message); if (!empty($posts)) { $last_post = $posts[count($posts) - 1]; error_log(count($posts) . ' posts - Last Post title: ' . $last_post->post_title); } else { error_log('No posts found'); } }" + "data": " 'post', 'post_status' => 'publish', 'posts_per_page' => -1]; $posts = get_posts($args); error_log($message); if (!empty($posts)) { $last_post = $posts[count($posts) - 1]; error_log(count($posts) . ' posts - Last Post title: ' . $last_post->post_title); } else { error_log('No posts found'); } }" }, { "step": "runPHP", - "code": " Date: Thu, 1 Aug 2024 12:05:27 +0100 Subject: [PATCH 23/26] removed wpide plugin --- blueprints/reset-data-and-import-content/blueprint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 044cd13..7be9db3 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -7,7 +7,6 @@ "categories": ["reset"] }, "landingPage": "/wp-admin/edit.php", - "plugins": ["wpide"], "steps": [ { "step": "login", From 030b6c09e0ec1375ff133eda6073e60672388f90 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 12:08:09 +0100 Subject: [PATCH 24/26] updated categories and removed php file --- .../blueprint.json | 4 +-- .../log-content-state.php | 28 ------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 blueprints/reset-data-and-import-content/log-content-state.php diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 7be9db3..4861630 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -2,9 +2,9 @@ "$schema": "https://playground.wordpress.net/blueprint-schema.json", "meta": { "title": "Reset data and import content", - "description": "It resets dedault data before importing custom content", + "description": "It resets default data before importing custom content. It also logs the state of the content after each step.", "author": "juanmaguitar", - "categories": ["reset"] + "categories": ["reset", "log", "debug", "debug", "import", "content"] }, "landingPage": "/wp-admin/edit.php", "steps": [ diff --git a/blueprints/reset-data-and-import-content/log-content-state.php b/blueprints/reset-data-and-import-content/log-content-state.php deleted file mode 100644 index fb37f1c..0000000 --- a/blueprints/reset-data-and-import-content/log-content-state.php +++ /dev/null @@ -1,28 +0,0 @@ - "post", - "post_status" => "publish", - "posts_per_page" => -1, - ]; - - $posts = get_posts($args); - error_log($message); - - if (!empty($posts)) { - $last_post = $posts[count($posts) - 1]; - error_log( - count($posts) . - " posts - Last Post title: " . - $last_post->post_title - ); - } else { - error_log("No posts found"); - } -} From ba58af23abac6ca33fc17a23dd73eda867ca0c0e Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Thu, 1 Aug 2024 12:14:16 +0100 Subject: [PATCH 25/26] added with logs to title --- blueprints/reset-data-and-import-content/blueprint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints/reset-data-and-import-content/blueprint.json b/blueprints/reset-data-and-import-content/blueprint.json index 4861630..8fe31ab 100644 --- a/blueprints/reset-data-and-import-content/blueprint.json +++ b/blueprints/reset-data-and-import-content/blueprint.json @@ -1,7 +1,7 @@ { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "meta": { - "title": "Reset data and import content", + "title": "Reset data and import content (with logs)", "description": "It resets default data before importing custom content. It also logs the state of the content after each step.", "author": "juanmaguitar", "categories": ["reset", "log", "debug", "debug", "import", "content"] From 4e6ad4ce00237a1ae9e310e3525e93806f070d88 Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Tue, 3 Sep 2024 12:24:39 +0200 Subject: [PATCH 26/26] new example of installing a theme from a GitHub repository --- .../blueprint.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 blueprints/install-theme-from-directory-repo/blueprint.json diff --git a/blueprints/install-theme-from-directory-repo/blueprint.json b/blueprints/install-theme-from-directory-repo/blueprint.json new file mode 100644 index 0000000..bbea3f6 --- /dev/null +++ b/blueprints/install-theme-from-directory-repo/blueprint.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://playground.wordpress.net/blueprint-schema.json", + "meta": { + "title": "Install theme from a GitHub repo", + "description": "It installs a theme from a directory inside a GitHub repo.", + "author": "juanmaguitar", + "categories": ["theme", "repository", "test"] + }, + "landingPage": "/wp-admin/post.php", + "preferredVersions": { + "php": "8.0", + "wp": "beta" + }, + "features": { + "networking": true + }, + "login": true, + "steps": [ + { + "step": "installTheme", + "themeZipFile": { + "resource": "url", + "url": "https://github-proxy.com/proxy/?repo=Automattic/themes&branch=trunk&directory=assembler" + }, + "options": { + "activate": true + } + } + ] +}