From 54a3d3cf51ccc7e0ce838a2c982d06bca29a2bbb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 16 Nov 2007 06:11:59 +0100 Subject: [PATCH] schema: add created field to ttrss_users --- backend.php | 16 +++++++++++----- modules/pref-users.php | 4 ++-- schema/ttrss_schema_mysql.sql | 1 + schema/ttrss_schema_pgsql.sql | 1 + schema/versions/mysql/26.sql | 3 +++ schema/versions/pgsql/26.sql | 3 +++ 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/backend.php b/backend.php index 272daeb3..482b46fe 100644 --- a/backend.php +++ b/backend.php @@ -326,7 +326,8 @@ SUBSTRING(last_login,1,16) AS last_login, access_level, (SELECT COUNT(int_id) FROM ttrss_user_entries - WHERE owner_uid = id) AS stored_articles + WHERE owner_uid = id) AS stored_articles, + SUBSTRING(created,1,16) AS created FROM ttrss_users WHERE id = '$uid'"); @@ -345,20 +346,25 @@ $last_login = date(get_pref($link, 'LONG_DATE_FORMAT'), strtotime(db_fetch_result($result, 0, "last_login"))); + + $created = date(get_pref($link, 'LONG_DATE_FORMAT'), + strtotime(db_fetch_result($result, 0, "created"))); + $access_level = db_fetch_result($result, 0, "access_level"); $stored_articles = db_fetch_result($result, 0, "stored_articles"); # print "Username$login"; # print "Access level$access_level"; - print "Last logged in$last_login"; - print "Stored articles$stored_articles"; + print "".__('Registered')."$created"; + print "".__('Last logged in')."$last_login"; + print "".__('Stored articles')."$stored_articles"; $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds WHERE owner_uid = '$uid'"); $num_feeds = db_fetch_result($result, 0, "num_feeds"); - print "Subscribed feeds count$num_feeds"; + print "".__('Subscribed feeds count')."$num_feeds"; /* $result = db_query($link, "SELECT SUM(LENGTH(content)+LENGTH(title)+LENGTH(link)+LENGTH(guid)) AS db_size @@ -371,7 +377,7 @@ print ""; - print "

Subscribed feeds

"; + print "

".__('Subscribed feeds')."

"; $result = db_query($link, "SELECT id,title,site_url FROM ttrss_feeds WHERE owner_uid = '$uid' ORDER BY title"); diff --git a/modules/pref-users.php b/modules/pref-users.php index fdc6d495..ec6690a9 100644 --- a/modules/pref-users.php +++ b/modules/pref-users.php @@ -109,8 +109,8 @@ if (db_num_rows($result) == 0) { db_query($link, "INSERT INTO ttrss_users - (login,pwd_hash,access_level,last_login) - VALUES ('$login', '$pwd_hash', 0, NOW())"); + (login,pwd_hash,access_level,last_login,created) + VALUES ('$login', '$pwd_hash', 0, null, NOW())"); $result = db_query($link, "SELECT id FROM ttrss_users WHERE diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index cf29e012..970afb06 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -41,6 +41,7 @@ create table ttrss_users (id integer primary key not null auto_increment, email varchar(250) not null default '', email_digest bool not null default false, last_digest_sent datetime default null, + created datetime default null, index (theme_id), foreign key (theme_id) references ttrss_themes(id)) TYPE=InnoDB; diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index af8f1c54..fabf3716 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -37,6 +37,7 @@ create table ttrss_users (id serial not null primary key, email varchar(250) not null default '', email_digest boolean not null default false, last_digest_sent timestamp default null, + created timestamp default null, theme_id integer references ttrss_themes(id) default null); insert into ttrss_users (login,pwd_hash,access_level) values ('admin', diff --git a/schema/versions/mysql/26.sql b/schema/versions/mysql/26.sql index d7593c5e..513be9a6 100644 --- a/schema/versions/mysql/26.sql +++ b/schema/versions/mysql/26.sql @@ -1,3 +1,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 'Purge unread articles',3); +alter table ttrss_users add column created datetime; +alter table ttrss_users alter column created set default null; + update ttrss_version set schema_version = 26; diff --git a/schema/versions/pgsql/26.sql b/schema/versions/pgsql/26.sql index d7593c5e..48b96619 100644 --- a/schema/versions/pgsql/26.sql +++ b/schema/versions/pgsql/26.sql @@ -1,3 +1,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('PURGE_UNREAD_ARTICLES', 1, 'true', 'Purge unread articles',3); +alter table ttrss_users add column created timestamp; +alter table ttrss_users alter column created set default null; + update ttrss_version set schema_version = 26; -- 2.39.5