Skip to content

Latest commit

 

History

History
100 lines (89 loc) · 4.16 KB

demos.md

File metadata and controls

100 lines (89 loc) · 4.16 KB

Demos

Demos of QMX are available via the WordPress Playground:

URL Generation

WordPress Playground URLs are generated using the below JavaScript, available at https://jsfiddle.net/crstauf/m54cdobk/.

const muplugin = false;

let zipArtifactUrl = 'https://calebstauffer.wpengine.com/plugin-proxy.php?repo=crstauf/query-monitor-extend&name=plugin.zip';

// Install as plugin.
let blueprint = {
  landingPage: '/wp-admin/plugins.php',
  steps: [
    {
      step: 'login',
      username: 'admin',
      password: 'password',
    },
    {
      step: 'installPlugin',
      pluginZipFile: {
        resource: 'wordpress.org/plugins',
        slug: 'query-monitor',
      },
    },
    {
      step: 'installPlugin',
      pluginZipFile: {
        resource: 'url',
        url: zipArtifactUrl,
        caption: "Installing Query Monitor Extend",
      },
    },
  ],
};

// Install as mu-plugin.
if ( muplugin ) {
  zipArtifactUrl = 'https://calebstauffer.wpengine.com/plugin-proxy.php?repo=crstauf/query-monitor-extend&name=mu-plugin.zip';

  blueprint.landingPage = '/wp-admin/plugins.php?plugin_status=mustuse';

  blueprint.steps = [
    {
      step: 'login',
      username: 'admin',
      password: 'password',
    },
    {
      step: 'installPlugin',
      pluginZipFile: {
        resource: 'wordpress.org/plugins',
        slug: 'query-monitor',
      },
    },
    {
      step: 'mkdir',
      path: '/wordpress/qmx',
    },
    {
      step: 'writeFile',
      path: '/wordpress/qmx/mu-plugin.zip',
      data: {
        resource: 'url',
        url: zipArtifactUrl,
        caption: 'Downloading Query Monitor Extend',
      },
      progress: {
        weight: 2,
        caption: 'Installing Query Monitor Extend',
      },
    },
    {
      step: 'unzip',
      zipPath: '/wordpress/qmx/mu-plugin.zip',
      extractToPath: '/wordpress/qmx',
    },
    {
      step: 'mv',
      fromPath: '/wordpress/qmx/mu-plugins/query-monitor-extend',
      toPath: '/wordpress/wp-content/mu-plugins/query-monitor-extend',
    },
    {
      step: 'mv',
      fromPath: '/wordpress/qmx/mu-plugins/load-qmx.php',
      toPath: '/wordpress/wp-content/mu-plugins/load-qmx.php',
    }
  ];
}

const encoded = JSON.stringify( blueprint );
document.write( 'https://playground.wordpress.net/#' + encodeURI( encoded ) );