Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit acf9c79

Browse files
melangervyskocilpavel
authored andcommitted
Database improvements (#32)
* Limit copy-paste in DatabaseCommand.php * read spName only if present * remove not used indexes * optimize left outer joins * don't double queries w/o days * addDaysRange * make methods in DatabaseCommand not static * Use SimpleSAML\Database * indent * update config-template * mark deprecated options * Fixes * Updated template configuration * Fixes after rebase
1 parent 9324320 commit acf9c79

File tree

9 files changed

+225
-404
lines changed

9 files changed

+225
-404
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
## [Unreleased]
55
#### Changed
66
- Remove unnecessary is_null()
7+
- Use SimpleSAML\Database
78

89
#### Fixed
910
- Log info message about successful authentication only after successful authentication to SP
@@ -12,6 +13,9 @@ All notable changes to this project will be documented in this file.
1213
- describe setup for modes PROXY/SP/IDP
1314
- change array notation from `array()` to `[]`
1415
- Read spName from $request only if present
16+
- Remove unused indexes
17+
- Optimize left outer join
18+
- Don't double queries w/o days
1519

1620
## [v3.1.0]
1721
#### Added

config-templates/module_statisticsproxy.php

Lines changed: 26 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,32 @@
3838
'spName' => '',
3939

4040
/*
41-
* Fill the serverName
42-
*/
43-
'serverName' => 'localhost',
44-
45-
/*
46-
* If you want to use the default port, please comment option 'port'
47-
*/
48-
'port' => 3306,
49-
50-
/*
51-
* Fill the user name
52-
*/
53-
'userName' => 'stats',
54-
55-
/*
56-
* Fill the password
57-
*/
58-
'password' => 'stats',
59-
60-
/*
61-
* Fill the database name
62-
*/
63-
'databaseName' => 'STATS',
41+
* Fill config for SimpleSAML\Database.
42+
* If not set, the global config is used.
43+
* @see SimpleSAML\Database
44+
*/
45+
'store' => [
46+
'database.dsn' => 'mysql:host=localhost;port=3306;dbname=STATS;charset=utf8',
47+
'database.username' => 'stats',
48+
'database.password' => 'stats',
49+
50+
/**
51+
* Configuration for SSL
52+
* If you want to use SSL you must filled this value and uncomment block of code
53+
*/
54+
/*
55+
'database.driver_options' => [
56+
// Path for the ssl key file
57+
PDO::MYSQL_ATTR_SSL_KEY => '',
58+
// Path for the ssl cert file
59+
PDO::MYSQL_ATTR_SSL_CERT => '',
60+
// Path for the ssl ca file
61+
PDO::MYSQL_ATTR_SSL_CA => '',
62+
// Path for the ssl ca dir
63+
PDO::MYSQL_ATTR_SSL_CAPATH => '',
64+
],
65+
*/
66+
],
6467

6568
/*
6669
* Fill the table name for statistics
@@ -76,38 +79,4 @@
7679
* Fill the table name for serviceProviders
7780
*/
7881
'serviceProvidersMapTableName' => 'serviceProvidersMap',
79-
80-
/*
81-
* Fill true, if you want to use encryption, false if not.
82-
*/
83-
'encryption' => true / false,
84-
85-
/*
86-
* The path name to the certificate authority file.
87-
*
88-
* If you use encryption, you must fill this option.
89-
*/
90-
'ssl_ca' => '/example/ca.pem',
91-
92-
/*
93-
* The path name to the certificate file.
94-
*
95-
* If you use encryption, you must fill this option.
96-
*/
97-
'ssl_cert_path' => '/example/cert.pem',
98-
99-
/*
100-
* The path name to the key file.
101-
*
102-
* If you use encryption, you must fill this option.
103-
*/
104-
'ssl_key_path' => '/example/key.pem',
105-
106-
/*
107-
* The pathname to a directory that contains trusted SSL CA certificates in PEM format.
108-
*
109-
* If you use encryption, you must fill this option.
110-
*/
111-
'ssl_ca_path' => '/etc/ssl',
112-
11382
];

config-templates/tables.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ CREATE TABLE statistics (
88
count INT,
99
INDEX (sourceIdp),
1010
INDEX (service),
11-
INDEX (year),
12-
INDEX (year,month),
13-
INDEX (year,month,day),
1411
PRIMARY KEY (year, month, day, sourceIdp, service)
1512
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1613

0 commit comments

Comments
 (0)