Textpattern Forum

You are not logged in. Register | Login | Help

#1 2007-11-14 18:59:15

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,480
Website

rvm_maintenance (v0.5)

This plugin, when activated, will show a maintenance page to all visitors who are not logged in on the admin side of Textpattern. Requires Textpattern 4.0.7 or higher.

Download

Features:

  • Very small, due to efficient reuse of TXP internal functions (less than 400 bytes of PHP code)
  • Detailed documentation in the plugin help.
  • Users logged in on the TXP admin side, can still view the website normally. After all, it’s harder to maintain a website if you can’t see what the result is on the front end.
  • Customizable ‘maintenance mode’ template.
  • Sends a “HTTP 503 Service Unavailable” response when in maintenance mode, telling Google spiders to come back later instead of indexing the maintenance page.
  • Minimal interface. Activating and deactivating the plugin is all you have to do to make it work.

Changelog:

  • version 0.1 (2007-11-12)
  • version 0.2 (2007-11-13)
    • use different name for session cookie to avoid name clashes.
    • fix potential, though hard to exploit security vulnerability in cookie hash.
  • version 0.3 (2007-11-13)
    • fix ‘double slash’ bug in cookie path.
  • version 0.4 (2008-03-03)
    • much smaller now (700 -> 250 bytes), but requires TXP 4.0.6 or higher.
    • fixed conflicts with clean url test (diagnostics) and the asy_dashboard plugin
  • version 0.5 (2009-01-05)
    • initialize pretext variables to avoid warnings when parsing error_ template
    • requires TXP 4.0.7 or higher (code size still small: 385 bytes)

Last edited by ruud (2009-01-05 21:15:28)

Offline

#2 2007-11-14 19:44:55

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,004
Website

Re: rvm_maintenance (v0.5)

Very interesting plugin, and very useful. Tkanks lot :)

Just one question : do you think it would be difficult to add a warning message within the back-end header in the purpose to inform the administrator that the website is in maintenance mode. The goal is to remember administrators that the website is unavailable and don’t forget to switch in active mode.

I’d traying to test you cookie and display this kind of message, but cause live mode is activate when your plugin is disable, the cookie still exist.

Best regards,

Last edited by Pat64 (2007-11-14 19:49:33)


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#3 2007-11-14 21:19:19

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,480
Website

Re: rvm_maintenance (v0.5)

It’s not difficult, but my aim is to keep it small and adding such code, which involves adding some javascript at the bottom of each page to rewrite the pagetop, would increase the code size considerably with little extra benefit. Also, adding a warning message somewhere at the top by using such a Javascript solution could easily conflict with another plugin trying to do the same thing. Although I can see why a warning on each admin page is useful, the benefits don’t outweigh the downsides, IMHO.

If you want to test if the plugin is active, just use function_exists('rvm_maintenance') in an if-construct.

Offline

#4 2007-11-15 07:24:26

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,004
Website

Re: rvm_maintenance (v0.5)

Ruud the Great said :

If you want to test if the plugin is active, just use function_exists(‘rvm_maintenance’) in an if-construct.

Fine. Thanks lot again.

Best regards,


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
@Devs : Can’t find the punched tape version of TXP and I need it!
Happy user of TXP 1.0RC1 on a Sinclair ZX spectrum server

Offline

#5 2007-11-15 07:26:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,822
Website

Re: rvm_maintenance (v0.5)

This was so much needed! Is there a possibility to absorb it in the default install for the next txp release? It could appear in the preferences with an on/off radio button next to it.


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#6 2007-11-15 07:33:06

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: rvm_maintenance (v0.5)

colak

I think that would be a good idea. It’s a pretty small plugin and would, IMO, make more sense to have it in the core than as an optional add-on.

ruud

Nice bit of code, thank you! I, for one, am learning from you :)


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#7 2007-11-20 00:08:58

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 685
Website

Re: rvm_maintenance (v0.5)

Strange error. I get twice this message:

Warning: unknown_tag: sitename in /web/htdocs/www.site.it/home/textpattern/publish.php on line 973

…in the error page with maintenance advice. Sitename actually isn’t displayed (!). Am I missing something?

Very useful plugin, anyway!

Z-

Offline

#8 2007-11-20 00:35:49

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: rvm_maintenance (v0.5)

Zanza wrote:

Strange error. I get twice this message:

Warning: unknown_tag: sitename in /web/htdocs/www.site.it/home/textpattern/publish.php on line 973

…in the error page with maintenance advice. Sitename actually isn’t displayed (!). Am I missing something?

Very useful plugin, anyway!

Z-

received the same error and decided to play around with what was going on.

for whatever reason, when the plugin is on, it doesn’t seem to recognize <txp:sitename /> but it will recognize <txp:site_name />
(devs: the default error page uses <txp:site_name /> while the regular default page uses <txp:sitename />. that should probably be corrected?)

zanza to answer your question, you can edit your error_default page (or custom page if you made one) and just replace all instances of <txp:sitename /> with <txp:site_name />

Last edited by iblastoff (2007-11-20 00:41:18)

Offline

#9 2007-11-20 11:19:25

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 685
Website

Re: rvm_maintenance (v0.5)

Iblastoff, you’re totally right. Thank you!

Maybe the default template should actually use site_name, I suppose.

Bye!

Z-

Offline

#10 2007-11-20 12:58:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,714
Website

Re: rvm_maintenance (v0.5)

ruud

Awesome, dude! Exactly what the doctor ordered.

+1 for this making it to the core if possible.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB