}
}
+ if (self::existsTable('user') && !DBA::exists('user', ['uid' => 0])) {
+ $system = User::getSystemAccount();
+ $user = [
+ "username" => $system['name'],
+ "nickname" => $system['nick'],
+ "register_date" => $system['created'],
+ "pubkey" => $system['pubkey'],
+ "prvkey" => $system['prvkey'],
+ "spubkey" => $system['spubkey'],
+ "sprvkey" => $system['sprvkey'],
+ "verified" => true,
+ "page-flags" => User::PAGE_FLAGS_SOAPBOX,
+ "account-type" => User::ACCOUNT_TYPE_RELAY,
+ ];
+
+ DBA::insert('user', $user);
+ $lastid = DBA::lastInsertId();
+ if ($lastid != 0) {
+ DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
+ }
+ }
+
if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
DBA::insert('contact', ['nurl' => '']);
$lastid = DBA::lastInsertId();
}
}
- if (self::existsTable('user') && !DBA::exists('user', ['uid' => 0])) {
- $system = User::getSystemAccount();
- $user = [
- "username" => $system['name'],
- "nickname" => $system['nick'],
- "register_date" => $system['created'],
- "pubkey" => $system['pubkey'],
- "prvkey" => $system['prvkey'],
- "spubkey" => $system['spubkey'],
- "sprvkey" => $system['sprvkey'],
- "verified" => true,
- "page-flags" => User::PAGE_FLAGS_SOAPBOX,
- "account-type" => User::ACCOUNT_TYPE_RELAY,
- ];
-
- DBA::insert('user', $user);
- $lastid = DBA::lastInsertId();
- if ($lastid != 0) {
- DBA::update('user', ['uid' => 0], ['uid' => $lastid]);
- }
- }
-
if (!self::existsForeignKeyForField('tokens', 'client_id')) {
$tokens = DBA::p("SELECT `tokens`.`id` FROM `tokens`
LEFT JOIN `clients` ON `clients`.`client_id` = `tokens`.`client_id`