Complete Database Backup - 1.0.1

Eklentiler ile ilgili gelişmeler. Yeni modlar, güncellemeler.

Complete Database Backup - 1.0.1

İleti sabri ünal 10.08.2006, 13:28

MOD Adı: Complete Database Backup
MOD Yazar: ultima528 < ultima528@yahoo.com > (Allen S.) N/A
MOD Version: 1.0.1
MOD Açıklaması: Bu mod, veritabanı yedekleme aracınızı site prefix - yani ön eklerine sahip bütün tabloları yedekleyecek şekilde ayarlamaya yarar... Böylece modların oluşturduğu diğer phpBB_ - yani sizin site ön ekiniz - uzantılı tablolar da yedeklenir.

Kod: Tümünü seç
##############################################################
## MOD Title: Complete Database Backup
## MOD Author: ultima528 < ultima528@yahoo.com > (Allen S.) N/A
## MOD Description: This MOD makes it so that the "Backup Database" module in the ACP
##                  will backup all the forum-related database tables (including non-default
##                  tables, such as tables added by other MODs), and optionally, the entire
##                  database (including non-forum-related tables).
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: ~3 Minutes
## Files To Edit: (3) admin/admin_db_utilities.php
##                    languages/lang_english/lang_admin.php
##                    templates/subSilver/admin/db_utils_backup_body.tpl
## Included Files: N/A
##############################################################
## 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/
##############################################################
## Author Notes:
## - The idea for this MOD was based on the original MOD, `db_utils`, by Garold W. Robinson
## - The switch only checks for mysql, mysql4, and postgresql because database backup only works
##   with those database types listed
##############################################################
## MOD History:
##
##   2004-09-25 - Version 1.0.1
##      - Corrected typo ('postgres' is now 'postgresql'). If you do not use that database type,
##        then you do not have to install this version. [Thanks sph (Stephan)]
##
##   2004-07-09 - Version 1.0.0
##      - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_db_utilities.php
#
#-----[ FIND ]------------------------------------------
#
         $tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words');
#
#-----[ REPLACE WITH ]----------------------------------
#
         $phpbb_only = (!empty($HTTP_POST_VARS['phpbb_only'])) ? $HTTP_POST_VARS['phpbb_only'] : ( (!empty($HTTP_GET_VARS['phpbb_only'])) ? $HTTP_GET_VARS['phpbb_only'] : 0 );
         switch ( SQL_LAYER )
         {
            case 'mysql':
            case 'mysql4':
               $sql = 'SHOW TABLES';
               $field = "Tables_in_{$dbname}";
               break;
            case 'postgresql':
               $sql = "SELECT relname
                  FROM pg_class
                  WHERE relkind = 'r'
                  AND relname NOT LIKE 'pg\_%'";
               $field = "relname";
               break;
         }
         $result = $db->sql_query($sql);
         while ($row = $db->sql_fetchrow($result))
         {
            $current_table = $row[$field];
            $current_prefix = substr($current_table, 0, strlen($table_prefix));
            if ($phpbb_only && $current_prefix != $table_prefix)
            {
               continue;
            }
            else
            {
               $tables[] = $current_table;
            }
         }
#
#-----[ FIND ]------------------------------------------
#
               "L_BACKUP_OPTIONS" => $lang['Backup_options'],
#
#-----[ AFTER, ADD ]------------------------------------
#
               "L_PHPBB_ONLY" => $lang['phpBB_only'],
#
#-----[ FIND ]------------------------------------------
#
               "META" => '<meta http-equiv="refresh" content="2;url=' . append_sid("admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&amp;backupstart=1&gzipcompress=$gzipcompress&startdownload=1") . '">',
#
#-----[ IN-LINE FIND ]----------------------------------
#
backupstart=1
#
#-----[ IN-LINE AFTER, ADD ]----------------------------
#
&phpbb_only=$phpbb_only
#
#-----[ FIND ]------------------------------------------
#
            if($backup_type != 'data')
            {
               echo "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n";
               echo $table_def_function($table_prefix . $table_name, "\n") . "\n";
            }

            if($backup_type != 'structure')
            {
               $table_content_function($table_prefix . $table_name, "output_table_content");
            }
#
#-----[ REPLACE WITH ]----------------------------------
#
            if($backup_type != 'data')
            {
               echo "#\n# TABLE: " . $table_name . "\n#\n";
               echo $table_def_function($table_name, "\n") . "\n";
            }

            if($backup_type != 'structure')
            {
               $table_content_function($table_name, "output_table_content");
            }
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Additional_tables'] = 'Additional tables';
#
#-----[ AFTER, ADD ]------------------------------------
#
$lang['phpBB_only'] = 'Only phpBB-related tables';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/db_utils_backup_body.tpl
#
#-----[ FIND ]------------------------------------------
#
   <tr>
      <td class="row1">{L_ADDITIONAL_TABLES}</td>
      <td class="row1"><input class="post" type="text" name="additional_tables" /></td>
   </tr>
#
#-----[ REPLACE WITH ]----------------------------------
#
   <tr>
      <td class="row1">{L_PHPBB_ONLY}</td>
      <td class="row1">{L_NO} <input type="radio" name="phpbb_only" value="0" />  &nbsp;{L_YES} <input type="radio" name="phpbb_only" value="1" checked /></td>
   </tr>
   <tr>
      <td class="row2">{L_ADDITIONAL_TABLES}</td>
      <td class="row2"><input class="post" type="text" name="additional_tables" /></td>
   </tr>
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM



fazla kafa karıştırmaması için şöyle de yapabilirsiniz...

Kod: Tümünü seç
#
#-----[ FIND ]------------------------------------------
#
   <tr>
      <td class="row1">{L_ADDITIONAL_TABLES}</td>
      <td class="row1"><input class="post" type="text" name="additional_tables" /></td>
   </tr>
#
#-----[ REPLACE WITH ]----------------------------------
#

   <input type="radio" name="phpbb_only" value="1"/>

#
#-----[ EOM ]----------------------------------
#
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul

Cvp: Complete Database Backup - 1.0.1

İleti sabri ünal 04.01.2007, 08:59

bence ilk mod çok zorlaştırmış işi, aşağıda daha basiti ve test ettiğime göre çalışanı var... ekleyin bunu kullanın... ötekini kurmamıştırsınız inşallah, çünkü ben bir müddet sonra hata aldığım için (sunucum bir fonksiyonu desteklemediği için) modu kaldırmıştım...

Kod: Tümünü seç
##############################################################
## MOD Title: Backup All Tables
## MOD Author: DaveMiller < phpbb_mods@melgir.net > (David E. Miller) http://www.melgir.net/
## MOD Description: Backup all tables in database named with $table_prefix
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 1 Minute
## Files To Edit: admin/admin_db_utilities.php
## Included Files: N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: This MOD is intended to include all tables which start
## with $table_prefix in the backup download. This is for any instances of
## phpBB2 which have added extra tables and want them included without needing
## to hardcode the table names in the code.
## It has only been tested against versions of MySQL.
##
##############################################################
## MOD History:
##
##   2005-10-30 - Version 1.0.0
##      - created as MOD
##   2005-11-09 - Version 1.0.1
##      - revised for submission
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_db_utilities.php

#
#-----[ FIND ]------------------------------------------
#
         $tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm');
#
#-----[ AFTER, ADD ]------------------------------------------
#
         $sql = "SHOW TABLES LIKE '{$table_prefix}%'";
         $result = $db->sql_query($sql);
         if ( !$result )
         {
            message_die(GENERAL_ERROR, "Error listing table names", "", __LINE__, __FILE__, $sql);
         }
         else
         {
            $tables = array();
            $prefix_length = strlen($table_prefix);
            while ( ($row=$db->sql_fetchrow($result)) )
            {
               // Not all sql engines return key named '0'
               $keys = array_keys($row);
               $key0 = is_array($keys) ? $keys[0] : 0;
               $tbl = $row[$key0];
               if ( strlen($tbl) > $prefix_length )
               {   
                  $tables[] = substr($tbl,$prefix_length);
               }
            }
         }
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul


Duyurular & Güncellemeler



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron