示例#1
0
    // version tracking
    $db->delete('version', 1);
    // clear table of old accumulated entries
    //    $version = EXPONENT_VERSION_MAJOR.'.'.EXPONENT_VERSION_MINOR.'.'.EXPONENT_VERSION_REVISION.'-'.EXPONENT_VERSION_TYPE.''.EXPONENT_VERSION_ITERATION;
    $vo = null;
    //    $vo->version = EXPONENT_VERSION_MAJOR.'.'.EXPONENT_VERSION_MINOR.'.'.EXPONENT_VERSION_REVISION;	$vo->type = EXPONENT_VERSION_TYPE;
    $vo->major = EXPONENT_VERSION_MAJOR;
    $vo->minor = EXPONENT_VERSION_MINOR;
    $vo->revision = EXPONENT_VERSION_REVISION;
    $vo->type = EXPONENT_VERSION_TYPE;
    $vo->iteration = EXPONENT_VERSION_ITERATION;
    $vo->builddate = EXPONENT_VERSION_BUILDDATE;
    $vo->created_at = time();
    $ins = $db->insertObject($vo, 'version') or die($db->error());
    // ERROR CHECKING
    echoSuccess();
}
?>
</tbody>
</table>
<?php 
if ($passed) {
    // Do some final cleanup
    foreach ($db->getTables() as $t) {
        // FIX table prefix problem
        if (substr($t, 0, 14 + strlen($db->prefix)) == $db->prefix . 'installer_test') {
            $db->dropTable(str_replace($db->prefix, '', $t));
        }
    }
    echo '<p>';
    echo gt('Database tests passed.');
示例#2
0
function fieldPlays($method, $target, $payload)
{
    switch ($method) {
        case "GET":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            $result = dbSelect('devices', 'devicetime', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            break;
        case "POST":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            checkNULL($payload['user'], 'user');
            checkOnline($payload['user']);
            dbUpdate('devices', "command='" . $payload['cmd'] . "', timestamp='" . $payload['ts'] . "'", "location='" . $target . "'");
            echoSuccess("set_play");
            break;
        case "PUT":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            dbUpdate('devices', "devicetime='" . $payload['dt'] . "'", "tag='" . $target . "'");
            $result = dbSelect('devices', 'command, timestamp', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            dbUpdate('devices', "command=''", "tag='" . $target . "'");
            break;
        case "DELETE":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            dbUpdate('devices', "command='', timestamp=''", "location='" . $target . "'");
            echoSuccess("reset_play");
            break;
        default:
            echoError('Invalid Method');
            break;
    }
}
示例#3
0
function mkdirIfNotExist($type = '用户', $filename, $user = '******', $group = 'www')
{
    if (false == file_exists($filename)) {
        if (false == mkdir($filename)) {
            echoError("没有权限创建目录, 请sudo -s之后再执行本脚本");
        }
        exec("chown -R {$user}:{$group} {$filename}");
        echoSuccess("{$type}{$filename}目录创建成功!\n");
    } else {
        echoTip("{$type}{$filename}目录已经存在,跳过...");
    }
}