包含:登录失败锁定、90天密码有效期、30分钟会话超时、 强制改密、登录审计日志、屏幕水印、企业背景图、 备案信息固定底部、favicon、登录页JS修复等全部改动
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- Add a timestamp field for the users table
|
||||
|
||||
ALTER TABLE %DB_TBL_PREFIX%users
|
||||
ADD COLUMN `timestamp` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `email`;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Correct type of earlier timestamp fields
|
||||
ALTER TABLE %DB_TBL_PREFIX%entry
|
||||
ALTER COLUMN timestamp TYPE timestamptz;
|
||||
ALTER TABLE %DB_TBL_PREFIX%repeat
|
||||
ALTER COLUMN timestamp TYPE timestamptz;
|
||||
|
||||
-- Add a timestamp field for the users table
|
||||
|
||||
ALTER TABLE %DB_TBL_PREFIX%users
|
||||
ADD COLUMN timestamp timestamptz DEFAULT current_timestamp;
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// -*- mode: php; -*-
|
||||
namespace MRBS;
|
||||
|
||||
global $dbsys;
|
||||
|
||||
// Special case for PostgreSQL as attempting to create a function
|
||||
// with the pgsql.sql file doesn't work due to the way the file
|
||||
// is split by semi-colons.
|
||||
if ($dbsys == "pgsql")
|
||||
{
|
||||
// Ensure plpgsql language is installed
|
||||
$sql = <<<END_OF_SQL
|
||||
CREATE OR REPLACE FUNCTION create_language_plpgsql()
|
||||
RETURNS BOOLEAN AS \$\$
|
||||
CREATE LANGUAGE plpgsql;
|
||||
SELECT TRUE;
|
||||
\$\$ LANGUAGE SQL;
|
||||
END_OF_SQL;
|
||||
|
||||
$upgrade_handle->command($sql);
|
||||
|
||||
$sql = <<<END_OF_SQL
|
||||
SELECT CASE WHEN NOT
|
||||
(
|
||||
SELECT TRUE AS exists
|
||||
FROM pg_language
|
||||
WHERE lanname = 'plpgsql'
|
||||
UNION
|
||||
SELECT FALSE AS exists
|
||||
ORDER BY exists DESC
|
||||
LIMIT 1
|
||||
)
|
||||
THEN
|
||||
create_language_plpgsql()
|
||||
ELSE
|
||||
FALSE
|
||||
END AS plpgsql_created;
|
||||
END_OF_SQL;
|
||||
|
||||
$upgrade_handle->command($sql);
|
||||
|
||||
$sql = <<<END_OF_SQL
|
||||
DROP FUNCTION create_language_plpgsql();
|
||||
END_OF_SQL;
|
||||
|
||||
$upgrade_handle->command($sql);
|
||||
|
||||
// Add function to update timestamp column
|
||||
$sql = <<<END_OF_SQL
|
||||
CREATE OR REPLACE FUNCTION update_timestamp_column()
|
||||
RETURNS TRIGGER AS \$\$
|
||||
BEGIN
|
||||
NEW.timestamp = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
\$\$ language 'plpgsql';
|
||||
END_OF_SQL;
|
||||
$upgrade_handle->command($sql);
|
||||
|
||||
// Add triggers for tables with timestamp columns
|
||||
foreach (array('entry', 'repeat', 'users') as $table)
|
||||
{
|
||||
$sql = "CREATE TRIGGER update_" . _tbl($table, false) . "_timestamp " .
|
||||
"BEFORE UPDATE ON " . _tbl($table, true) . " FOR EACH ROW " .
|
||||
"EXECUTE PROCEDURE update_timestamp_column()";
|
||||
$upgrade_handle->command($sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user