Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#97 2009-11-01 16:55:47

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: rvm_maintenance (v0.5)

@ruud,

could it be addressed from the core? For example, by setting the cookie to .domain.com (and so, make it valid/available for any subdomain).
Of course, I don’t know what I’m talking about.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#98 2009-11-04 20:59:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_maintenance (v0.5)

It’s not a fixable problem. You can’t serve a cookie for another domain.

Offline

#99 2009-11-04 22:12:24

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: rvm_maintenance (v0.5)

ruud wrote:

It’s not a fixable problem. You can’t serve a cookie for another domain.

For subdomains you can. Atleast by the specs. Some browser don’t follow it tho, but yeah.

For another domain you can’t. For example if you use domainb for backend and domaina for frontend, that ain’t going to work. Well, or it can if you and your browser allows 3rd party cookies, but that is just playing crazy.

Offline

#100 2009-11-04 22:18:43

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: rvm_maintenance (v0.5)

ruud wrote:

It’s not a fixable problem. You can’t serve a cookie for another domain.

So “tail matching” isn’t possible?

From PERSISTENT CLIENT STATE HTTP COOKIES:

domain=DOMAIN_NAME
When searching the cookie list for valid cookies, a comparison of the domain attributes of the cookie is made with the Internet domain name of the host from which the URL will be fetched. If there is a tail match, then the cookie will go through path matching to see if it should be sent. “Tail matching” means that domain attribute is matched against the tail of the fully qualified domain name of the host. A domain attribute of “acme.com” would match host names “anvil.acme.com” as well as “shipping.crate.acme.com”.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#101 2009-11-05 18:25:45

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_maintenance (v0.5)

Ask the core devs. It’s not something I would add.

Offline

#102 2011-09-28 13:17:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: rvm_maintenance (v0.5)

maniqui wrote:

BTW, a tip (maybe already posted): using rvm_privileged and rvm_maintenance, it could be helpful to create a message on top of the page that reads “Site is in maintenance mode. Remember to de-activate rvm_maintenance when task is over.”

Something like this may work:

<txp:if_status status="503">
    <txp:rvm_if_privileged>
    <p>Site is in maintenance mode. Remember to de-activate rvm_maintenance.</p>
    </txp:rvm_if_privileged>
</txp:if_status>

I couldn’t get this to work – presumably because the logged in user is presented with the page that does not have 503 status – but it got me thinking and in combination with an earlier tip by ruud the following does work:

<txp:php>global $variable; $variable['maintenance_mode'] = function_exists('rvm_maintenance') ? 'yes' : '';</txp:php>
<txp:if_variable name="maintenance_mode" value="yes">
  <div id="notice">Site is in maintenance mode. Remember to de-activate rvm_maintenance to make the site publicly viewable.</div>
</txp:if_variable>

and if you want some css with that:

#notice {
  display: block;
  width: 100%;
  z-index: 999;
  position: fixed;
  top: 0; left: 0;
  line-height: 2em;
  text-align: center;
  color: #c30;
  opacity: 0.85;
  background-color: #fee22d;
}

rvm_if_priviliged is only necessary if you only want to restrict this message to a particular user level. And if anyone has found a better way, please tell.

 

* * *

 

Likewise, I’d like to put a “maintenance mode” switch on the dashboard (rather than in the admin area which certain admin users can’t access). What would be the best way of doing this? Would it work at all for normal publishers?

The admin : plugins pane has a link with txp_token (how do I get this?) without which plugin activation/deactivation doesn’t work. ied_plugin_composer on the other hand doesn’t seem to need txp_token (unless its passed as a POST var).

Last edited by jakob (2011-09-28 13:28:32)


TXP Builders – finely-crafted code, design and txp

Offline

#103 2011-09-28 13:37:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: rvm_maintenance (v0.5)

jakob

Nice tip, thanks. The number of times I’ve finished a site and forgotten to switch the plugin off…

Likewise, I’d like to put a “maintenance mode” switch on the dashboard (rather than in the admin area which certain admin users can’t access). What would be the best way of doing this? Would it work at all for normal publishers?

Yep. Add an HTML form, get it to submit to the same page, do the usual step-detection dance and then do something similar to the switch_status() function in include/txp_plugin.php.

The admin : plugins pane has a link with txp_token (how do I get this?)

Two ways:

  1. add a call to tInput() inside your form
  2. build your form with Txp’s built-in form() function (see lib/txplib_forms.php) which’ll add the token automatically

ied_plugin_composer on the other hand doesn’t seem to need txp_token

It’s too old skool to have one. Needs caning for being naughty. And lines.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#104 2011-11-30 16:53:12

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: rvm_maintenance (v0.5)

I had another stab at providing a rvm_maintenance powered maintenance mode switch to less privileged users via a dashboard panel rather than giving them access to the plugins pane. I’m using smd_tabber and a tabber_dashboard page template and have something that’s working nicely, but as I circumvented the tokens, forms, events and steps so I would appreciate any pointers or warnings in case I’m opening up any vulnerabilities by doing it this way.

In my smd_tabber dashboard template I have the following right at the top:

<txp:php>
    global $variable;

    $maintenance_mode = gps('maintenance_mode');

    if ($maintenance_mode != '') {
        $change = ($maintenance_mode == 'on') ? 1 : 0;
        safe_update('txp_plugin', "status = $change", "name = 'rvm_maintenance'");
        $variable['maintenance_mode'] = ($change == 1) ? 'on' : 'off';
    } else {
        $variable['maintenance_mode'] = function_exists('rvm_maintenance') ? 'on' : 'off';
    }
</txp:php>

This basically activates maintenance mode when ?maintenance_mode=on is passed via the url on the dashboard (only). Any other value for maintenance_mode switches it off. Further down in my dashboard template where I want to have the maintenance mode switch I have the following:

<txp:if_variable name="maintenance_mode" value="on">
    <div id="notice">Site is in maintenance mode!</div>
    <a href="?maintenance_mode=off">De-activate maintenance mode</a>
<txp:else />
    <a href="?maintenance_mode=on">Activate maintenance mode</a>
</txp:if_variable>

You can also use <txp:if_variable name="maintenance_mode" value="off">...</txp:if_variable> if you want to test the off state separately from the on state.

Notes:

  • requires rvm_maintenance :-)
  • uses smd_tabber – your mileage may vary with other dashboard plugins
  • the urlvar switch is only available on the dashboard pane

TXP Builders – finely-crafted code, design and txp

Offline

#105 2016-09-05 21:28:30

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,072
Website Mastodon

Re: rvm_maintenance (v0.5)

Hi Ruud. I have installed and used for the first time. Works fine. Thanks for this very useful plugin!

( think that at some stage it should be part of core like it is on ExpressionEngine. But that is another issue)

More importantly. How can we trim the information displayed in Maintenance Mode?

i.e. to only show:

Site Name
Site Slogan
Site maintenance in progress. Please check back later.  

and nothing else?

That is eliminate all the links about textpattern etc that currently appears below the dotted line.


…. texted postive

Offline

#106 2016-09-05 21:59:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: rvm_maintenance (v0.5)

bici wrote #301079:

More importantly. How can we trim the information displayed in Maintenance Mode?

Hi bici, just create a new template page called error_503 and put as little or as much information in there as you need.


TXP Builders – finely-crafted code, design and txp

Offline

#107 2016-09-06 02:34:33

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,072
Website Mastodon

Re: rvm_maintenance (v0.5)

Thank- you sir! worked just fine


…. texted postive

Offline

#108 2017-03-26 18:33:38

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,072
Website Mastodon

Re: rvm_maintenance (v0.5)

colak wrote #162134:

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.

BUMP


…. texted postive

Offline

Board footer

Powered by FluxBB