Mark on WordPress

WordPress puts food on my table.

Plugin Sandboxing

with 35 comments

I just finished a feature for WordPress 2.2 that I’m pretty excited about. Not that it’s anything sexy or groundbreaking. It’s just one of those “it just works” features that sits in the background minding its own business and doesn’t reveal itself until you really need it.

Here is the first scenario:

You find (or write) a great new plugin and upload it to your /plugins/ directory. You activate it and — oh no. PHP Fatal Error. Someone missed a curly brace somewhere. No problem, you think, that’s what the back button is for. But guess what, the plugin is active, even on the Plugin management screen. Now your entire blog is down as well as the WordPress administration interface. At this point, your only recourse is to FTP in, find the plugin, and delete or rename it.

While that scenario is aggravating enough, it’s nothing compared to the second scenario:

You’re on the road, checking your mail at a computer that’s not your usual computer. You notice an e-mail from someone saying that one of the plugins on your site is misbehaving. You navigate to the Plugin Editing screen in WordPress and quickly correct the problem. Hurray for in-WP plugin editing! But when you click the save button, you get a fatal error. You must have forgotten a semicolon somewhere. And suddenly you realize that you don’t know your FTP password, so the only method you have of editing your plugin is now blocked. And you won’t have access to your main computer for 3 days, during which time your blog will be broken.

If you’ve ever experienced one of the above, you know how annoying it is. So the feature I’ve put into WordPress 2.2 is what I call plugin sandboxing. Before a plugin is activated or a plugin is edited, it is tested in a temporary fashion (that is, without being permanently activated). If it passes the test, it is activated for real. If it doesn’t pass the test (it’s throwing a fatal error that would normally take down your WordPress install), it is deactivated, and you get a nice error message telling you what went wrong. If the fatal error was caused because you edited an active plugin, the “Update File” button changes to “Update File and Attempt to Reactivate,” so that once you correct your typo, the plugin will go back to being activated, without requiring you to go back and manually activate it.

If you never activate a flawed plugin or never make a typo when editing your plugins, you’ll never know this functionality is there. But some day you just might slip up, and now WordPress will cover for you.

Written by Mark Jaquith

February 14, 2007 at 2:44 am

Posted in 2.2, plugins, wordpress

35 Responses to 'Plugin Sandboxing'

Subscribe to comments with RSS or TrackBack to 'Plugin Sandboxing'.

Great functionality, good work Mark!

Lee Kelleher

14 Feb 07 at 5:19 am

Fantastic functionality addition Mark. This may just be a life saver!

But, can it be extended to more than plugins? Maybe themes as well?

Ajay

14 Feb 07 at 7:35 am

Ajay,
Fatal errors in themes don’t prevent you from editing them, so this isn’t really needed.

Mark Jaquith

14 Feb 07 at 7:39 am

I’m excited about this new functionality! I’ve done your first scenario more than I care to admit, and while a sandbox is no replacement for actually thinking things through, it’s going to help me a ton.

Sarah Lewis

14 Feb 07 at 10:57 am

That sounds awesome…it’s almost like your teasing us though because it is a feature many of us would like to have now. ;)

Ryan Wagner

14 Feb 07 at 11:30 am

Sounds like an excellent feature! At the moment I tend to use a “sandbox” installation of WP on a sub-domain to test things out before I install them but this should make things even easier.
Looking forward to seeing what else you guys can come up with.

StevieB

14 Feb 07 at 12:39 pm

[...] at “Mark On WordPress” there is news of an excellent added feature, a plug-in “sandbox” facility: So the feature I’ve put into WordPress 2.2 is what I [...]

nice work

mozey

14 Feb 07 at 3:15 pm

Nice, I was hoping this would come about sooner than later… :D

Will

15 Feb 07 at 5:34 am

[...] ik nog altijd aan het thrillseeken ben met versie 2.07 van WordPress, lees ik op de weblog van Mark Jaquith over aardige functionaliteit die in versie 2.2 zal worden ingebouwd. Het betreft een zogenaamde [...]

[...] instalaron un nuevo plugin. Pues bien, parece que a partir de la versión 2.2 el CMS tendrá una nueva característica (Plugin Sandboxing) a través de la cual nos advertirá antes de la activación, de que el plugin [...]

Nice.. But i dont know where the link to download it..

Tguh

16 Feb 07 at 9:35 pm

[...] Plugin sandboxing will not allow plugins to activate if they break your wordpress blog or cause fatal PHP errors. “Before a plugin is activated or a plugin is edited, it is tested in a temporary fashion (that is, without being permanently activated). If it passes the test, it is activated for real. If it doesn’t pass the test (it’s throwing a fatal error that would normally take down your WordPress install), it is deactivated, and you get a nice error message telling you what went wrong. If the fatal error was caused because you edited an active plugin, the “Update File†button changes to “Update File and Attempt to Reactivate,†so that once you correct your typo, the plugin will go back to being activated, without requiring you to go back and manually activate it.†[...]

Mark.. where the link?

Tguh

17 Feb 07 at 6:42 pm

Tguh: WordPress 2.2 isn’t available yet. You’ll have to wait a little while until it is.

Bon

18 Feb 07 at 6:22 pm

[...] Mark Jaquith has noted a cool new feature for WordPress 2.2 that some plugin and theme creators are going to love. So the feature I’ve put into WordPress 2.2 is what I call plugin sandboxing. Before a plugin is activated or a plugin is edited, it is tested in a temporary fashion (that is, without being permanently activated). If it passes the test, it is activated for real. If it doesn’t pass the test (it’s throwing a fatal error that would normally take down your WordPress install), it is deactivated, and you get a nice error message telling you what went wrong. If the fatal error was caused because you edited an active plugin, the “Update File†button changes to “Update File and Attempt to Reactivate,†so that once you correct your typo, the plugin will go back to being activated, without requiring you to go back and manually activate it. [...]

[...] nada que se liberara mañana mismo). Uno de los anuncios más recientes lo realizaba ayer mismo Mark Jaquith, comentando la implementación de una función denominada ‘sandboxing‘, que se [...]

[...] Mark zu einer der neuesten upcoming Features für die 2.2er Version: So the feature I’ve put into WordPress 2.2 is what I call plugin sandboxing. Before a plugin is activated or a plugin is edited, it is tested in a temporary fashion (that is, without being permanently activated). If it passes the test, it is activated for real. If it doesn’t pass the test (it’s throwing a fatal error that would normally take down your WordPress install), it is deactivated, and you get a nice error message telling you what went wrong. If the fatal error was caused because you edited an active plugin, the “Update File†button changes to “Update File and Attempt to Reactivate,†so that once you correct your typo, the plugin will go back to being activated, without requiring you to go back and manually activate it. [...]

[...] One feature I’ve just read about has been written by that nice Mark Jaquith. He calls it Plugin Sandboxing - the idea is that when you activate a new plugin, or edit an existing one, it is first activated [...]

[...] Plugin Sandboxing to Test Drive Plugins [...]

[...] Plugin Sandboxing to Test Drive Plugins [...]

[...] caught my eye is Plugin Sandboxing. On more than one occasion I’ve killed my site because a plugin I’ve installed has [...]

[...] Plugin Sandboxing para poder realizar pruebas de módulos/plugins. [...]

[...] Plugin Sandboxing. Τι κάνει αυτό; Με λίγα λόγια κατά την ενεÏγοποίηση ενός plugin γίνεται έλεγχος αν το plugin μποÏεί να Ï„Ïέξει χωÏίς να δημιουÏγήσει Ï€Ïοβλήματα (fatal errors κτλ). Αν όχι, τότε γίνεται αυτόματα de-activate μέχÏι να διοÏθωθεί — μία καλή λÏση για όσους συνηθίζουν να Ï„ÏοποποιοÏν τα plugins μέσα από τον plugin editor του WordPress. [...]

great idea!

jez

19 Apr 07 at 8:12 am

[...] implementato phpmailer, formati multipli per feed dei commenti, dall’implementazione del plugin sandboxing, che ci dovrebbe salvare il blog dai plugin mal programmati, tema classico e di default [...]

Now this should be fantastic! It saves us all the trouble of using FTP just to fix a broken plugin.

Btw, why don’t we offer a direct upload for plugins from the wp-admin itself?

markku

20 Apr 07 at 1:32 am

[...] Plugin Sandboxing untuk uji coba plugins sebelum benar² di install di WordPress [...]

Awesome functionality addition Mark!!!

Thanks so much ;-)

gidibao

25 Apr 07 at 7:09 pm

[...] Plugin Sandboxing to Test Drive Plugins [...]

Hi Mark,

Can you please help me to disable this Plugin Sandboxing feature in 2.2?

See here; http://wordpress.org/support/topic/118418

Thanks,
Halil

hgurol

20 May 07 at 4:55 am

Halil,

In WordPress 2.3, it will show the error message to the user (but still refuse to activate the plugin). I think this is the best of both worlds, because you know why the plugin failed, but it doesn’t take your site down.

Mark Jaquith

26 Jun 07 at 1:03 am

Yeah, but it doesn’t tell you what the fatal error is. This makes it rather hard for ordinary users to report problems.

Michael Hampton

6 Dec 07 at 6:43 pm

Just to clarify what Mark said. In WP 2.3, it WILL show the fatal error message BUT ONLY IF you have PHP display_errors turned on. I guess it’s obvious, but I chased my tail for a while before I finally got it to work.

Shack Dougall

18 Feb 08 at 3:50 pm

This version it was really excited. WordPress is the best!

Gry Logiczne

21 Sep 08 at 11:02 am

Leave a Reply


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser