Jump to content
Pete

Module: Maintenance Mode

Recommended Posts

@abmcr - great that you've fixed it up, but I think it would be helpful to submit a PR to @Pete so that everyone will get this new version.

Please note that this module doesn't currently send proper 503 maintenance mode headers which is why I always use the protected mode module for this. Perhaps you could take care of adding the 503 stuff to this module as well?

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

@abmcr - great that you've fixed it up, but I think it would be helpful to submit a PR to @Pete so that everyone will get this new version.

Yes: @Pete after you grab my github, i delete 🙂

For 503 i have no time now for implement 😞

Share this post


Link to post
Share on other sites

I installed this module in version 3.0.123 but i gives me a error:

Fatal Error: Uncaught Error: Access to undeclared static property: MaintenanceMode::$fM in /xxx/xxx/xxx/public_html/site/modules/MaintenanceMode/MaintenanceMode.module:94
Stack trace:

#0 [internal function]: MaintenanceMode::getModuleConfigInputfields(Array)
#1 /home/xxxxk/domains/xxxxx.nl/public_html/wire/core/Modules.php(3885): call_user_func(Array, Array)
#2 /home/xxxxk/domains/xxxxx.nl/public_html/wire/core/Wire.php(386): ProcessWire\Modules->___getModuleConfigInputfields('MaintenanceMode', Object(ProcessWire\InputfieldForm))
#3 /home/xxxxk/domains/xxxxx.nl/public_html/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___getModuleCon...', Array)
#4 /home/xxxxk/domains/xxxxx.nl/public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Modules), 'getModuleConfig...', Array)
#5 /home/xxxxk/domains/xxxxx.nl/public_html/wire/modules/Process/ProcessModule/ProcessModule.module(1255): ProcessWire\Wire->__call('getMo (line 94 of /home/devhk/domains/hk2.witxl.nl/public_html/site/modules/MaintenanceMode/MaintenanceMode.module)

What is wrong?

 

Share this post


Link to post
Share on other sites

@Pete, @Erik, seems to work with a tiny modification in the foreach loop (loading an intermediate variable with $fM['type']):

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

 

  • Like 2

Share this post


Link to post
Share on other sites

An editor wanted to be able to preview the 'alternative page' we use during maintenance, but whenever he would try to view it he would be redirected to the homepage. So to me it makes sense that anyone who is allowed to bypass the maintenance page during maintenance, should also be able to preview the alternative page. 

Luckily, this is just a tiny code adjustment. Replace line 133-136 with:

		// Else if we're not in maintenance mode and we're not an administrator (and our role isn't in the list of allowed roles to access the site in maintenance mode), make sure the maintenance page redirects to the homepage
		} elseif (!$this->inMaintenance && $this->showPage && ($page->id == $this->showPage) && !$user->isSuperuser() && !array_intersect(explode('|', $user->roles), $this->bypassRoles)) {
			$this->session->redirect($this->config->urls->root, false);
		}

 

Share this post


Link to post
Share on other sites

@Adrian, thanks for you suggestion. But I need the redirect option found on the maintenance mode module. In my understanding this is not an option that your module provides ? Am I rigth ? Thanks

Share this post


Link to post
Share on other sites
On 8/24/2019 at 2:47 PM, antpre said:

@Adrian, thanks for you suggestion. But I need the redirect option found on the maintenance mode module. In my understanding this is not an option that your module provides ? Am I rigth ? Thanks

Not currently, but it could be a simple addition.

  • Like 1

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