'.__('Optimization').''); if ($blog->optimize() !== false) { buffer::str( '

ok '. __('Optimize tables').'

' ); } else { buffer::str( '

ok '. __('Error during tables optimization').'

' ); } $blog->countAll(); buffer::str( '

ok '. __('Count comments').'

' ); buffer::str( '

'.__('Optimization done').'

'. '

'.__('Back to tools').'

' ); } // Sauvegarde des tables elseif ($backup == 1) { include_once(dirname(__FILE__).'/lib.mysqldump.php'); $send_it = isset($_POST['sendit'])?true:false; $res = dbdump::saveDump($send_it); buffer::str('

'.__('Backup').'

'); if ($res !== false) { buffer::str( '

ok '. __('Your tables have been saved').'

'. '

'. __('You can now download a gzipped version of the corresponding SQL file from this location') . ' : '.$res.'

'. '

'.__('Backup done').'

' ); } else { buffer::str( '

ok '. __('Error during tables backup').'

'. '

'.__('Backup done').'

' ); } buffer::str( '

'.__('Back to tools').'

' ); } // Restauration des tables elseif ($restore == 1) { include_once(dirname(__FILE__).'/lib.mysqldump.php'); buffer::str('

'.__('Restore').'

'); if (isset($_FILES['dumpfile']) && $_FILES['dumpfile']['error'] == 0) { if (is_uploaded_file($_FILES['dumpfile']['tmp_name'])) { $tmp_file = DC_SHARE_DIR.'/mysql/dump.tmp'; if (!move_uploaded_file($_FILES['dumpfile']['tmp_name'],$tmp_file)) { return(false); } $src_file = $tmp_file; } switch($_FILES['dumpfile']['type']) { case '' : case 'application/octet-stream' : if ($fh = fopen($src_file, "rb")) { $buffer = fread($fh, 3); fclose($fh); $compressed = ($buffer[0] == chr(31) && $buffer[1] == chr(139))?true:false; } else { $error = __('Cannot read uploaded file'); @unlink($src_file); } break; case 'application/x-gzip': case 'application/x-gzip-compressed': $compressed = true; break; case 'text/plain': $compressed = false; break; default : $error = __('Wrong file format.'); @unlink($src_file); break; } } else { $error = __('An error occurred while uploading the dumpfile.'); } if (isset($compressed)) { if (($res = dbdump::restoreDump($src_file, $compressed)) !== false) { buffer::str( '

'.__('Restore done.').'

' ); $blog->triggerMassUpd(); } else { $error = __('An error occurred while restoring. Your blog may be broken.'); } } if (!empty($error)) { buffer::str( '

'.$error.'

'. '

'.__('Restore failed.').'

' ); } buffer::str( '

'.__('Back to menu').'

' ); } else { include_once(dirname(__FILE__).'/lib.installer.php'); buffer::str( '

'.__('MySQL database operations').'

'); // Vérification de la présence d'un répertoire dédié dans share (pour dump) if (($err = installer::checkPluginShareDir($my_name))) { buffer::str( '

'. __('Unavailable mysql/ directory in share/. You may create it manually.'). '

'. '
' ); } // Optimisation buffer::str( '

'.__('Optimization').' '.helpLink('index&plugin=mysql','optimisation').'

'. '

'.__('This operation allows you to optimize DotClear-related tables '. 'in MySQL and keep some data safe. No data should be lost during this '. 'operation.').'

'. '

'.__('Important').' : '. __('Such an operation could take some time. Please be patient.').'

'. '
'. '

'. dcNonce::form(). '

'. '
' ); // Sauvegarde buffer::str( '

'.__('Backup').' '.helpLink('index&plugin=mysql','sauvegarde').'

'. '

'.__('This operation allows you to save DotClear-related tables '. 'in MySQL. It will generate a gzipped SQL file, stored in your share/ directory, which could be use to restore your tables and their content.'). '

'. '

'.__('Important').' : '. __('Such an operation could take some time. Please be patient.').'

'. '
'. '
'. '

'. '

'. '

'. dcNonce::form(). '

'. '
'. '
' ); // Restauration buffer::str( '

'.__('Restore a backup').' '.helpLink('index&plugin=mysql','restauration').'

'. '

'.__('This operation allows you to restore your DotClear-related tables in MySQL. '. 'It will use a gzipped dump file produced by the backup operation.').'

'. '

'.__('Use the form below to select and upload your dump file.').'

'. '

'.__('Important').' : '. __('Such an operation could take some time. Please be patient.').'

'. '

'. __('Please note that this operation will not merge existing datas with dumped ones, but simply replace them.'). '
'. __('Besides, this process can fail due to execution time restrictions in your PHP configuration.'). __('In such a case, it may leave your blog in a damaged state.'). '
'. __('You are now warned !'). '

'. '
'. '
'. '

'. '

'. '

'. dcNonce::form(). '

'. '
'. '
' ); } ?>