Changeset 1153

Show
Ignore:
Timestamp:
05/15/08 15:02:44 (2 months ago)
Author:
zothos
Message:

fixed #1255

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r1152 r1153  
    11ispCP ω 1.0.0 Changelog 
    22~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     3 
     42008-05-15 Jochen Manz 
     5        - GUI: 
     6                * Fixed #1255: please commit these patches for an better useful/readable database update files 
    37 
    482008-05-15 Marc Pujol 
  • trunk/docs/README

    r897 r1153  
    5050 
    5151Unless otherwise stated all code is licensed under the MPL 1.1 and has a Copyright 
    52 2006-2007 by ispCP. 
     522006-2008 by ispCP. 
    5353 
    5454Please have a look at these Licenses if intrested. They are shipped with 
  • trunk/gui/admin/database_update.php

    r1016 r1153  
    3838$tpl -> define_dynamic('database_update_infos', 'page'); 
    3939 
    40 $tpl -> assign( 
    41                         array( 
    42                                 'TR_ADMIN_ISPCP_UPDATES_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'), 
    43                                 'THEME_COLOR_PATH' => "../themes/" . $cfg['USER_INITIAL_THEME'], 
    44                                 'THEME_CHARSET' => tr('encoding'), 
    45                                 'ISP_LOGO' => get_logo($_SESSION['user_id']) 
    46                         ) 
    47                 ); 
    48  
    49 // Combine the needed url this file 
    50 $url = "http://" . $cfg['BASE_SERVER_VHOST'] . "/admin/database_update.php"; 
     40$tpl -> assign(array( 
     41        'TR_ADMIN_ISPCP_UPDATES_PAGE_TITLE'     => tr('ispCP - Virtual Hosting Control System'), 
     42        'THEME_COLOR_PATH'                                      => "../themes/" . $cfg['USER_INITIAL_THEME'], 
     43        'THEME_CHARSET'                                         => tr('encoding'), 
     44        'ISP_LOGO'                                                      => get_logo($_SESSION['user_id']) 
     45)); 
    5146 
    5247// $execute is false per default 
     
    6358 
    6459$tpl->assign(array( 
    65         'TR_UPDATES_TITLE' => tr('Database updates'), 
    66         'TR_AVAILABLE_UPDATES' => tr('Available database updates'), 
    67         'TR_UPDATE' => tr('Update'), 
    68         'TR_INFOS' => tr('Update details') 
     60        'TR_UPDATES_TITLE'             => tr('Database updates'), 
     61        'TR_AVAILABLE_UPDATES' => tr('Available database updates'), 
     62        'TR_UPDATE'                            => tr('Update'), 
     63        'TR_INFOS'                             => tr('Update details') 
    6964)); 
    70  
    71  
    72 if(!checkDatabaseUpdateExists()) { 
    73         $tpl->assign('TR_UPDATE_MESSAGE', tr('No database updates available')); 
    74         $tpl->parse('DATABASE_UPDATE_MESSAGE', 'database_update_message'); 
    75 } else { 
    76         $tpl->assign('DATABASE_UPDATE_MESSAGE', ''); 
    77 } 
    78  
    7965 
    8066if(checkDatabaseUpdateExists()) { 
    8167        $tpl->assign(array( 
    82                 'UPDATE_MESSAGE' =>  '', 
    83                 'UPDATE' =>  tr('New Database update is now available'), 
    84                 'INFOS' => tr('Do you want to execute the Updates now?'), 
     68                'UPDATE_MESSAGE'                        => '', 
     69                'DATABASE_UPDATE_MESSAGE'       => '', 
     70                'UPDATE'                                        => tr('New Database update is now available'), 
     71                'INFOS'                                         => tr('Do you want to execute the Updates now?') 
    8572        )); 
    8673        $tpl->parse('DATABASE_UPDATE_INFOS', 'database_update_infos'); 
    87 } else { 
    88         $tpl->assign('DATABASE_UPDATE_INFOS', ''); 
     74} else {         
     75        $tpl->assign(array( 
     76                'TR_UPDATE_MESSAGE'             => tr('No database updates available'), 
     77                'DATABASE_UPDATE_INFOS'         => '' 
     78        )); 
     79         
     80        $tpl->parse('DATABASE_UPDATE_MESSAGE', 'database_update_message');       
    8981} 
    9082 
     
    9284if($execute) { 
    9385        executeDatabaseUpdates(); 
    94         header('Location:' . $url); 
     86        header('Location:' . $_SERVER['PHP_SELF']); 
    9587} 
    9688 
  • trunk/gui/include/database-update-functions.php

    r1136 r1153  
    8888                $functionName   = returnFunctionName($newRevision); 
    8989 
    90                 if(function_exists($functionName)) { 
    91                         $queryArray     = array(); 
    92                         $queryArray[]   = $functionName(); 
    93  
    94                         // Query to set the new Database Revision 
    95                         $queryArray[]   = "UPDATE `config` SET `value` = '$newRevision' WHERE `name` = 'DATABASE_REVISION'"; 
    96  
    97                         $sql->StartTrans(); 
    98  
    99                         foreach($queryArray as $query) { 
    100                                 $sql->Execute($query); 
    101                         } 
    102  
    103                         // Prompt a error when a update fails 
    104                         if ($sql->HasFailedTrans()) { 
    105                                 set_page_message(tr("Db update %s failed", $newRevision)); 
    106                         } 
    107  
    108                         $sql->CompleteTrans(); 
    109                         unset($queryArray); 
     90                $queryArray     = array(); 
     91                 
     92                // Pull the query from the update function 
     93                $queryArray[]   = $functionName(); 
     94 
     95                // Query to set the new Database Revision 
     96                $queryArray[]   = "UPDATE `config` SET `value` = '$newRevision' WHERE `name` = 'DATABASE_REVISION'"; 
     97 
     98                $sql->StartTrans(); 
     99 
     100                foreach($queryArray as $query) { 
     101                        $sql->Execute($query); 
    110102                } 
     103 
     104                // Prompt a error when a update fails 
     105                if ($sql->HasFailedTrans()) { 
     106                        set_page_message(tr("Db update %s failed", $newRevision)); 
     107                } 
     108 
     109                $sql->CompleteTrans(); 
     110                unset($queryArray);      
    111111        } 
    112112} 
     
    123123        $sqlUpd = array(); 
    124124 
    125         $sqlUpd[] = "INSERT INTO config (name, value) VALUES (DATABASE_REVISION , 1)"; 
     125        $sqlUpd[] = "INSERT INTO `config` (name, value) VALUES ('DATABASE_REVISION' , '1')"; 
    126126 
    127127        return $sqlUpd;