Example #1
0
} else {
    die('Hack ?');
}
//check are temp dirs the same
if ($STATIC['TEMPDIR'] != trim($_POST['BackWPupJobTemp'])) {
    delete_working_file();
    die('Temp dir not correct!');
}
ob_end_clean();
header("Connection: close");
ob_start();
header("Content-Length: 0");
ob_end_flush();
flush();
// set memory limit to the same as WP.
if (function_exists('memory_get_usage') && inbytes(@ini_get('memory_limit')) < inbytes($STATIC['WP']['MEMORY_LIMIT'])) {
    @ini_set('memory_limit', $STATIC['WP']['MEMORY_LIMIT']);
}
//check existing Logfile
if (empty($STATIC) or !is_file($STATIC['LOGFILE'])) {
    delete_working_file();
    die('No logfile found!');
}
//load translation
if (is_file(dirname(__FILE__) . '/../lang/backwpup-' . $STATIC['WP']['WPLANG'] . '.mo')) {
    require $STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC'] . '/pomo/mo.php';
    $TRANSLATE = new MO();
    $TRANSLATE->import_from_file(dirname(__FILE__) . '/../lang/backwpup-' . $STATIC['WP']['WPLANG'] . '.mo');
} else {
    require $STATIC['WP']['ABSPATH'] . $STATIC['WP']['WPINC'] . '/pomo/translations.php';
    $TRANSLATE = new NOOP_Translations();
function need_free_memory($memneed)
{
    if (!function_exists('memory_get_usage')) {
        return;
    }
    //need memory
    $needmemory = @memory_get_usage(true) + inbytes($memneed);
    // increase Memory
    if ($needmemory > inbytes(ini_get('memory_limit'))) {
        $newmemory = round($needmemory / 1024 / 1024) + 1 . 'M';
        if ($needmemory >= 1073741824) {
            $newmemory = round($needmemory / 1024 / 1024 / 1024) . 'G';
        }
        if ($oldmem = @ini_set('memory_limit', $newmemory)) {
            trigger_error(sprintf(__('Memory increased from %1$s to %2$s', 'backwpup'), $oldmem, @ini_get('memory_limit')), E_USER_NOTICE);
        } else {
            trigger_error(sprintf(__('Can not increase memory limit is %1$s', 'backwpup'), @ini_get('memory_limit')), E_USER_WARNING);
        }
    }
}