Klein database onderhoud
Geplaatst: 12 jun 2005, 19:16
Code: Selecteer alles
##############################################################
## MOD Title: Small db maintance
## MOD Author: Flance < mods@phpbb-3.com > (Jordi Betting) N/A
## MOD Description: This mod wil add a page in your admin, here you can optimize your db.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ~1 Minutes
## Files To Edit:
## admin/index.php
## templates/subSilver/admin/index_body.tpl
## language/lang_english/lang_admin.php
##
## Included Files:
## admin/admin_db_maintance.php
## templates/subSilver/admin/maintance.tpl
##############################################################
## Author Notes:
##
## For dutch or other translations, see phpbb-3.com forums
## Download link for files: www.phpbb-3.com/mods/small_db_maintance_mod.zip
##
##############################################################
## MOD History:
##
## 2005-06-13 - Version 1.0.0
## - First public release
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
##
#
#-----[ COPY ]------------------------------------------
#
copy admin_db_maintance.php to admin/admin_db_maintance.php
copy maintance.tpl to templates/subSilver/admin/maintance.tpl
#
#-----[ OPEN ]------------------------------------------
#
admin/index.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'VERSION_INFO' => $version_info,
'L_VERSION_INFORMATION' => $lang['Version_information'])
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$sql = "SHOW TABLE STATUS";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not check table status", "", __LINE__, __FILE__, $sql);
}
$iOverhead = 0;
while ($row = $db->sql_fetchrow($result))
{
$iOverhead += $row['Data_free'];
}
if ($iOverhead > 0)
{
$html = str_replace('%s',$iOverhead,$lang['dbman_idxexp']);
$html = str_replace('%1','<a href="'.append_sid('admin_db_maintance.'.$phpEx.'?mode=exec').'" target="main">',$html);
$html = str_replace('%2','</a>',$html);
$template->assign_block_vars('overhead',array('text'=>$html));
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/index_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<h1>{L_VERSION_INFORMATION}</h1>
{VERSION_INFO}
<br />
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<img src="templates/subSilver/images/some_new_image.gif" alt="{L_YOUR_VARIABLE}"/>
<br />
<!-- BEGIN overhead -->
<p style="color: red; font-weight:bold;font-family:verdana,tahoma,serif;">{overhead.text}</p>
<!-- END overhead -->
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Database maintance mod
//
$lang['DB Maintance'] = 'Database Maintance';
$lang['Check'] = 'Check DB';
$lang['Execute'] = 'Do Maintance';
$lang['dbman_title'] = 'Database Maintance';
$lang['dbman_expl'] = 'You can execute here the database maintance.';
$lang['dbman_sta1'] = 'Database maintance is ';
$lang['dbman_sta2'] = 'nessecary at the moment. The database has <i>';
$lang['dbman_sta3'] = 'bytes</i> overhead.';
$lang['dbman_yes'] = '';
$lang['dbman_no'] = 'not';
$lang['dbman_exec'] = 'Do the maintance';
$lang['dbman_idxexp'] = 'Database contains %s bytes overhead. Click %1here%2 to optimize the database.';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM