Пример #1
0
<?php

/**
 * The MIT License
 * http://creativecommons.org/licenses/MIT/
    *
 * ArrestDB 1.9.0 (github.com/alixaxel/ArrestDB/)
 * Copyright (c) 2014 Alix Axel <*****@*****.**>
    *
 * Hackery (C) 2015 Peter L Jones <*****@*****.**>
    *
**/
require "rest/db_strings.inc";
require "rest/ArrestDB.php";
ArrestDB::SetOption('MYSQL_NOTRDQUOTE', true);
ArrestDB::SetOption('RETURN_RAW', true);
$dsn = "mysql://{$mysql_user}:{$mysql_password}@{$mysql_hostname}/{$mysql_schema}";
$ARCHIVE_DIR = '/tmp/inge-diet/archive';
$SYMLINK = dirname(__FILE__) . '/archive';
$ARCHIVE_URI_PREFIX = dirname($_SERVER['SCRIPT_NAME']) . '/archive';
if (!is_dir($ARCHIVE_DIR)) {
    $mask = umask(0);
    mkdir($ARCHIVE_DIR, 01777, true);
    $stat = stat($ARCHIVE_DIR);
    if ($stat['mode'] !== 01777) {
        chmod($ARCHIVE_DIR, 01777);
    }
    umask($mask);
}
if (file_exists($SYMLINK) && !is_link($SYMLINK)) {
    unlink($SYMLINK);