30 Commits

Author SHA1 Message Date
Tony Murray
a2e33efba8 Use PDO for MySQL queries (#8935)
Gut dbFacile
mres() now does nothing... could have some vulnerable queries, but most are ok

TODO
- [x] IRC client broke
- [x] Install broke

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
2018-08-17 21:29:20 +01:00
Tony Murray
d841625f12 refactor: Refactor database and config init (#8527)
* Refactor database and config init
Connect to the database without loading full config
Load config completely so post-processing is always done consistently.
Erase existing $config when loading, fixes issues in case we load the config twice.
If the database is not connected, don't try to load database settings. (Fixes some db errors on install)
Attempt to remove $config access/modification before init.php
Remove usage of db_name, that might not match the connected database.
Centralize db config loading, so we consistently apply db_test database settings.
Many of these changes are influenced by Laravel port.

* Some safety so we don't assign strings to numeric port field
Smooth out phpunit bootstrap

* Fix a couple of scrutinizer warnings.
2018-04-11 16:15:13 +01:00
Tony Murray
8e85eebe32 fix: Don't lock the schema during install.php (#7051) 2017-07-18 20:07:21 +01:00
Tony Murray
f02b551145 feature: Improved install experience (#6915)
always check that the base sql has been imported.
async db building
After this merge, we could move install.php to the end of the install documentation.  Makes a more natural flow.
2017-07-01 21:28:29 +01:00
Tony Murray
b1a414e785 feature: support non-standard unix socket (#5724)
* Add support for custom MySQL unix-socket

* NULL must be lowercase!

* Naive edit of html/install.php

* fixup

* Refactor dbConnect
Use it everywhere

* $config needs to be global
Don't need to set $database_link

* small cleanups
2017-04-06 22:02:37 +01:00
Neil Lathwood
24a5f6bd37 Db collation standardisation (#5932)
* initial work to standardise collation

* more updates

* final bits for collation update (famous last words)

* Rename 165.sql to 166.sql

* Update schema version inside 166.sql

* moved schema file 166->171
2017-02-27 18:28:01 +00:00
Neil Lathwood
200b762478 feature: Added phpunit db setup tests (#5594) 2017-02-07 15:08:52 +00:00
David Bell
5dd030f438 refactor: Added config option for database port (#5517) 2017-01-27 23:16:04 +00:00
Neil Lathwood
8c5ff4609b fix: This change broke the web installer 2016-09-16 10:51:52 +01:00
Tony Murray
d2193f76ca feature: allow scripts to be run from any working directory (#4437)
* feature: allow validate.php to be run from any working directory

* remove redundant realpath() call

* re-add realpath() to remove symbolic links

* realpath() isn't needed...

* chdir() in all php scripts in ./ and ./scripts/

* update-sql.php clearly is not used, as it was broken.

* Change some scripts to executable
Remove extra chdir() call in snmp-scan.php

* Missed console-ui.php
Kind of fixed console-ui.php help output

* Re-add newline
2016-09-14 16:53:04 +01:00
Tony Murray
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00
f0o
9ca926b9c6 SQLs are performed up to an execution time of 45s, then a page reload is induced to avoid fcgi/cgi/modphp timeouts. 2015-09-02 15:30:51 +01:00
f0o
501cf5a6ef Present all output+errors at the end 2015-09-02 15:30:21 +01:00
f0o
a2096dad51 Remove dupe-warning suppressor 2015-09-02 15:29:09 +01:00
f0o
ca0f9ea2f9 Avoid useless I/O 2015-09-02 15:29:07 +01:00
f0o
2fd423f9fc Revert build.sql
Make update.php responsive
2015-09-02 15:29:06 +01:00
f0o
3f7c37a523 revision fix 2015-09-02 15:29:04 +01:00
f0o
19059412da Make installer more responsive
Update each schema in update.php after applying
Packaged new build.sql bundling all updates up to 067
2015-09-02 15:29:02 +01:00
f0o
87677eabeb Use the persistent MySQL connections in install and build-base
Share mysql-connection from install to build-base
2015-09-02 15:28:54 +01:00
laf
446add9dd6 changed connection around 2015-08-15 17:37:20 +00:00
laf
f4f2c652ac Fix missing parameter for mysqli_select_db 2015-08-15 09:55:53 +00:00
laf
4b49c148b6 Added mysqli support 2015-08-08 19:27:18 +00:00
laf
021ada79cf Fixed web installer + made the mysql import message stronger 2015-08-07 16:15:56 +00:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
Thom Seddon
7508f58f7b Alert failed database selection in build-base.php
Previously this would continue and subsequent queries would fail
verbosely
2015-05-18 20:12:52 +01:00
Paul Gear
8431df19ec Better error checking and more informative messages for initial db build 2014-08-14 08:06:49 +10:00
laf
02792176fa Updated most files to use dbFacile 2014-03-12 22:21:33 +00:00
laf
2d76c9ae47 build-base.php now calls includes/sql-schema/update.php 2014-02-27 22:53:43 +00:00
laf
fbc9178d1d New web based installer to simplify installation install.php will now redirect and exit if config.php exists
Updated install docs
2014-02-02 15:05:29 +00:00
Tyler Christiansen
481d7a3c9f create new method for populating database 2013-10-28 18:40:48 -07:00