Jump to content
Pete

Module: Maintenance Mode

Recommended Posts

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

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

+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

@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

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

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

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 5

Share this post


Link to post
Share on other sites

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

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

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
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 2

Share this post


Link to post
Share on other sites

Php 7.2 : i have an error at line 96

Fatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94

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

I am the only? Thank you

Fatal Error: Uncaught ErrFatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94or: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94

Share this post


Link to post
Share on other sites
Just now, abmcr said:

Php 7.2 : i have an error at line 96

Fatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94

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

I am the only? Thank you

Fatal Error: Uncaught ErrFatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94or: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94

You can always use the maintenance options in the Protected Mode module.

Share this post


Link to post
Share on other sites

@abmcr - I have a little more time right now, so if you want to fix this module instead, take a look at these two commits to @Pete's Email to page module:

https://github.com/Notanotherdotcom/ProcessEmailToPage/commit/50acc8df55b69690c50c7aa31e439405e182d0ed

https://github.com/Notanotherdotcom/ProcessEmailToPage/commit/e149fb7abf49a6bb31a4c8885051323528f5e19d

He uses a similar syntax in that module to this one, so the required fixes will be the same.

 

Share this post


Link to post
Share on other sites

I have refactor a little for using in php 7.2

 

https://github.com/abmcr/MaintenanceMode

 

Thank you

Fatal Error: Uncaught ErrFatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94or: Access to undeclared static property: MaintenanceMode::$fM in /home/vl303ic7/envers.vda.it/site/modules/MaintenanceMode/MaintenanceMode.module:94

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...