Pete

Module: Maintenance Mode

Recommended Posts

MuchDev    159

Totally loving that this module exists, I am about to push a ton of new data to a site that I am live developing and I really dont want it to get picked up by any nosey search engines. I have to say though the first thing I did to make it usable was delete the line of code that said "This site is in maintenance mode" as it was sitting right over the top of my navigation. I would say if you are going to have fixed positioning I personally would like it at the bottom, or even the ability to change the code via a field. Maybe even a custom code box or something along those lines. All in all though this module is a life saver and thank you for releasing it :) 

  • Like 1

Share this post


Link to post
Share on other sites
eyesee    3

I just extended the functionality of this great module. I had the need to still allow some pages to be accessible in active maintenance mode.

I submitted a pull request in github for this module and hope it gets accepted (just learning module programming)...

  • Like 1

Share this post


Link to post
Share on other sites
Robin S    2,487

+1 for a class/ID on the "maintenance mode" badge so it's position and appearance can be overridden.

Would be cool if there were controls to set the text of the badge and the native PW message.

Also, site editors who are not given permission to view the site in maintenance mode are put into an infinite redirect loop if they attempt to log in.

Share this post


Link to post
Share on other sites
netcarver    1,877

@Pete, seeing some problems when visiting this module's settings page under PHP7. I had to tweak the code a little to get it working again.

Here's what I did...

// Now use $data and $fieldsModel loop to create all checkboxes
foreach ($fieldsModel as $f=>$fM){                                                                                                                                     
    $creator = $fM['type'];                                                                                                                                            
    $fields->add(                                                                                                                                                      
        self::$creator($f, $fM['label'], $data[$f], $fM['desc'])                                                                                                       
    );                                                                                                                                                                 
}                       
  • Like 1

Share this post


Link to post
Share on other sites
Pete    3,387

And 3.x in fact - I've got it running on an installation there with no issues (auto-compiling for namespaces nicely).

  • Like 2

Share this post


Link to post
Share on other sites
Robin S    2,487

When used with PHP7 I get this fatal error:

Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/mysite/web/test/site/modules/MaintenanceMode/MaintenanceMode.module:94 

Is there an easy fix for this?

Share this post


Link to post
Share on other sites
adrian    7,648

When used with PHP7 I get this fatal error:

Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/mysite/web/test/site/modules/MaintenanceMode/MaintenanceMode.module:94 

Is there an easy fix for this?

Just add:

protected static $fM;

at line #19

You'll also need to change line 94 from:

self::$fM['type']($f, $fM['label'], $data[$f], $fM['desc'])

to:

self::{$fM['type']}($f, $fM['label'], $data[$f], $fM['desc'])
  • Like 3

Share this post


Link to post
Share on other sites
Robin S    2,487

Thank you, adrian. That fixes it. Just adding the curly braces around $fM['type'] was enough to avoid the error message.

Before I read your reply I was doing

$function = $fM['type'];
$fields->add(
    self::$function($f, $fM['label'], $data[$f], $fM['desc'])
);

which also worked.

  • Like 2

Share this post


Link to post
Share on other sites
Christophe    233

Hello Pete,

I hope you are doing well!

Does this module have the ability to put a website in "maintenance mode" for an undetermined time without affecting SEO?
With a 503 status code and perhaps in combination with a particular HTTP header (Retry-After), etc.

Thank you in advance!

Share this post


Link to post
Share on other sites
Ben C    1

EDIT: @adrian SOLVED MY PROBLEM

 

I'm having an issue.                                                                                            My processwire login.

I click configure and this happens (at the url http://freezermoosh.co.uk/opensesame/module/edit?name=MaintenanceMode)

Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /var/sites/f/freezermoosh.co.uk/public_html/site/modules/Notanotherdotcom-Maintenance-Mode-a42854b/MaintenanceMode.module:94
Stack trace:
#0 [internal function]: MaintenanceMode::getModuleConfigInputfields(Array)
#1 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Modules.php(3509): call_user_func(Array, Array)
#2 [internal function]: ProcessWire\Modules->___getModuleConfigInputfields('MaintenanceMode')
#3 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Wire.php(348): call_user_func_array(Array, Array)
#4 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___getModuleCon...', Array)
#5 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Wire.php(373): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Modules), 'getModuleConfig...', Array)
#6 /var/sites/f/freezermoosh.co.uk/public_html/wire/modules/Process/ProcessModule/ProcessModule.mo (line 94 of /var/sites/f/freezermoosh.co.uk/public_html/site/modules/Notanotherdotcom-Maintenance-Mode-a42854b/MaintenanceMode.module) 

This error message was shown because: you are logged in as a Superuser. Error has been logged.

 

Edited by Ben C
  • Like 1

Share this post


Link to post
Share on other sites
On 2016-10-26 at 1:38 PM, Ben C said:

EDIT: @adrian SOLVED MY PROBLEM

 

I'm having an issue.                                                                                            My processwire login.

I click configure and this happens (at the url http://freezermoosh.co.uk/opensesame/module/edit?name=MaintenanceMode)

Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /var/sites/f/freezermoosh.co.uk/public_html/site/modules/Notanotherdotcom-Maintenance-Mode-a42854b/MaintenanceMode.module:94
Stack trace:
#0 [internal function]: MaintenanceMode::getModuleConfigInputfields(Array)
#1 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Modules.php(3509): call_user_func(Array, Array)
#2 [internal function]: ProcessWire\Modules->___getModuleConfigInputfields('MaintenanceMode')
#3 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Wire.php(348): call_user_func_array(Array, Array)
#4 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/WireHooks.php(548): ProcessWire\Wire->_callMethod('___getModuleCon...', Array)
#5 /var/sites/f/freezermoosh.co.uk/public_html/wire/core/Wire.php(373): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Modules), 'getModuleConfig...', Array)
#6 /var/sites/f/freezermoosh.co.uk/public_html/wire/modules/Process/ProcessModule/ProcessModule.mo (line 94 of /var/sites/f/freezermoosh.co.uk/public_html/site/modules/Notanotherdotcom-Maintenance-Mode-a42854b/MaintenanceMode.module) 

This error message was shown because: you are logged in as a Superuser. Error has been logged.

 

I had the same issue, how did you fix it?

 

EDIT: Nevermind, found it. Cheers.

Share this post


Link to post
Share on other sites
Robin S    2,487
10 hours ago, CaelanStewart said:

I had the same issue, how did you fix it?

 

EDIT: Nevermind, found it. Cheers.

It helps the community if people share the solutions to their problems :)

Could you please post back with what you found? Thanks.

  • Like 2

Share this post


Link to post
Share on other sites

 

On 2017-5-19 at 0:12 AM, Robin S said:

It helps the community if people share the solutions to their problems :)

Could you please post back with what you found? Thanks.

Yeah, Ben C was referring to a post about four or five about his. This one to be precise:

On 2016-5-19 at 3:32 AM, adrian said:

Just add:


protected static $fM;

at line #19

You'll also need to change line 94 from:


self::$fM['type']($f, $fM['label'], $data[$f], $fM['desc'])

to:


self::{$fM['type']}($f, $fM['label'], $data[$f], $fM['desc'])

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.