Changeset 5231

Show
Ignore:
Timestamp:
02/18/06 08:40:04 (2 years ago)
Author:
GamerZ
Message:

Improved On Checking Backup Status

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-dbmanager/trunk/dbmanager/database-backup.php

    r5192 r5231  
    6262$mysql_basedir = $wpdb->get_row("SHOW VARIABLES LIKE 'basedir'"); 
    6363$mysql_basedir = $mysql_basedir->Value; 
     64if($mysql_basedir == '/') { $mysql_basedir = '/usr/'; } 
     65$status_count = 0; 
     66$stats_function_disabled = 0; 
    6467?> 
    6568<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?> 
     
    6770<div class="wrap"> 
    6871      <h2>Checking Backup Status</h2> 
    69       <table width="100%" cellspacing="3" cellpadding="3" border="0"> 
    70             <tr style='background-color: #eee'> 
    71                   <th width="40%" valign="top" align="left" scope="row">Is Backup Folder Valid?</th> 
    72                   <td width="60%"> 
    73                         <?php 
    74                               if(is_dir($backup['path'])) { 
    75                                     echo '<font color="green">Yes</font>'; 
    76                               } else { 
    77                                     echo '<font color="red">No. Please create \'backup-db\' folder in \'wp-content\' folder and CHMOD it to \'777\' or change the location of the backup folder under DB Option.</font>'; 
    78                               } 
    79                         ?> 
    80                   </td> 
    81             </tr> 
    82             <tr style='background-color: none'> 
    83                   <th width="40%" valign="top" align="left" scope="row">Backup Folder Writable?</th> 
    84                   <td width="60%"> 
    85                         <?php 
    86                               if(is_writable($backup['path'])) { 
    87                                     echo '<font color="green">Yes</font>'; 
    88                               } else { 
    89                                     echo '<font color="red">No. Please CHMOD it to \'777\'.</font>'; 
    90                               } 
    91                         ?> 
    92                   </td> 
    93             </tr> 
    94             <tr style='background-color: #eee'> 
    95                   <th width="40%" valign="top" align="left" scope="row">Is mysqldump Path Valid?</th> 
    96                   <td width="60%"> 
    97                         <?php 
    98                               if(file_exists($mysql_basedir.'bin/'.$backup['mysqldumppath']) || file_exists($backup['mysqldumppath'])) { 
    99                                     echo '<font color="green">Yes</font>'; 
    100                               } else { 
    101                                     echo '<font color="red">No. Please check your mysqldump path under DB Option.</font>'; 
    102                               } 
    103                         ?> 
    104                         <br /> 
    105                         Ignore this if you are on a Linux Server, I am still trying to learn how to detect mysqldump on Linux Server 
    106                   </td> 
    107             </tr> 
    108             <tr style='background-color: none'> 
    109                   <th width="40%" valign="top" align="left" scope="row">Is mysql Path Valid?</th> 
    110                   <td width="60%"> 
    111                         <?php 
    112                               if(file_exists($mysql_basedir.'bin/'.$backup['mysqlpath']) || file_exists($backup['mysqlpath'])) { 
    113                                     echo '<font color="green">Yes</font>'; 
    114                               } else { 
    115                                     echo '<font color="red">No. Please check your mysql path under DB Option.</font>'; 
    116                               } 
    117                         ?> 
    118                         <br /> 
    119                         Ignore this if you are on a Linux Server, I am still trying to learn how to detect mysql on Linux Server 
    120                   </td> 
    121                   <tr style='background-color: #eee'> 
    122                   <th width="40%" valign="top" align="left" scope="row">Is passthru() Enabled?</th> 
    123                   <td width="60%"> 
    124                   </td> 
    125             </tr> 
    126             </tr> 
    127       </table> 
     72      <p> 
     73            Checking Backup Folder (<b><?php echo $backup['path']; ?></b>) ...<br /> 
     74            <?php 
     75                  if(is_dir($backup['path'])) { 
     76                        echo '<font color="green">Backup folder exists</font><br />'; 
     77                        $status_count++; 
     78                  } else { 
     79                        echo '<font color="red">Backup folder does NOT exist. Please create \'backup-db\' folder in \'wp-content\' folder and CHMOD it to \'777\' or change the location of the backup folder under DB Option.</font><br />'; 
     80                  } 
     81                  if(is_writable($backup['path'])) { 
     82                        echo '<font color="green">Backup folder is writable</font>'; 
     83                        $status_count++; 
     84                  } else { 
     85                        echo '<font color="red">Backup folder is NOT writable. Please CHMOD it to \'777\'.</font>'; 
     86                  } 
     87            ?> 
     88      </p> 
     89      <p>          
     90            <?php              
     91                  if(file_exists($mysql_basedir.'bin/'.$backup['mysqldumppath'])) { 
     92                        echo 'Checking MYSQL Dump Path (<b>'.$mysql_basedir.'bin/'.$backup['mysqldumppath'].'</b>) ...<br />'; 
     93                        echo '<font color="green">MYSQL dump path exists.</font>'; 
     94                        $status_count++; 
     95                  } else if(file_exists($backup['mysqldumppath'])) { 
     96                        echo 'Checking MYSQL Dump Path (<b>'.$backup['mysqldumppath'].'</b>) ...<br />'; 
     97                        echo '<font color="green">MYSQL dump path exists.</font>'; 
     98                        $status_count++; 
     99                  } else { 
     100                        echo 'Checking MYSQL Dump Path ...<br />'; 
     101                        echo '<font color="red">MYSQL dump path does NOT exist. Please check your mysqldump path under DB Options. If uncertain, contact your server administrator.</font>'; 
     102                  } 
     103            ?> 
     104      </p> 
     105      <p> 
     106            <?php 
     107                  if(file_exists($mysql_basedir.'bin/'.$backup['mysqlpath'])) { 
     108                        echo 'Checking MYSQL Path (<b>'.$mysql_basedir.'bin/'.$backup['mysqlpath'].'</b>) ...<br />'; 
     109                        echo '<font color="green">MYSQL path exists.</font>'; 
     110                        $status_count++; 
     111                  } else if(file_exists($backup['mysqlpath'])) { 
     112                        echo 'Checking MYSQL Path (<b>'.$backup['mysqlpath'].'</b>) ...<br />'; 
     113                        echo '<font color="green">MYSQL path exists.</font>'; 
     114                        $status_count++; 
     115                  } else { 
     116                        echo 'Checking MYSQL Path ...<br />'; 
     117                        echo '<font color="red">MYSQL path does NOT exist. Please check your mysql path under DB Options. If uncertain, contact your server administrator.</font>'; 
     118                  } 
     119            ?> 
     120      </p> 
     121      <p> 
     122            Checking PHP Functions (<b>passthru()</b>, <b>system()</b> and <b>exec()</b>) ...<br /> 
     123            <?php 
     124                  if(function_exists('passthru')) { 
     125                        echo '<font color="green">passthru() enabled.</font><br />'; 
     126                        $status_count++; 
     127                  } else { 
     128                        echo '<font color="red">passthru() disabled.</font><br />'; 
     129                        $stats_function_disabled++; 
     130                  } 
     131                  if(function_exists('system')) { 
     132                        echo '<font color="green">system() enabled.</font><br />'; 
     133                  } else { 
     134                        echo '<font color="red">system() disabled.</font><br />'; 
     135                        $stats_function_disabled++; 
     136                  } 
     137                  if(function_exists('exec')) { 
     138                        echo '<font color="green">exec() enabled.</font>'; 
     139                  } else { 
     140                        echo '<font color="red">exec() disabled.</font>'; 
     141                        $stats_function_disabled++; 
     142                  } 
     143            ?>     
     144      </p> 
     145      <p> 
     146            <?php 
     147                  if($status_count == 5) { 
     148                        echo '<b><font color="green">Excellent. You Are Good To Go.</font></b>'; 
     149                  } else if($stats_function_disabled == 3) { 
     150                        echo '<b><font color="red">I\'m sorry, your server administrator has disabled passthru(), system() and exec(), thus you cannot use this backup script. You may consider using the default WordPress database backup script instead.</font></b>'; 
     151                  } else { 
     152                        echo '<b><font color="red">Please Rectify The Error Highlighted In Red Before Proceeding On.</font></b>'; 
     153                  } 
     154            ?> 
     155      </p> 
     156      <p><i>Note: The checking of backup status is still undergoing testing, if you get a 'Good To Go' status but can't perform the backup or you get some errors but still can perform the backup, please drop me an <a href="mailto:gamerz84@hotmail.com?Subject=WP-DBManager: Checking Of Backup Status">email</a>.</i></p> 
    128157</div> 
    129158<!-- Backup Database --> 
  • wp-dbmanager/trunk/readme.txt

    r5192 r5231  
    2020- NEW: Merge Restore And Delete Backup Database 
    2121- NEW: Included .htaccess File To Protect Backup Folder 
     22- NEW: Checking Of Backup Status 
    2223- FIXED: Using Old Method To Add Submenu 
    2324- FIXED: PHP Short Tags