-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblueprint.json
More file actions
55 lines (55 loc) · 2.99 KB
/
blueprint.json
File metadata and controls
55 lines (55 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"php": "latest",
"wp": "latest"
},
"siteOptions": {
"blogname": "WordPress Playground eXeLearning Demo"
},
"steps": [
{
"step": "setSiteLanguage",
"language": "es_ES"
},
{
"step": "installPlugin",
"pluginData": {
"resource": "url",
"url": "https://github.com/exelearning/wp-exelearning/archive/refs/heads/main.zip"
},
"options": {
"activate": true
}
},
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(true); ?>"
},
{
"step": "writeFile",
"path": "/tmp/test-content.elpx",
"data": {
"resource": "url",
"url": "https://raw.githubusercontent.com/exelearning/wp-exelearning/refs/heads/main/tests/fixtures/test-content.elpx"
}
},
{
"step": "writeFile",
"path": "/tmp/propiedades.elpx",
"data": {
"resource": "url",
"url": "https://raw.githubusercontent.com/exelearning/wp-exelearning/refs/heads/main/tests/fixtures/propiedades.elpx"
}
},
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; $fixtures = array( array('/tmp/test-content.elpx', 'example-content.elpx', 'eXeLearning example content'), array('/tmp/propiedades.elpx', 'propiedades.elpx', 'eXeLearning propiedades') ); foreach ($fixtures as $fixture) { $source_file = $fixture[0]; $upload_name = $fixture[1]; $title = $fixture[2]; if (!file_exists($source_file)) continue; $file_content = file_get_contents($source_file); $upload = wp_upload_bits($upload_name, null, $file_content); if ($upload['error']) continue; $file_path = $upload['file']; $file_url = $upload['url']; $attachment = array('post_mime_type' => 'application/zip', 'post_title' => $title, 'post_content' => '', 'post_status' => 'inherit', 'guid' => $file_url); $attach_id = wp_insert_attachment($attachment, $file_path); if (is_wp_error($attach_id)) continue; update_attached_file($attach_id, $file_path); $upload_dir = wp_upload_dir(); $unique_hash = sha1($file_path . time()); $destination = trailingslashit($upload_dir['basedir']) . 'exelearning/' . $unique_hash . '/'; wp_mkdir_p($destination); $zip = new ZipArchive; if ($zip->open($file_path) === TRUE) { $zip->extractTo($destination); $zip->close(); $has_preview = file_exists($destination . 'index.html') ? '1' : '0'; update_post_meta($attach_id, '_exelearning_extracted', $unique_hash); update_post_meta($attach_id, '_exelearning_has_preview', $has_preview); update_post_meta($attach_id, '_exelearning_version', '3'); } } ?>"
}
],
"features": {
"networking": true
},
"login": true,
"landingPage": "/wp-admin/post-new.php"
}