{"id":73465,"date":"2017-08-19T04:05:02","date_gmt":"2017-08-19T04:05:02","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/wp-utility-script-runner\/"},"modified":"2018-10-22T20:34:51","modified_gmt":"2018-10-22T20:34:51","slug":"wp-utility-script-runner","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/wp-utility-script-runner\/","author":14892768,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.0","stable_tag":"trunk","tested":"5.0.25","requires":"4.6","requires_php":"","requires_plugins":"","header_name":"WP Utility Script Runner","header_author":"Burlington Bytes","header_description":"Write, manage, and run simple \"Utility Scripts\" (tasks that do not need to run on every page load)","assets_banners_color":"3ebedc","last_updated":"2018-10-22 20:34:51","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/www.burlingtonbytes.com","rating":5,"author_block_rating":0,"active_installs":90,"downloads":3452,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":{"icon-128x128.jpg":{"filename":"icon-128x128.jpg","revision":"1960906","resolution":"128x128","location":"assets"},"icon-256x256.jpg":{"filename":"icon-256x256.jpg","revision":"1960906","resolution":"256x256","location":"assets"}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":"1960906","resolution":"1544x500","location":"assets"},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":"1960906","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1716167","resolution":"1","location":"assets"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":"1716167","resolution":"2","location":"assets"},"screenshot-3.png":{"filename":"screenshot-3.png","revision":"1716167","resolution":"3","location":"assets"},"screenshot-4.png":{"filename":"screenshot-4.png","revision":"1716167","resolution":"4","location":"assets"}},"screenshots":{"1":"The simplest version of a utility only has 17 lines of required code.","2":"Utilities can be enabled and disabled from the manage tab","3":"Scripts are tucked away behind accordions, to prevent accidentally running them.","4":"Output is presented in real-time, without refreshing the page"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[4567,3772,145248,9600,4351],"plugin_category":[59],"plugin_contributors":[97286,125140],"plugin_business_model":[],"class_list":["post-73465","plugin","type-plugin","status-publish","hentry","plugin_tags-cron","plugin_tags-developers","plugin_tags-run-once","plugin_tags-task","plugin_tags-utilities","plugin_category-utilities-and-tools","plugin_contributors-burlingtonbytes","plugin_contributors-gschoppe","plugin_committers-burlingtonbytes"],"banners":{"banner":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/banner-772x250.jpg?rev=1960906","banner_2x":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/banner-1544x500.jpg?rev=1960906","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/icon-128x128.jpg?rev=1960906","icon_2x":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/icon-256x256.jpg?rev=1960906","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/screenshot-1.png?rev=1716167","caption":"The simplest version of a utility only has 17 lines of required code."},{"src":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/screenshot-2.png?rev=1716167","caption":"Utilities can be enabled and disabled from the manage tab"},{"src":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/screenshot-3.png?rev=1716167","caption":"Scripts are tucked away behind accordions, to prevent accidentally running them."},{"src":"https:\/\/ps.w.org\/wp-utility-script-runner\/assets\/screenshot-4.png?rev=1716167","caption":"Output is presented in real-time, without refreshing the page"}],"raw_content":"<!--section=description-->\n<p>Sometimes, you run into a situation where you just need to manually run a script. The actual logic might be as simple as generating a csv from a query, or changing a user's settings, or even just running a single line of SQL. WordPress makes this difficult.<\/p>\n\n<p>There are many hacky solutions to the problem, but most of them lack security or are too difficult for anyone but a developer to run or just take too long to build. That's where we come in.<\/p>\n\n<p>WP Utility Script Runner lets you start with a simple 17 line template, add in your custom code, save to the server, and in minutes you have a secure, fully featured utility, that you can safely run from the WordPress dashboard.<\/p>\n\n<p>But that's not all! With a few extra lines of code, your utility can:<\/p>\n\n<ul>\n<li>Accept user input<\/li>\n<li>Accept file input<\/li>\n<li>Run at a future date and time<\/li>\n<li>Run on a recurring schedule<\/li>\n<li>Run large tasks by breaking them up into several smaller tasks, and saving state.<\/li>\n<li>Create reports and other output files<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin files to the <code>\/wp-content\/plugins\/plugin-name<\/code> directory, or install the plugin through the WordPress plugins screen directly.<\/li>\n<li>Activate the plugin through the 'Plugins' screen in WordPress<\/li>\n<li>Use the Settings-&gt;Utility Scripts screen to manage and run utility scripts<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Why would I ever need to run a script on-demand, rather than on page load?<\/dt>\n<dd><p>There are many times running on page load is not the best option:<\/p>\n\n<ul>\n<li>You may want to ensure that a task only happens once, when many people may be visiting the page<\/li>\n<li>You may need to capture some form of output from the script, without showing it to all users<\/li>\n<li>You may have multiple team members working on the site, and not want to harm their workflow with your debugging output<\/li>\n<li>You may need to be able to have non-developers run the script periodically, for tasks like report generation<\/li>\n<\/ul>\n\n<p>There are too many other use cases to count. If you don't see a use case, you probably don't need this tool, and that's ok.<\/p><\/dd>\n<dt>Why not just write some custom PHP and tuck it in a subfolder?<\/dt>\n<dd><p>There are many caveats to taking this approach, but mostly it just leaves you writing a lot of (probably insecure) code.<\/p>\n\n<p>To build a custom script properly, you need to:<\/p>\n\n<ul>\n<li>Handle security on your own.<\/li>\n<li>Either duplicate or side-load any WordPress functions you need<\/li>\n<li>Build an interface and form handler<\/li>\n<li>Handle downloads<\/li>\n<li>Handle cron<\/li>\n<li>Get around PHP_MAX_EXECUTION_TIME<\/li>\n<\/ul>\n\n<p>That can be a massive amount of code, for a script that could be as simple as a single SQL query.<\/p><\/dd>\n<dt>Why not WP-CLI?<\/dt>\n<dd><p>We love WP-CLI, but sometimes the command line is just not the right tool for the job. Often you can't get WP-CLI on shared hosts, and users who may need to use the utilities may not be comfortable with the command line. But stay tuned, WP-CLI integration is on our roadmap.<\/p><\/dd>\n<dt>Why not (Insert Solution Here)?<\/dt>\n<dd><p>The most common answer is feature completion and ease of access. A utility script can contain as little as 17 lines of overhead, before you are free and clear to write whatever you need. We dare you to find a lighter-weight, more feature-complete option. We wrote WP Utility Script Runner because there wasn't one.<\/p><\/dd>\n<dt>Is it possible to get down to under 17 lines of boilerplate?<\/dt>\n<dd><p>Technically? Yes. But you'll be sacrificing a lot of features. You can write your utility in \"legacy mode\", where it can be written as simply as:<\/p>\n\n<blockquote>\n  <p>&lt;?php\n  \/\/ Utility Name: My Legacy Utility\n  \/\/ Description: An example of a legacy utility\n  echo \"Hello World\"; \/\/ your custom code goes here<\/p>\n<\/blockquote>\n\n<p>You will not get native handling for inputs, files, state, downloads, or error output, but it is pretty darn short.<\/p><\/dd>\n<dt>Why aren't there any useful utilities bundled in?<\/dt>\n<dd><p>Most of the time, we find that Utility Scripts are very custom to the specific site and hosting environment. We have plans to build a library of useful scripts, but for now, we just included a couple examples to help you get started writing your own.<\/p><\/dd>\n<dt>Your plugin is bad, and You should feel bad!<\/dt>\n<dd><p>While that's not exactly a question, we do take bug reports and reviews very seriously. In addition, you can always contact us directly with your thoughts, at support@burlingtonbytes.com.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>08\/29\/2018 - 1.1.0<\/h4>\n\n<ul>\n<li>Bugfix for form fields with hyphens in name improperly serializing<\/li>\n<\/ul>\n\n<h4>11\/16\/2017 - 1.0.1<\/h4>\n\n<ul>\n<li>Bugfix for sample Comment2Post utility<\/li>\n<\/ul>\n\n<h4>08\/19\/2017 - 1.0.0<\/h4>\n\n<ul>\n<li>Initial Release!<\/li>\n<\/ul>","raw_excerpt":"Create custom scripts and manage them directly from the WordPress Dashboard. Schedule scripts, handle user input, download reports, and more.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/73465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=73465"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/burlingtonbytes"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=73465"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=73465"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=73465"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=73465"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=73465"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=73465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}