Page 1 of 1

Board disabled, maintenance mode

Posted: Sun Jan 07, 2018 5:51 pm
by Bryx
Hello,

I a problem with my extension phpBB 3.2.
I can't get a maintenance page

Example:
- If the forum is not in maintenance, it is forumatix_enable.html
- If the forum is in maintenance, it is forumatix_disable.html

What I want to do is that when I have no maintenance mode, the default page is displayed and when the Forum maintenance is active it displays the maintenance page of my extension.

Extension file :
bryx.zip
bryx_forumatix
(88.11 KiB) Downloaded 12 times
Thank you for support.
Bryx

Re: Board disabled, maintenance mode

Posted: Sun Jan 07, 2018 7:05 pm
by RMcGirr83
What is "maintenance"?

Re: Board disabled, maintenance mode

Posted: Sun Jan 07, 2018 7:11 pm
by Bryx
It is a French vocabulary, it is to say that the forum is unavailable.

Re: Board disabled, maintenance mode

Posted: Mon Jan 08, 2018 9:55 pm
by Bryx
A idea ?

Re: Board disabled, maintenance mode

Posted: Mon Jan 08, 2018 10:04 pm
by RMcGirr83
Maybe can be done within the core.page_header_after or possibly the core.user_setup event.

Re: Board disabled, maintenance mode

Posted: Tue Jan 09, 2018 6:53 pm
by Bryx
Thank you for informations and help.

I found this code

Code: Select all

// Is board disabled and user not an admin or moderator?
		if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
		{
			if ($this->data['is_bot'])
			{
				send_status_line(503, 'Service Unavailable');
			}

			$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
			trigger_error($message);
		}
How suited to my extension, in reality I'm not an expert in PHP just a small beginner who tries to learn.

Re: Board disabled, maintenance mode

Posted: Tue Jan 09, 2018 7:36 pm
by RMcGirr83
You fire it (trigger_error) within your code using the event.

Re: Board disabled, maintenance mode

Posted: Tue Jan 09, 2018 8:57 pm
by Bryx
Here is the code used to create the event

Code: Select all

	/**
	 * Mode board disabled
	 */
	public function add_page_header_disabled()
	{
		if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
		{
			$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
			trigger_error($message);
		}
	}
This seems to you correct, if so how to fit my custom template that found in the extension knowing that it does not help the head or the base foot of the forum.

Thank you for your time =)

Re: Board disabled, maintenance mode

Posted: Tue Jan 09, 2018 10:04 pm
by mrgoldy
It's really hard to understand what you want and to explain it to you without writing the entire extension for you.

You can't just 'write your own event'. You have to hook into one of the PHP Core Events and use that in your event/listener.php.
Here you can find all available phpBB Event locations.
I would suggest looking through the phpBB’s extension development tutorial and documentation.
And perhaps look at some already existing (and validated) extensions, such as: Hope this helps,