Commit Graph

65 Commits

Author SHA1 Message Date
Tony Murray
df5096e449
Install: Validate database before migrating (#12867)
* Validate database during install
Needed to remove usages of legacy functions in the validation

* Fix output, restore real versions
2021-05-13 07:18:54 -05:00
Tony Murray
1c379dcd05
Remove legacy function calls (#12651)
* massive inlines

* fix style and wtf

* remove rrdtool.inc.php include

* fix CommonFunctions namespace issues

* looking for missing class space, fix undefined class issues

* style fixes
2021-03-29 00:25:30 +02:00
Jellyfrog
20b4215204
Swich links to https (#12511)
* Switch librenms links to https

* Convert librenms links in comments

* Switch gnu.org url to https

* switch php urls to https
2021-02-09 00:29:04 +01:00
Tony Murray
1e4702fa4f
Support multiple daily process locking backends with distributed polling (#11896)
* Implement locks in the file cache

* Replace custom locks

* implement restore lock
Used when re-hydrating

* remove legacy use statements

* Add class descriptions

* Fix style

* Default to database cache driver

* missed cache_locks table
prevent chicken-egg issue

* style fixes

* Remove custom file lock implementation

* missed items from file cache

* Update schema definition
hmm, other schema noise must be from manual modification as this is generated from a freshly migrated db.

* require predis, it is pure python, so no harm in adding

* and set predis as the default client
2020-10-07 07:36:35 -05:00
Jellyfrog
0d56bbd946
Apply fixes from StyleCI (#12123) 2020-09-21 15:51:53 +02:00
Jellyfrog
82f43cb98d
Apply fixes from StyleCI (#12120) 2020-09-21 15:40:17 +02:00
louis-oui
945be18ea6 Always update widget seeds when db update (#10917)
* Always update seeds when db update WIP

* Only update widget seed
2020-01-22 15:03:12 -06:00
Tony Murray
c7c7b57de4
Always boot Laravel (#9842)
* Always boot Laravel
That way we can depend on it being available.
Saves us crashes if some code accidentally uses something that isn't booted and a lot of silly if/elses.

* ignore init php errors
2019-03-14 08:06:27 -05:00
Tony Murray
f1928461a8
Run both legacy schema and migrations in the same run if needed (#9686)
That way any new migrations get applied when needed
2019-01-17 11:37:14 -06:00
Tony Murray
10f6eac677
Validate database constraints (#9670)
* Validate database constraints

* Fix some differences with migrations

* Update functions.php
2019-01-17 08:59:42 -06:00
Paul Heinrichs
ebe2ecf524 Laravel migrations (#8868)
* Add migrations and seeds

* Fix spacing validation issues

* Fix linting

* Update tabs to spaces

* Update daily and install process

* Make build-base.php use the new migrations if empty or at dbschema 1000.
Seed 1000 into the database.
Temp fix for the route table index length (this table basically isn't used...)

* Fix typo in seed.
Hard code legacy schema checks to version 1000 (999 would have worked as is)

* Port association table no longer exists

* Make database validate again

* DB schema, remove as many DB::statement as possible

* update migrations
add librenms cli entry point (artisan)
update validate to check laravel migrations

* remove statements from users migration

* Fix up daily.sh and the 1000 migration

* Update migrations to current state
Take advantage of environment variables to set DB credentials.

* Fix style issues

* Update schema

* fix test db collation

* Fix migration table definition

* update db migrations

* Update migrations

* Update stats callback.  Just count the total migrations applied.

* Update 1000.sql.

* update migrations

* remove the graph type seeder, it is no longer needed

* update docs

* fix whitespace

* remove extra schema

* update tests

* fix sort

* add message

* dbSchema should actually be 1000

* add character set to db create

* Fix some artisan issues

* Update schema
2019-01-14 06:44:23 -06:00
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
FTBZ
dd8849d265 device: Added Rittal IT Chiller / Carel pCOweb card (#7826)
* device: Rittal IT Chiller / Carel pCOweb

* doc: more documentation about the pcoweb card

* Update Carel-pCOweb-Devices.md

* change the limit for sensors and small changes

* fixed db_schema

* doc updates and sql fix

* doc update

* remove the eer graph to create a sensor
2017-12-30 12:08:04 +00:00
Tony Murray
3dcadcccce
Allow empty schema files (#7840) 2017-12-01 14:10:32 -06:00
Tony Murray
2e73b75297 fix: Use memcached to lock daily processes on Distributed Pollers (#7735)
* fix: use memcached to lock daily processes on Distributed Pollers

* All the locks!
2017-11-24 09:37:52 +00:00
FTBZ
89ff05ebea newdevice: Added firewall graphs for Palo Alto Networks firewall (#7483)
* Features: Add firewall graphs for Palo Alto Networks firewall

* Features: Add firewall graphs for Palo Alto Networks firewall

* Update db_schema.yaml
2017-10-17 12:42: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
181b0fb7d5 refactor: Use the new locks for schema updates (#6931)
* Use the new locks for schema updates

* removed schema lock from discovery

* Add the ability to wait for a lock.
Add unit tests

* Add MysqlLock
Use that for the schema updates
Wait up to 30s for other schema updates to complete.

* Switch the schema lock back to a file lock for now.
Make FileLock support indefinite locking without polling.
Add a warning to MysqlLock for scenarios where it won't work.

* Delete MysqlLock.php

* Removed MySQL lock tests
2017-07-17 19:35:08 +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
Neil Lathwood
23fa26b2b1 fix schema update calling set_lock() (#6563) 2017-05-03 11:15:54 -05:00
Neil Lathwood
41e7689c77 refactor: DB Updates will now file level lock to stop duplicate updates (#6469)
* refactor: DB Updates will now file level lock to stop duplicate updates

* scrut fixes

* renamed function from clear_lock() to release_lock()
2017-05-03 14:48:23 +01:00
Tony Murray
72ce39cf9b refactor: schema updates (#6370)
Test the schema files with STRICT_TRANS_TABLES and fix any issues
2017-04-13 10:18:12 +01:00
Tony Murray
0f5091d273 fix: Alter the database to set the proper character set and collation (#6189) 2017-03-14 00:14:45 +00:00
Neil Lathwood
da5783d917 feature: Add mysql failed query logging + fixed queries that break ONLY_FULL_GROUP_BY (#5327)
* feature: Add mysql failed query logging + fixed queries that break ONLY_FULL_GROUP_BY

* fix all schema errors and update system
2017-01-07 11:32:38 -06:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
cc01969b06 refactor: Default to only using mysqli (#4915)
* refactor: Default to only using mysqli

* Remove includes/dbFacile.mysql.php

* updated mres() function to remove $config global
2016-11-10 19:40:53 -06:00
Neil Lathwood
45e41ad02e fix: New installs would have multiple entries in dbSchema table (#4460) 2016-09-16 18:20:34 -05:00
Neil Lathwood
7dec670494 refactor: Updated a lot of references to LibreNMS - copyright still left intact (#4339) 2016-09-08 08:12:23 -05:00
Tony Murray
9284bc60ff Update code in includes to be PSR-2 compliant (#4220)
refactor: Update code in /includes to be psr2 compliant #4220
2016-08-28 18:32:58 +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
e64d145bf1
Gracefully break update 2015-09-02 15:29:10 +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
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
da9e071d7d
Revert all PHP-Based MySQL Locks introduced in #1584 2015-09-02 14:46:42 +01:00
f0o
e11f613bdd
Pause polling and discovery if there's an update-lock 2015-09-01 14:14:50 +01:00
f0o
ccfdddeae6
Added lock release for schema updates even if it gets aborted or received sigterm 2015-09-01 12:41:38 +01:00
f0o
29887af376
Remain PHP Backwards compatibility 2015-08-26 08:44:15 +01:00
Clint Armstrong
33baea6d6a release schema lock 2015-08-25 11:35:25 -04:00
Clint Armstrong
38af8b4c4c return instead of exit 2015-08-25 11:35:25 -04:00
Clint Armstrong
d9efadb441 fix bailout comparison 2015-08-25 11:35:25 -04:00
Clint Armstrong
e74a6db216 move lock checks after bail out 2015-08-25 11:35:25 -04:00
Clint Armstrong
c5fcb87b51 bail if schema is already up to date 2015-08-25 11:35:24 -04:00
Clint Armstrong
1379a13c76 wait for all locks to be free when updating schema 2015-08-25 11:35:24 -04:00
Clint Armstrong
86e0f42dc7 bail out if we can't get a lock on schema_update 2015-08-25 11:35:24 -04:00
Mark Schouten
4792879ce5 Remove all unneeded if($debug)-statements and replace them with d_echo in the rest of the directories... 2015-08-21 16:10:01 +02:00
laf
a8c03ca786 Last fix 2015-08-12 19:55:37 +00:00
laf
4b49c148b6 Added mysqli support 2015-08-08 19:27:18 +00:00