示例#1
0
function MaintainDownloadBackup()
{
    global $sourcedir;
    require_once $sourcedir . '/DumpDatabase.php';
    DumpDatabase2();
}
示例#2
0
 /**
  * Handling function for the backup stuff.
  *
  * - It requires an administrator and the session hash by post.
  * - This method simply forwards to DumpDatabase2().
  */
 public function action_backup_display()
 {
     global $context, $txt, $user_info;
     validateToken('admin-maint');
     // Administrators only!
     if (!allowedTo('admin_forum')) {
         fatal_lang_error('no_dump_database', 'critical');
     }
     checkSession('post');
     if (empty($iknowitmaybeunsafe)) {
         require_once SUBSDIR . '/FtpConnection.class.php';
         $ftp = new Ftp_Connection($_POST['ftp_server'], $_POST['ftp_port'], $_POST['ftp_username'], $_POST['ftp_password']);
         if ($ftp->error === false) {
             // I know, I know... but a lot of people want to type /home/xyz/... which is wrong, but logical.
             if (!$ftp->chdir($_POST['ftp_path'])) {
                 $ftp_error = $ftp->error;
                 $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', $_POST['ftp_path']));
             }
         }
         // If we had an error...
         if ($ftp->error !== false) {
             loadLanguage('Packages');
             $ftp_error = $ftp->last_message === null ? isset($txt['package_ftp_' . $ftp->error]) ? $txt['package_ftp_' . $ftp->error] : '' : $ftp->last_message;
             // Fill the boxes for a FTP connection with data from the previous attempt
             $context['package_ftp'] = array('form_elements_only' => 1, 'server' => $_POST['ftp_server'], 'port' => $_POST['ftp_port'], 'username' => $_POST['ftp_username'], 'path' => $_POST['ftp_path'], 'error' => empty($ftp_error) ? null : $ftp_error);
             return $this->action_database();
         }
     }
     require_once SUBSDIR . '/Admin.subs.php';
     emailAdmins('admin_backup_database', array('BAK_REALNAME' => $user_info['name']));
     logAction('database_backup', array('member' => $user_info['id']), 'admin');
     require_once SOURCEDIR . '/DumpDatabase.php';
     DumpDatabase2();
 }
示例#3
0
/**
 * Handling function for the backup stuff.
 */
function MaintainDownloadBackup()
{
    global $sourcedir;
    validateToken('admin-maint');
    require_once $sourcedir . '/DumpDatabase.php';
    DumpDatabase2();
}
示例#4
0
/**
 * This file has a single job - database backup.
 *
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 Alpha 1
 */
require_once 'SSI.php';
if ($user_info['is_admin']) {
    DumpDatabase2();
}
/**
 * Dumps the database.
 * It writes all of the database to standard output.
 * It uses gzip compression if compress is set in the URL/post data.
 * It may possibly time out, and mess up badly if you were relying on it. :P
 * The data dumped depends on whether "struct" and "data" are passed.
 * It requires an administrator and the session hash by post.
 * It is called from ManageMaintenance.php.
 */
function DumpDatabase2()
{
    global $db_name, $scripturl, $context, $modSettings, $crlf, $smcFunc, $db_prefix, $db_show_debug;
    // Administrators only!
    if (!allowedTo('admin_forum')) {
 /**
  * Handling function for the backup stuff.
  *
  * - It requires an administrator and the session hash by post.
  * - This method simply forwards to DumpDatabase2().
  */
 public function action_backup_display()
 {
     validateToken('admin-maint');
     // Administrators only!
     if (!allowedTo('admin_forum')) {
         fatal_lang_error('no_dump_database', 'critical');
     }
     checkSession('post');
     require_once SOURCEDIR . '/DumpDatabase.php';
     DumpDatabase2();
 }