update README and CONTRIBUTING files; added PULL_REQUEST_TEMPLATE; database user-creation fix for MySQL8
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
19
.github/CONTRIBUTING.md
vendored
19
.github/CONTRIBUTING.md
vendored
@@ -2,15 +2,12 @@
|
||||
|
||||
Before you start working on a PR, contact us via IRC in #froxlor on Freenode or
|
||||
the forum at https://forum.froxlor.org to get a clue whether someone else isn't
|
||||
already working on it or if we don't want to invest the effort in favour of
|
||||
working on Froxlor 2.0.
|
||||
Of course, bug fixes are always welcome.
|
||||
already working on it or if we don not want/need this certain change.
|
||||
Of course, bugfixes are always welcome.
|
||||
However, at this stage of the 0.9.x branch, we are not looking for new
|
||||
features or refactoring, especially not the kind which requires changes to a
|
||||
lot of files.
|
||||
Currently, we are working on a complete re-write, which, at this point in
|
||||
time, is not yet public to keep delays due to discussions about internal
|
||||
details to a minimum.
|
||||
Please focus on our API based version 0.10.x (current master).
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +32,7 @@ Thanks!
|
||||
|
||||
### Webserver changes
|
||||
If you make changes to the functionality of webserver configuration, please
|
||||
make sure your implementation covers both apache **and** nginx.
|
||||
make sure your implementation covers all supported webservers.
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +48,10 @@ strings in
|
||||
|
||||
|
||||
|
||||
### New settings
|
||||
If you add new settings, please make sure you add the default values to
|
||||
### New settings and database-layout changnes
|
||||
If you add new settings or layout changes, please make sure you add these to
|
||||
|
||||
* `install/froxlor.sql`
|
||||
* handle the update (see `install/updates/froxlor/0.9/update_0.9.inc.php`)
|
||||
* and handle the update (see `install/updates/froxlor/0.10/update_0.10.inc.php`)
|
||||
* if you have any question on how update-process works, please contact us
|
||||
|
||||
|
||||
38
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
38
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed if any. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
# How Has This Been Tested?
|
||||
|
||||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
||||
|
||||
- [ ] Test A
|
||||
- [ ] Test B
|
||||
|
||||
**Test Configuration**:
|
||||
|
||||
* Distribution:
|
||||
* Webserver:
|
||||
* PHP:
|
||||
* etc.etc.:
|
||||
|
||||
# Checklist:
|
||||
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[](http://services.nutime.de:8081/job/froxlor-0.10/)
|
||||
[](https://travis-ci.com/Froxlor/Froxlor)
|
||||
|
||||
# Froxlor
|
||||
|
||||
|
||||
@@ -66,12 +66,25 @@ class DbManagerMySQL {
|
||||
* @param bool $p_encrypted optional, whether the password is encrypted or not, default false
|
||||
*/
|
||||
public function grantPrivilegesTo($username = null, $password = null, $access_host = null, $p_encrypted = false) {
|
||||
// grant privileges
|
||||
$stmt = Database::prepare("
|
||||
GRANT ALL PRIVILEGES ON `" . $username . "`.*
|
||||
TO :username@:host IDENTIFIED BY 'password'
|
||||
");
|
||||
Database::pexecute($stmt, array("username" => $username, "host" => $access_host));
|
||||
// mysql8 compatibility
|
||||
if (Database::getAttribute(PDO::ATTR_SERVER_VERSION) >= '8.0.0') {
|
||||
// create user
|
||||
$stmt = Database::prepare("
|
||||
CREATE USER `" . $username . "`.`" . $access_host . "` IDENTIFIED BY 'password'
|
||||
");
|
||||
Database::pexecute($stmt);
|
||||
// grant privileges
|
||||
$stmt = Database::prepare("
|
||||
GRANT ALL ON `" . $username . "`.* TO :username@:host
|
||||
");
|
||||
Database::pexecute($stmt, array("username" => $username, "host" => $access_host));
|
||||
} else {
|
||||
// grant privileges
|
||||
$stmt = Database::prepare("
|
||||
GRANT ALL PRIVILEGES ON `" . $username . "`.* TO :username@:host IDENTIFIED BY 'password'
|
||||
");
|
||||
Database::pexecute($stmt, array("username" => $username, "host" => $access_host));
|
||||
}
|
||||
// set passoword
|
||||
if ($p_encrypted) {
|
||||
$stmt = Database::prepare("SET PASSWORD FOR :username@:host = :password");
|
||||
@@ -102,7 +115,7 @@ class DbManagerMySQL {
|
||||
|
||||
while ($host = $host_res_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
// as of MySQL 5.0.2 this also revokes privileges. (requires MySQL 4.1.2+)
|
||||
$drop_stmt = Database::prepare("DROP USER :dbname@:host");
|
||||
$drop_stmt = Database::prepare("DROP USER IF EXISTS :dbname@:host");
|
||||
Database::pexecute($drop_stmt, array('dbname' => $dbname, 'host' => $host['Host']), false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user