Changeset 1079 in ExiteCMS


Ignore:
Timestamp:
11/06/07 22:44:18 (4 years ago)
Author:
hverton
Message:

Streamlined the maintenance mode. When an update is detected, the site switches automatically to maintenance mode. All users will be denied access, the webmaster will be redirected to the upgrade admin module to perform the upgrade.
This forces revision installations directly after an update has been installed. New code without the corresponding upgrade can cause the website to break.

Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core_functions.php

    r1069 r1079  
    180180    include PATH_ADMIN."upgrade.php"; 
    181181    //  If so, force a switch to maintenance mode 
    182 //  if (UPGRADES) $settings['maintenance'] = 2; 
    183 } 
    184  
    185 // check if we need to redirect to maintenance mode 
    186 if (!iADMIN && $settings['maintenance']) { 
    187     // only if not called from the maintenance mode module! (to prevent a loop, endless ;-) 
    188     if (!eregi("maintenance.php", $_SERVER['PHP_SELF'])) { 
     182    if (UPGRADES) $settings['maintenance'] = 2; 
     183} 
     184 
     185// if not called from the maintenance mode module! (to prevent a loop, endless ;-) 
     186// check if we need to redirect to maintenance mode (for users) or upgrade (for webmasters) 
     187if ($settings['maintenance'] && !eregi("maintenance.php", $_SERVER['PHP_SELF'])) { 
     188    if (!iSUPERADMIN) { 
    189189        redirect('maintenance.php?reason='.$settings['maintenance']); 
     190    } else { 
     191        redirect(ADMIN.'upgrade.php'.$aidlink); 
    190192    } 
    191193} 
  • trunk/includes/templates/main.maintenance.tpl

    r929 r1079  
    1515{*                                                                         *} 
    1616{***************************************************************************} 
    17 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> 
    18 <html> 
    19 <head> 
    20 <title>{$settings.sitename}</title> 
    21 <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'> 
    22 <meta http-equiv='refresh' content='60; url={$smarty.const.BASEDIR}'> 
    23 {include file='_stylesheets.tpl'} 
    24 </head> 
    25 <body class='tbl2'> 
     17<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     18<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    2619 
    27 <table width='100%' height='100%'> 
    28     <tr> 
    29         <td> 
    30             <table align='center' cellpadding='0' cellspacing='1' width='800' class='tbl-border'> 
    31                 <tr> 
    32                     <td class='tbl1' style='font-size:11px'> 
    33                         <center> 
    34                             <br /> 
    35                             <img src='{$smarty.const.THEME}images/{$settings.sitebanner}' alt='{$settings.sitename}'> 
    36                             <br /><br /> 
    37                             <b>{$message}</b> 
    38                             <br /><br /> 
    39                             <form name='loginform' method='post' action='{$smarty.const.BASEDIR}'> 
    40                                 <input type='submit' name='back' value='{$locale.151}' class='button' /> 
    41                             </form> 
    42                             <br /><br /> 
    43                         </center> 
    44                     </td> 
    45                 </tr> 
    46             {if !$smarty.const.iMEMBER} 
    47                 <tr> 
    48                     <td class='tbl1' style='font-size:11px'> 
    49                         <div style='text-align:center'> 
    50                             {$loginerror|default:""} 
    51                             <form name='loginform' method='post' action='{$smarty.const.FUSION_SELF}'> 
    52                                 {$locale.061}: <input type='text' name='user_name' class='textbox' style='width:100px' />&nbsp;&nbsp; 
    53                                 {$locale.062}: <input type='password' name='user_pass' class='textbox' style='width:100px' /> 
    54                                 <br /><br /> 
    55                                 <input type='submit' name='login' value='{$locale.064}' class='button' /><br /> 
    56                                 <input type='hidden' name='javascript_check' value='n' /> 
    57                             </form> 
    58                         </div> 
    59                     </td> 
    60                 </tr> 
    61             {/if} 
    62             </table> 
    63         </td> 
    64     </tr> 
    65 </table> 
     20    <head> 
     21        <title>{$settings.sitename}</title> 
     22        <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /> 
     23        <meta http-equiv='refresh' content='60; url={$smarty.const.BASEDIR}'> 
     24        {include file='_stylesheets.tpl'} 
     25    </head> 
    6626 
    67 </body> 
     27    <body class='body'> 
     28        <div class='splashscreen-h'> 
     29            <div class='splashscreen-v'> 
     30                <center> 
     31                <br /> 
     32                {if $settings.sitebanner|default:"" != ""} 
     33                    <img src='{$smarty.const.THEME}images/{$settings.sitebanner}' alt='{$settings.sitename}' width='400'/> 
     34                {else} 
     35                    <br /><br /> 
     36                {/if} 
     37                <br /><br /> 
     38                {$message} 
     39                <br /><br /> 
     40                {if !$smarty.const.iMEMBER} 
     41                    <div style='text-align:center'> 
     42                        {$loginerror|default:"<br />"} 
     43                        <form name='loginform' method='post' action='{$smarty.const.FUSION_SELF}'> 
     44                            {$locale.061}: <input type='text' name='user_name' class='textbox' style='width:100px' />&nbsp;&nbsp; 
     45                            {$locale.062}: <input type='password' name='user_pass' class='textbox' style='width:100px' />&nbsp;&nbsp; 
     46                            <input type='submit' name='login' value='{$locale.064}' class='button' /><br /> 
     47                            <input type='hidden' name='javascript_check' value='n' /> 
     48                        </form> 
     49                    </div> 
     50                {else} 
     51                    <div style='text-align:center'> 
     52                        <br /> 
     53                        <form name='loginform' method='post' action='{$smarty.const.BASEDIR}'> 
     54                            <input type='submit' name='back' value='{$locale.151}' class='button' /> 
     55                        </form> 
     56                    </div> 
     57                {/if} 
     58                </center> 
     59            </div> 
     60        </div> 
     61    </body> 
     62 
    6863</html> 
    6964{***************************************************************************} 
Note: See TracChangeset for help on using the changeset viewer.