[ALPHA] Custom "Database Down!" Message

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

[ALPHA] Custom "Database Down!" Message

Post by MartectX »

MOD Title: Custom "Database Down!" Message
MOD Description: Allows administrators to customize the "Database Down!" error page to suit their forum style.

Beware: Any time your style is changed you should update this custom message, too!
MOD Version: 0.0.9
MOD Download: none yet, install descriptions can be found in the next post

This mod has been inspired by Oops - Database Down.

I'm not yet sure how this can get ModX'ed because basically everything but one replace action is Do-It-Yourself. Just let me know if there's any need for this mod, otherwise I'll just abandon it again. At least it served me well.
Last edited by MartectX on Thu Oct 23, 2008 2:00 pm, edited 7 times in total.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

Log out of your forum.

Enter the following URL: viewforum.php?f=999999

Save the resulting error page to your hard drive as oops.html and open it in an editor.

Replace all instances of

Code: Select all

'
with

Code: Select all

\'
Replace

Code: Select all

<th>Information</th>
with

Code: Select all

<th>' . $msg_title . '</th>
Replace

Code: Select all

The forum you selected does not exist.
with

Code: Select all

' . $msg_text . '
Please be careful with dynamic content such as the current date; try to find a way of implementing it without database data - either hardcode it or replace it with a corresponding function. Examples:

1.If you are showing the current time somewhere on the page, make sure to replace the hardcoded time by

Code: Select all

' . date("d M Y, H:i") . '
(you may use your own custom date format here).

2.If you are showing custom greetings messages you should really choose one and hardcode that, for example

Code: Select all

Greetings, fellow user!
3.Seasonal stuff (like christmas trees in the banner) should go - it will seriously irritate users when your forum turns into a festively decorated "Database Down!" page in the midst of June!

Copy the whole resulting source code and paste it into
http://www.textfixer.com/tools/remove-line-breaks.php
and remove all line breaks and paragraphs.

Copy the resulting line.

OPEN

functions.php

FIND

Code: Select all

// Try to not call the adm page data...
REPLACE all following lines beginning with

Code: Select all

echo
with your one customized line!

Place before your line a

Code: Select all

echo '
and after it a

Code: Select all

';
Save the file, upload it. Change your database name / password / whatever in config.php to some garbage and test your new custom "Database Down!" error page!
Last edited by MartectX on Thu Oct 23, 2008 2:00 pm, edited 2 times in total.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

Let me just bump this once... :roll:
xxxgamer
Registered User
Posts: 574
Joined: Mon Jul 16, 2007 11:25 pm

Re: [ALPHA] Custom "Database Down!" Message

Post by xxxgamer »

cool will give this a try.
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

xxxgamer wrote:cool will give this a try.
Please report back if the instructions were clear and sufficient. :)
User avatar
c4gamerz
Registered User
Posts: 161
Joined: Thu Aug 30, 2007 5:08 pm
Contact:

Re: [ALPHA] Custom "Database Down!" Message

Post by c4gamerz »

this will also hide general error messages? like some database errors etc if not than you can add this feature in your mod and finally publish it in modx format :D
Web Designing | Script Integration | Logo Designing | Web Development | ExtensiveWeb.com
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

c4gamerz wrote:this will also hide general error messages? like some database errors etc if not than you can add this feature in your mod and finally publish it in modx format :D
This will not hide any error messages but will convert database errors into a more consistent format.

For other server errors like "404 - not found" I higly recommend this mod which I've been using like forever now: http://www.phpbb.com/community/viewtopi ... 9&t=712885
User avatar
c4gamerz
Registered User
Posts: 161
Joined: Thu Aug 30, 2007 5:08 pm
Contact:

Re: [ALPHA] Custom "Database Down!" Message

Post by c4gamerz »

Yes i already installed that mod :D but it doesnt hides database error messages so when i will use your mod it will show error in phpbb logs?
Web Designing | Script Integration | Logo Designing | Web Development | ExtensiveWeb.com
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

c4gamerz wrote:...it doesnt hides database error messages so when i will use your mod it will show error in phpbb logs?
1. I don't know why you would hide error messages - a blank page will be much worse for both your users and you
2. I don't know how phpBB should log database errors - files are never tampered with and the database, well, is not connectable!

So... what do you want to accomplish exactly?
User avatar
c4gamerz
Registered User
Posts: 161
Joined: Thu Aug 30, 2007 5:08 pm
Contact:

Re: [ALPHA] Custom "Database Down!" Message

Post by c4gamerz »

Actually i am using phpBB3 Error Logging Tool which logs all error including general database errors in log file

Description:
Logs phpBB Errors and Warnings in a Custom Error Log, so you can turn off the DEBUG/DEBUG EXTRA for your users and find all errors in the error log.
This makes continues debugging possible after you go live. It is also a great tool for MOD and Style Authors when developing and testing MODs for ease of debugging.
Includes the ability to log possible Template bugs.
The Error Log is created automatically inside the /store/ directory, and will be called php_error.log

so i just want to hide errors from other users and want to use a customized page just like Integrated error messages mod does ;) as i would still be able to see errors in log file but users cant :D just for security reasons you know ;)
Web Designing | Script Integration | Logo Designing | Web Development | ExtensiveWeb.com
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

Ah ok, so: If that mod logs database problems, my modifications won't change that behaviour!

That's what you wanted to know? :)
User avatar
c4gamerz
Registered User
Posts: 161
Joined: Thu Aug 30, 2007 5:08 pm
Contact:

Re: [ALPHA] Custom "Database Down!" Message

Post by c4gamerz »

lol yeah
Web Designing | Script Integration | Logo Designing | Web Development | ExtensiveWeb.com
trashbox
Registered User
Posts: 53
Joined: Wed Aug 22, 2007 9:25 pm

Re: [ALPHA] Custom "Database Down!" Message

Post by trashbox »

Hello! This mod looks great, I'm testing it on my local server.

But, when I type F5 on the new custom general error page it seems like losing the style.
If I click in the url and hit enter, it appears ok again.
Do you know how can I solve it?

It looks like some problem in the session id:

Code: Select all

<link href="./style.php?sid=022f966a9afe5d6aa9eb0ac2468013b2&id=1&lang=pt_br" rel="stylesheet" type="text/css" media="screen, projection" />
Because if I make a test removing, the page looks the same without style:

Code: Select all

<link href="./style.php?amp;id=1&lang=pt_br" rel="stylesheet" type="text/css" media="screen, projection" />
Thanks...
Equipe AjudaMatemática.com
Exercícios, plantão de dúvidas, desafios, problemas curiosos e repositório de materiais IME-USP do curso de licenciatura em Matemática!
Writing mathematical symbols with LaTeX and BBCode (just a bridge):
http://www.ajudamatematica.com/viewtopi ... p=177#p177
User avatar
MartectX
Registered User
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [ALPHA] Custom "Database Down!" Message

Post by MartectX »

Did you purge the cache?
trashbox
Registered User
Posts: 53
Joined: Wed Aug 22, 2007 9:25 pm

Re: [ALPHA] Custom "Database Down!" Message

Post by trashbox »

Hello MartectX.
I'm sorry about the delay. The topic reply notification seems not to be working here.
MartectX wrote:Did you purge the cache?
Yes, I did.

In my test, I'm changing the database hostname in the config.php in order to call the general error page.
I realised that as the board loses the database connection, the styles.php seems not be able to change the "{T_THEME_PATH}" in the files "colour.css" and "tweaks.css" imported by "stylesheet.css".

I'm saying that because I've figure out the problem by a wrong way, I know:
I've created a "stylesheet2.css" importing "colour2.css" and "tweaks2.css".
And, in this files I've changed the string "{T_THEME_PATH}" to the real path.
In the functions.php, in that "echo" of the general error page MOD, instead of calling:

Code: Select all

<link href="./style.php?sid=bf2a53ff19f86b89d0013dc7405ca315&id=1&lang=pt_br" rel="stylesheet" type="text/css" media="screen, projection" />
Now I call:

Code: Select all

<link href="./styles/prosilver/theme/stylesheet2.css" rel="stylesheet" type="text/css" media="screen, projection" />
With no database query.
And, now, after the F5 refresh, the general error page' style remains fine.

Any suggestion of how can I improve this solution?
And, did you try to reproduce this problem?

Thanks in advance!
Equipe AjudaMatemática.com
Exercícios, plantão de dúvidas, desafios, problemas curiosos e repositório de materiais IME-USP do curso de licenciatura em Matemática!
Writing mathematical symbols with LaTeX and BBCode (just a bridge):
http://www.ajudamatematica.com/viewtopi ... p=177#p177
Locked

Return to “[3.0.x] MODs in Development”