diff options
author | Mario <mario@mariovavti.com> | 2021-05-07 10:03:12 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-07 10:03:12 +0000 |
commit | b5ce20734445f03d070e8b6faf1ed73950f62c81 (patch) | |
tree | ff477c62d5e27feac959ab7c4917441d4995f2e4 | |
parent | d04ff264fabb2f78e98b2e486909c768d30643d5 (diff) | |
download | volse-hubzilla-b5ce20734445f03d070e8b6faf1ed73950f62c81.tar.gz volse-hubzilla-b5ce20734445f03d070e8b6faf1ed73950f62c81.tar.bz2 volse-hubzilla-b5ce20734445f03d070e8b6faf1ed73950f62c81.zip |
register: implement remove_expired_registrations() and minor fixes
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 10 | ||||
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Admin/Channels.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Regate.php | 5 | ||||
-rw-r--r-- | include/account.php | 59 |
5 files changed, 37 insertions, 41 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 4732dfa75..335ff9751 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -55,11 +55,13 @@ class Cron { db_utcnow() ); + remove_expired_registrations(); + $interval = get_config('system', 'delivery_interval', 3); // expire any expired items - $r = q("select id,item_wall from item where expires > '2001-01-01 00:00:00' and expires < %s + $r = q("select id,item_wall from item where expires > '2001-01-01 00:00:00' and expires < %s and item_deleted = 0 ", db_utcnow() ); @@ -131,7 +133,7 @@ class Cron { // publish any applicable items that were set to be published in the future // (time travel posts). Restrict to items that have come of age in the last - // couple of days to limit the query to something reasonable. + // couple of days to limit the query to something reasonable. $r = q("select id from item where item_delayed = 1 and created <= %s and created > '%s' ", db_utcnow(), @@ -192,7 +194,7 @@ class Cron { // update any photos which didn't get imported properly // This should be rare - $r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = '' + $r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = '' and xchan_photo_date < %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 DAY') @@ -238,7 +240,7 @@ class Cron { set_config('system', 'lastcron', datetime_convert()); - //All done - clear the lockfile + //All done - clear the lockfile @unlink($lockfile); return; diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index ac782c740..7e33f09b8 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -983,7 +983,7 @@ class Enotify { 'photo' => z_root() . '/' . get_default_profile_photo(48), 'when' => datetime_convert('UTC', date_default_timezone_get(),$rr['reg_created']), 'hclass' => ('notify-unseen'), - 'message' => t('verified') + 'message' => t('status verified') ]; return $x; diff --git a/Zotlabs/Module/Admin/Channels.php b/Zotlabs/Module/Admin/Channels.php index e0f26112d..09769a166 100644 --- a/Zotlabs/Module/Admin/Channels.php +++ b/Zotlabs/Module/Admin/Channels.php @@ -173,4 +173,4 @@ class Channels { return $o; } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php index b5f7f0958..379195461 100644 --- a/Zotlabs/Module/Regate.php +++ b/Zotlabs/Module/Regate.php @@ -102,9 +102,10 @@ class Regate extends \Zotlabs\Web\Controller { if (($flags & ACCOUNT_UNVERIFIED) == ACCOUNT_UNVERIFIED) { // verification success - $msg = 'ZAR1237I' . ' ' . t('Verify successfull'); + $msg_code = 'ZAR1237I'; + $msg = t('Verification successful'); $reonar = json_decode( $r['reg_stuff'], true); - $reonar['valid'] = $now . ',' . $ip . ' ' . $did2 . ' ' . $msg; + $reonar['valid'] = $now . ',' . $ip . ' ' . $did2 . ' ' . $msg_code . ' ' . $msg; // clear flag $flags &= $flags ^ ACCOUNT_UNVERIFIED; diff --git a/include/account.php b/include/account.php index 86132b411..6643f0988 100644 --- a/include/account.php +++ b/include/account.php @@ -862,12 +862,12 @@ function verify_register_scheme() { if ($dbc[0]=='id') { // v1 format - q("START TRANSACTION"); + dbq("START TRANSACTION"); if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r1 = q("ALTER TABLE register RENAME TO register100;"); + $r1 = dbq("ALTER TABLE register RENAME TO register100;"); - $r2 = q("CREATE TABLE register (" + $r2 = dbq("CREATE TABLE register (" . "reg_id serial NOT NULL," . "reg_vital int DEFAULT 1 NOT NULL," . "reg_flags bigint DEFAULT 0 NOT NULL," @@ -886,29 +886,29 @@ function verify_register_scheme() { . "reg_stuff text NOT NULL," . "PRIMARY KEY (reg_id) );" ); - $r0 = q("CREATE INDEX ix_reg_vital ON register (reg_vital);"); - $r0 = q("CREATE INDEX ix_reg_flags ON register (reg_flags);"); - $r0 = q("CREATE INDEX ix_reg_didx ON register (reg_didx);"); - $r0 = q("CREATE INDEX ix_reg_did2 ON register (reg_did2);"); - $r0 = q("CREATE INDEX ix_reg_hash ON register (reg_hash);"); - $r0 = q("CREATE INDEX ix_reg_email ON register (reg_email);"); - $r0 = q("CREATE INDEX ix_reg_created ON register (reg_created);"); - $r0 = q("CREATE INDEX ix_reg_startup ON register (reg_startup);"); - $r0 = q("CREATE INDEX ix_reg_expires ON register (reg_expires);"); - $r0 = q("CREATE INDEX ix_reg_byc ON register (reg_byc);"); - $r0 = q("CREATE INDEX ix_reg_uid ON register (reg_uid);"); - $r0 = q("CREATE INDEX ix_reg_atip ON register (reg_atip);"); - - $r3 = q("INSERT INTO register (reg_id, reg_hash, reg_created, reg_uid, reg_pass, reg_lang, reg_stuff) " + $r0 = dbq("CREATE INDEX ix_reg_vital ON register (reg_vital);"); + $r0 = dbq("CREATE INDEX ix_reg_flags ON register (reg_flags);"); + $r0 = dbq("CREATE INDEX ix_reg_didx ON register (reg_didx);"); + $r0 = dbq("CREATE INDEX ix_reg_did2 ON register (reg_did2);"); + $r0 = dbq("CREATE INDEX ix_reg_hash ON register (reg_hash);"); + $r0 = dbq("CREATE INDEX ix_reg_email ON register (reg_email);"); + $r0 = dbq("CREATE INDEX ix_reg_created ON register (reg_created);"); + $r0 = dbq("CREATE INDEX ix_reg_startup ON register (reg_startup);"); + $r0 = dbq("CREATE INDEX ix_reg_expires ON register (reg_expires);"); + $r0 = dbq("CREATE INDEX ix_reg_byc ON register (reg_byc);"); + $r0 = dbq("CREATE INDEX ix_reg_uid ON register (reg_uid);"); + $r0 = dbq("CREATE INDEX ix_reg_atip ON register (reg_atip);"); + + $r3 = dbq("INSERT INTO register (reg_id, reg_hash, reg_created, reg_uid, reg_pass, reg_lang, reg_stuff) " . "SELECT id, hash, created, uid, password, lang, '' FROM register100;"); - $r4 = q("DROP TABLE register100"); + $r4 = dbq("DROP TABLE register100"); } else { - $r1 = q("RENAME TABLE register TO register100;"); + $r1 = dbq("RENAME TABLE register TO register100;"); - $r2 = q("CREATE TABLE IF NOT EXISTS register (" + $r2 = dbq("CREATE TABLE IF NOT EXISTS register (" . "reg_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT," . "reg_vital int(10) UNSIGNED NOT NULL DEFAULT 1," . "reg_flags int(10) UNSIGNED NOT NULL DEFAULT 0," @@ -941,10 +941,10 @@ function verify_register_scheme() { . ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" ); - $r3 = q("INSERT INTO register (reg_id, reg_hash, reg_created, reg_uid, reg_pass, reg_lang, reg_stuff) " + $r3 = dbq("INSERT INTO register (reg_id, reg_hash, reg_created, reg_uid, reg_pass, reg_lang, reg_stuff) " . "SELECT id, hash, created, uid, password, lang, '' FROM register100;"); - $r4 = q("DROP TABLE register100"); + $r4 = dbq("DROP TABLE register100"); } // $r = ($r1 && $r2 && $r3 && $r4); @@ -952,11 +952,11 @@ function verify_register_scheme() { $r = $r2; if($r) { - q("COMMIT"); + dbq("COMMIT"); return UPDATE_SUCCESS; } - q("ROLLBACK"); + dbq("ROLLBACK"); return UPDATE_FAILED; } elseif ( count($dbc) != 16 ) { @@ -1281,14 +1281,6 @@ function zar_register_dutystate( $now=NULL, $day=NULL ) { function get_pending_accounts($get_all = false) { - /* get pending */ - // [hilmar -> - //~ $r = q("SELECT account.*, reg_hash FROM account LEFT JOIN register ON account_id = reg_uid WHERE reg_vital = 1 AND (account_flags & %d) > 0", - //~ intval(ACCOUNT_PENDING) - //~ ); - - // better useability at the moment to tell all (ACCOUNT_PENDING >= 0) instead of (> 0 for those need approval) - $sql_extra = " AND (reg_flags & " . ACCOUNT_UNVERIFIED . ") = 0 "; if($get_all) @@ -1303,7 +1295,8 @@ function get_pending_accounts($get_all = false) { } function remove_expired_registrations() { - q("DELETE FROM register WHERE reg_expire < '%s' OR reg_expire = '%s' AND (reg_flags & %d) > 0", + hz_syslog('### expire reg', LOGGER_DEBUG); + q("DELETE FROM register WHERE (reg_expires < '%s' OR reg_expires = '%s') AND (reg_flags & %d) > 0", dbesc(datetime_convert()), dbesc(NULL_DATE), dbesc(ACCOUNT_UNVERIFIED) |