port hubzillas OpenWebAuth - rename verify table to openwebauth-token

This commit is contained in:
rabuzarus 2018-06-20 19:18:41 +02:00
parent 1ab3f7bfc8
commit d5afbd3357
3 changed files with 12 additions and 12 deletions

View File

@ -1085,9 +1085,9 @@ CREATE TABLE IF NOT EXISTS `user-item` (
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
--
-- TABLE verify
-- TABLE openwebauth-token
--
CREATE TABLE IF NOT EXISTS `verify` (
CREATE TABLE IF NOT EXISTS `openwebauth-token` (
`id` int(10) NOT NULL auto_increment COMMENT 'sequential ID',
`uid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`type` varchar(32) DEFAULT '' COMMENT 'Verify type',
@ -1095,7 +1095,7 @@ CREATE TABLE IF NOT EXISTS `verify` (
`meta` varchar(255) DEFAULT '' COMMENT '',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
PRIMARY KEY(`id`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store token to verify contacts';
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
--
-- TABLE worker-ipc

View File

@ -1818,8 +1818,8 @@ class DBStructure
"PRIMARY" => ["uid", "iid"],
]
];
$database["verify"] = [
"comment" => "Store token to verify contacts",
$database["openwebauth-token"] = [
"comment" => "Store OpenWebAuth token to verify contacts",
"fields" => [
"id" => ["type" => "int(10)", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
"uid" => ["type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],

View File

@ -10,12 +10,12 @@ use Friendica\Util\DateTimeFormat;
use dba;
/**
* Methods to deal with entries of the 'verify' table.
* Methods to deal with entries of the 'openwebauth_token' table.
*/
class Verify
{
/**
* Create an entry in the 'verify' table.
* Create an entry in the 'openwebauth_token' table.
*
* @param string $type Verify type.
* @param int $uid The user ID.
@ -33,11 +33,11 @@ class Verify
"meta" => $meta,
"created" => DateTimeFormat::utcNow()
];
return dba::insert("verify", $fields);
return dba::insert("openwebauth_token", $fields);
}
/**
* Get the "meta" field of an entry in the verify table.
* Get the "meta" field of an entry in the openwebauth_token table.
*
* @param string $type Verify type.
* @param int $uid The user ID.
@ -49,9 +49,9 @@ class Verify
{
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
$entry = dba::selectFirst("verify", ["id", "meta"], $condition);
$entry = dba::selectFirst("openwebauth_token", ["id", "meta"], $condition);
if (DBM::is_result($entry)) {
dba::delete("verify", ["id" => $entry["id"]]);
dba::delete("openwebauth_token", ["id" => $entry["id"]]);
return $entry["meta"];
}
@ -67,7 +67,7 @@ class Verify
public static function purge($type, $interval)
{
$condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
dba::delete("verify", $condition);
dba::delete("openwebauth_token", $condition);
}
}