Commit ca058190 authored by David Morley's avatar David Morley

fix config file up like it was

parent fffe66e9
<?php
/* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
//backup directory
$backup_dir = '/var/www/podup/backup';
$backup_dir = '/backup';
//log directory
$log_dir = '/var/www/podup/log';
$log_dir = '/log';
//location of pg dump
$pg_dump_dir = '/usr/bin';
//db username
......
......@@ -4,7 +4,7 @@ $valid = 0;
require_once __DIR__ . '/../logging.php';
$log = new Logging();
$log->lfile('../log/add.php.log');
$log->lfile(__DIR__ . $log_dir . '/add.log');
if (!$_POST['url']) {
$log->lwrite('no url given ' . $_POST['domain']);
die('no url given');
......
......@@ -3,15 +3,15 @@ require_once __DIR__ . '/../config.php';
$keep = (60 * 60 * 6) * 1;
$dump_date = date('Ymd_Hs');
$file_name = $backup_dir . '/dump_' . $dump_date . '.sql';
$file_name = __DIR__ . '/..' .$backup_dir . '/dump_' . $dump_date . '.sql';
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --username=$pguser $pgdb >> $file_name");
echo "pg backup of $pgdb made";
$dirh = dir($backup_dir);
$dirh = dir(__DIR__ . '/..' .$backup_dir);
while ($entry = $dirh->read()) {
$old_file_time = (date('U') - $keep);
$file_created = filectime("$backup_dir/$entry");
$file_created = filectime(__DIR__ . '/..' . "$backup_dir/$entry");
if ($file_created < $old_file_time && !is_dir($entry)) {
if (unlink("$backup_dir/$entry")) {
if (unlink(__DIR__ . '/..' . "$backup_dir/$entry")) {
echo 'Cleaned up old backups';
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment