Commit graph

39 commits

Author SHA1 Message Date
8ea1df920a Unify SQL timeouts
- Exec and lock timeouts now apply to MySQL
- Lock timeout now applies to PostgreSQL
- SQLite now uses a generic lock timeout setting which applies to all
2019-01-23 16:31:54 -05:00
5cd84c4ab4 Validate configuration parameters on import, and other changes
- Each parameter is checked for type and normalized
- Interval strings are converted to DateInterval objects
- Timeouts can be specified as interval strings
- Most intervals can be null to signify infinity
- Driver classes are checked that they implement the correct interface
- Short driver names may be used, and are used by default
- Helpful errors messages are printed in case of erroneous configuration

Exporting is currently broken; this will be fixed in an upcoming commit
2019-01-20 22:40:49 -05:00
81acba90dc Use strict equality when comparing strings 2019-01-11 10:38:06 -05:00
4ef36643a4 Proof-of-concept PDO MySQL driver
- Configuration options were added
- Non-transactional locking was added to the savepoint handlers
- Tests were adjusted for MySQL's reserved words
2018-12-20 18:06:28 -05:00
28f803dd28 Handle PostgreSQL connection errors 2018-12-12 11:15:07 -05:00
9e6f0460c2 Ensure the Lang class always exists when throwing exceptions 2018-11-06 12:48:31 -05:00
22cdc8916d Documentation tweaks and CS fixes 2017-11-29 22:42:50 -05:00
50185ab8f6 Change code and type of consantUnknown exception 2017-11-17 22:53:54 -05:00
c88b5c4f18 Make distinction between modified and marked for articles
Also added various sets of fields to include when listing articles.
2017-11-17 17:52:00 -05:00
6da86428c4 Added per-file legal boilerplate
Includes PHPDoc license tag in the file-level block with accompanying copyright notice.

Also added an AUTHORS file on the off chance of outside contributions
2017-11-16 20:51:03 -05:00
11b2066922 Added per-file legal boilerplate
Includes PHPDoc license tag in the file-level block with accompanying copyright notice.

Also added an AUTHORS file on the off chance of outside contributions
2017-11-16 20:23:18 -05:00
7d19a5add0 Merge from master 2017-11-06 15:58:26 -05:00
9304f99032 Make result sets single-use; change savewepoint exceptions
- Result sets are now single-use; this is required for PDO drivers (PDO result sets are not rewindable)
- Change savepoint exceptions to be simple database exceptions; codes remain the same
2017-11-05 22:13:44 -05:00
8c6c49d588 Merge changes from master 2017-10-19 22:58:42 -04:00
1271a0c8c0 Add ValueInfo::normalize method
This method provides generalized, consistent type casting more versatile than PHP's basic type juggling while hiding the significant complexity in achieving this.

While this commit does not change any existing code to use the new method, the intent is for both API handlers and database drivers to use the same basic rules for type conversion while still allowing for differing failure modes.
2017-10-19 15:18:58 -04:00
7b121c74ec Merge fixes from master 2017-09-26 20:25:11 -04:00
e74a3ae3cb Fix numerous bugs when adding or changing folders
- Specifying a non-integer parent no longer silently casts to 0 or 1
- Specifying a folder ID of 0 now always converts to null automatically
- Performing both a rename and move to root in the same operation no longer results in potential duplicates
- Calling folderSetProperties with an empty data array no peforms an update; it now returns false before the update call
- Modification timestamps are now actually updated when a folder is modified
- Constraint violation exceptions triggered by code (rather than the database) now print a message
- Renaming a folder or subscription to a non-string value (e.g. an array) throws an exception rather than silently casting
- Added tests to better cover all the above
- Centralized the normalization of integers and title strings into a new ValueInfo static class
2017-09-26 16:45:41 -04:00
474d32e54f Preliminary implementation of TTRSS sessions (needs tests; may not work) 2017-09-16 19:57:33 -04:00
f7e50fe95d Passed code through linter 2017-08-29 10:50:31 -04:00
da092d5f8c Changed Misc\DateFormatter to a collection of static methods and renamed it to Date; renamed Data to Arsse to avoid confusion and better reflect its centrality 2017-07-17 07:47:57 -04:00
ac73ed0e7f More tweaks
- Changed Data::$l to Data::$lang; it's not used enough to justify the possibly confusing shortening
- Made database auto-update a general rather than per-driver setting
- Added settings for forthcoming feed fetching service
2017-07-11 20:27:37 -04:00
7656de716b Feed tests: fetching and parsing 2017-05-27 18:15:52 -04:00
88c0f4986c Implement NCN API v1-2 feed handling: tests
- Fixes #8
- Fixes #9
- Fixes #10
- Fixes #11
- Fixes #12

- Differentiated between a missing ID which is the subject of an action (e.g. the subscription when moving a subscription) and other missing IDs (e.g. the folder when moving a subscription)
- Enforced same rules for subscription titles as for folder names, save that null is valid for subscriptions
2017-05-21 10:10:36 -04:00
8ebcb01cb5 Made out-of-order transaction handling more predictable 2017-05-07 18:27:16 -04:00
a111bcc231 Folder get/set prop funcs and other changes
- Simplified folder removal; now properly relies on foreign keys for dependency resolution
- simplified *propertiesSet() methods by offloading input validation and query building to a generic function
- Implemented function to get the properties of a single folder (useful for internal use)
- Implemented a function to set the properties of a folder
2017-04-01 10:27:26 -04:00
f902346b6c Eliminated passing of RuntimeData instances
- RuntimeData has now been replaced by a single static Data class
- The Data class has a load() method which fills the same role as the constructor of RuntimeData
- The static Lang class is now an instantiable class and is a member of Data
- All tests have been adjusted and pass
- The Exception tests no longer require convoluted workarounds: a simple mock  for Data::$l suffices; Lang tests also use a mock to prevent loops now instead of using a workaround
2017-03-28 18:50:00 -04:00
7236020b8b Changed "NewsSync" to "Arsse" 2017-03-27 23:12:12 -05:00
18c8076a0f Database update tests 2017-03-09 21:39:42 -05:00
a3e2da1d36 Flesh out most database exceptions
- Fixes #46
- Some exception messages are tentative pending testing
2017-03-08 12:29:22 -05:00
7c1df71acd Make db throw specific exceptions
Needs testing and fleshing out; not all exception codes and messages have been defined
2017-03-08 09:55:16 -05:00
fa247b34f6 Reduce the number of database exception types 2017-03-08 08:19:42 -05:00
7687109132 Reorganize Db namespace; alter User ns to match 2017-03-07 18:01:13 -05:00
eeb1818bb5 Still more database changes
- Restructured tests
- Localized driver name for SQLite driver (fixes #37)
- Ensured that binding type definitions are required
2017-03-03 13:20:26 -05:00
1529fc367a Partial proper tests for parameter bindings
Null and (>0) integer tested so far

Many related changes to accomodate the necessary type juggling (required for databases other than SQLite).
2017-03-02 14:19:16 -05:00
8a0d021622 More User tests and resultant fixes 2017-02-20 19:04:08 -05:00
e5d825d360 Started integration of PicoFeed
• Integrated PicoFeed into Database->subscriptionAdd
• Added exception handling for feeds
• Added static method for formatting SQL dates into Db/Common
2017-02-19 16:02:03 -06:00
8db31cf3e4 Tweaked Lang; added comments and tests
Tweaks:
- get() method can now report loaded and well as wanted locale
- msg() passed without vars still gets formatted to catch malformed strings
- set('en', false) followed by set('en', true) will now immediately load
- Lang::$synched was not getting set to true properly

Tests:
- Added test for get()
- Added test for malformed strings (exception code was missing)
- Added test for missing strings
- Added test for strings taking variables not being passed any variables
2017-02-16 17:50:34 -05:00
c5fac33398 Converted all hard tabs to soft tabs 2017-02-16 14:29:42 -06:00
c8274eca74 Moved base exception code to abstract class
This allows differentiating specific and general exceptions in tests; a library-wide trap would have to trap AbstractException
2017-02-11 14:56:02 -05:00