Simplify WordPress Playground multisite blueprint with manual activation instructions

This commit is contained in:
2025-04-22 00:43:05 +01:00
parent 6eb7b2c4e3
commit b10ea120cd
4 changed files with 15 additions and 71 deletions

View File

@@ -17,7 +17,10 @@ The easiest way to test our plugin with WordPress Playground is to use the onlin
1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4)
2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=13)
2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=14)
- After WordPress loads, go to Settings > General
- Scroll down and check "Allow network access" and "Create a multisite network"
- Click "Apply Settings & Reset Playground"
These links will automatically set up WordPress with our plugin installed and activated.
@@ -32,7 +35,7 @@ To run tests with WordPress Playground:
1. Open the appropriate WordPress Playground link:
- [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4)
- [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=13)
- [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=14) (requires manual multisite activation)
2. Test the plugin manually in the browser

View File

@@ -106,7 +106,10 @@ The easiest way to test our plugin with WordPress Playground is to use the onlin
1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=4)
2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=13)
2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=14)
- After WordPress loads, go to Settings > General
- Scroll down and check "Allow network access" and "Create a multisite network"
- Click "Apply Settings & Reset Playground"
These links will automatically set up WordPress with a sample plugin installed and activated.

View File

@@ -1,83 +1,21 @@
{
"landingPage": "/wp-admin/",
"landingPage": "/wp-admin/options-general.php",
"login": true,
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"options": {
"multisite": true,
"networking": true
},
"steps": [
{
"step": "defineWpConfig",
"name": "WP_DEBUG",
"value": true
},
{
"step": "defineWpConfig",
"name": "WP_DEBUG_LOG",
"value": true
},
{
"step": "defineWpConfig",
"name": "WP_DEBUG_DISPLAY",
"value": false
},
{
"step": "runPHP",
"code": "<?php\nerror_log('Starting WordPress installation check...');\nrequire_once('/wordpress/wp-admin/install.php');\nif (!is_blog_installed()) {\n error_log('WordPress not installed, installing now...');\n wp_install('WordPress Multisite', 'admin', 'admin@example.com', true);\n error_log('WordPress installation completed');\n} else {\n error_log('WordPress already installed');\n}\n"
},
{
"step": "defineWpConfig",
"name": "WP_ALLOW_MULTISITE",
"value": true
},
{
"step": "runPHP",
"code": "<?php\nerror_log('Setting up multisite network...');\nrequire_once('/wordpress/wp-load.php');\nrequire_once('/wordpress/wp-admin/includes/upgrade.php');\nrequire_once('/wordpress/wp-admin/includes/admin.php');\nrequire_once('/wordpress/wp-admin/includes/schema.php');\n\n// Simulate network setup\n$network_data = [\n 'site_name' => 'WordPress Multisite',\n 'subdomain_install' => false,\n 'domain' => 'localhost',\n 'path' => '/',\n 'email' => 'admin@example.com'\n];\n\nupdate_option('admin_email', $network_data['email']);\n\ntry {\n error_log('Running wp_install_network()...');\n wp_install_network($network_data);\n error_log('Network setup completed successfully');\n} catch (Exception $e) {\n error_log('Network setup error: ' . $e->getMessage());\n}\n"
},
{
"step": "defineWpConfig",
"name": "MULTISITE",
"value": true
},
{
"step": "defineWpConfig",
"name": "SUBDOMAIN_INSTALL",
"value": false
},
{
"step": "defineWpConfig",
"name": "DOMAIN_CURRENT_SITE",
"value": "localhost"
},
{
"step": "defineWpConfig",
"name": "PATH_CURRENT_SITE",
"value": "/"
},
{
"step": "defineWpConfig",
"name": "SITE_ID_CURRENT_SITE",
"value": 1
},
{
"step": "defineWpConfig",
"name": "BLOG_ID_CURRENT_SITE",
"value": 1
},
{
"step": "runPHP",
"code": "<?php\nerror_log('Verifying multisite setup...');\nrequire_once('/wordpress/wp-load.php');\nerror_log('Is multisite: ' . (is_multisite() ? 'Yes' : 'No'));\n\nglobal $wpdb;\n$tables = $wpdb->get_results('SHOW TABLES LIKE \\'' . $wpdb->prefix . 'site\\';');\nerror_log('Multisite tables found: ' . count($tables));\n\nif (is_multisite()) {\n error_log('Creating test subsite...');\n $domain = 'localhost';\n $path = '/testsite/';\n $title = 'Test Subsite';\n $user_id = 1;\n\n if (!function_exists('get_site_by_path')) {\n require_once('/wordpress/wp-includes/ms-blogs.php');\n }\n\n if (!get_site_by_path($domain, $path)) {\n $blog_id = wpmu_create_blog($domain, $path, $title, $user_id);\n if (is_wp_error($blog_id)) {\n error_log('Subsite creation error: ' . $blog_id->get_error_message());\n } else {\n error_log('Created subsite with ID: ' . $blog_id);\n }\n } else {\n error_log('Subsite already exists');\n }\n}\n"
},
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "coblocks"
}
},
{
"step": "runPHP",
"code": "<?php\nerror_log('Setup complete, displaying debug log...');\nif (file_exists('/wordpress/wp-content/debug.log')) {\n $log = file_get_contents('/wordpress/wp-content/debug.log');\n error_log('Debug log contents: ' . $log);\n} else {\n error_log('Debug log file not found');\n}\n"
}
]
}

View File

@@ -20,6 +20,6 @@
</style>
</head>
<body>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=13"></iframe>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=14"></iframe>
</body>
</html>