) 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',
`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
"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"],
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.
"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.
{
$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"];
}
public static function purge($type, $interval)
{
$condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
- dba::delete("verify", $condition);
+ dba::delete("openwebauth_token", $condition);
}
}