154 Commits

Author SHA1 Message Date
FusionPBX
94be0f3c01 Add try-catch around beginTransaction and commit
Added try-catch blocks around the save and delete methods.
2025-08-21 09:55:33 -06:00
FusionPBX
96275ed9c1 Fix transactions to save the domain_uuid
Symptom
Advanced -> Transactions showed as global when it should have shown the correct domain. This was failing when saving a new record.
2025-07-03 09:16:26 -06:00
FusionPBX
aa6bc173a7 Update database.php 2025-07-03 08:30:53 -06:00
FusionPBX
58e69d2596 Fix the user_uuid using database::new() 2025-07-03 08:13:46 -06:00
FusionPBX
d583e8352d Use more intuitive names 2025-04-07 14:48:47 -06:00
FusionPBX
6c6814b29e Remove syntax that breaks older PHP
Removed :static to support PHP 7.4
2025-03-12 23:39:24 -06:00
frytimo
08001488f4 Allow namespace in auto loader (#7307)
* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove class_exists wrapper for class definitions

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove include statement of class file

* remove closing tag

* remove invalid method params

* remove closing tag

* remove closing tag

* Update auto_loader to load each class file in the project
Update the auto_loader class to use an include statement on each file in the project to load the class within the file. This will allow mismatched names within the file to be loaded and mapped according to the declaration instead of the filename. The class is then checked against the parsed classes from the PHP engine so that namespaces are available and mapped to the file they were declared in. An update was also made to the search algorithm used to find a file that was not already loaded by collapsing the array to have only valid matches to increase performance on a cache miss. Logging within the auto_loader has been moved to a function.
Multiple files were modified to allow the include statement. When the class has the `if(class_exists())` statement, the auto_loader is called to check for the class. This caused an infinite loop scenario so all wrappers have been removed. The auto_loader will now break the loop by directly modifying the internal classes array instead of trying to restart with the 'reload_classes' method.

- APCu is used to cache classes so any loading of the classes is done only once. To clear the APCu cache, restart php-fpm or call the auto_loader::clear_cache() function.
- Cache file is used when APCu is not available. To clear the cache remove it from the tmp folder or call the auto_loader::clear_cache() function.
- All classes must no longer have a class_exists wrapper to benefit from the performance boost.
- Classes should not be directly included when the auto_loader is used.

* remove include statement of class file

* Update destinations.php
2025-03-12 13:55:47 -06:00
FusionPBX
b8b796316e Add method column_exists to the database class 2025-01-28 15:35:02 -07:00
frytimo
f6adc9bdd0 suppress access on null php notice in new is_connected method (#7227) 2025-01-23 12:38:03 -07:00
frytimo
95faf83337 add is_connected method to database (#7225) 2025-01-23 11:42:19 -07:00
FusionPBX
18bce0437d Add more debug details and return false 2025-01-22 20:35:53 -07:00
FusionPBX
7e4f82f840 Enhance message array debug details 2025-01-22 20:07:02 -07:00
FusionPBX
8ea79e56e7 Replace exit; with return false; 2025-01-22 19:26:25 -07:00
frytimo
2cbb4dbc31 remove instances where a pointer is used in a foreach loop for value (#7108) 2024-08-22 12:41:10 -06:00
FusionPBX
ba3ab5a8c9 Use parent_name as its more intuitive
Also replace $this->name with $this->app_name
2024-08-06 17:07:16 -06:00
FusionPBX
c960575796 Update database.php 2024-08-06 11:28:32 -06:00
FusionPBX
46bbb31391 Update database.php
- preset empty values for variables and arrays
- use $table_name instead of $this->name
2024-08-06 02:52:55 -06:00
FusionPBX
b3f31af5a8 If data is global then domain_uuid set to null
This means transaction is global. If there is a domain_uuid use the domain ID from the data.
2024-08-01 18:02:15 -06:00
Antonio Fernandez
dcf1f9d17c Update database.php (#7053)
Fix for table_exists method on mysql
2024-07-18 12:10:05 -06:00
frytimo
a863faaae2 fix the user_uuid missing from transaction tables (#7026)
Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-06-27 11:26:16 -06:00
frytimo
f0a80426eb add function to return the config object used to create the database object (#6998)
Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-06-08 09:57:33 -06:00
FusionPBX
d9c92c00e9 Update database.php add comments 2024-05-02 06:40:30 -06:00
FusionPBX
0c08780ca2 Update database.php 2024-04-27 19:29:50 -06:00
frytimo
0b8edef82c Config class rewrite (#6965)
* Use a singleton pattern in the database class to re-use the database object inside the permission_exists function.
2024-04-27 19:22:20 -06:00
FusionPBX
2a1e36ca02 Add apps as a class variable
- Use self:$apps
- Replace $_SESSION['apps']
2024-04-19 11:07:30 -06:00
FusionPBX
768937b624 Update database.php
- Allow sending $params into the constructor.
- Add paramaters: domain_uuid and user_uuid
- Replace $user_uuid and the session variable with $this->user_uuid
- Use the SESSION as an alternative to the parameter
2024-04-19 09:48:05 -06:00
frytimo
758cb2ec60 set to compare instead of assignment in the message error checking (#6933) 2024-03-28 22:07:04 -06:00
FusionPBX
4ed611a187 When the toggle field and values are empty then use defaults 2023-08-15 21:37:05 -06:00
FusionPBX
4bf775897e Replace GLOB_BRACE as its not supported by all systems. 2023-08-14 11:27:40 -06:00
fusionate
ceb0637c83 Database [Class]: Update for PHP 8.1 2023-07-05 23:12:00 +00:00
FusionPBX
ec04006971 Change the scope of the database variables 2023-06-28 15:29:28 -06:00
FusionPBX
bcf7cbaad2 Save database errors to the message variable 2023-06-19 16:08:54 -06:00
markjcrane
1452bde1ac Update the database class to find the require.php 2023-06-17 22:29:15 -06:00
markjcrane
32051873be Use __dir__ to find resources/require.php 2023-06-16 22:49:09 -06:00
fusionate
8b982dd6e3 Database [Class]: Modify copy() method to support enable and description fields without the table name. 2023-06-09 19:42:10 +00:00
FusionPBX
7979ff145b Use $this->message
Reason for using this message rather than local message variable is that it get changed and the information we want is preserved in the class variable.
2023-05-26 09:55:18 -06:00
fusionate
6119f7de7d Database [Class]: Update for PHP 8.1 2023-05-25 15:40:20 +00:00
markjcrane
251feddff8 Return this->message variable as array. 2023-05-24 23:00:08 -06:00
fusionate
dfdcba5a0c Database [Class]: Update for PHP 8.1 2023-05-23 02:42:19 +00:00
markjcrane
7ee2b7c4b3 Add parentheses to empty string detection 2023-05-22 16:26:01 -06:00
markjcrane
a419fa985b Use isset when empty as it could be numeric. 2023-05-22 16:16:58 -06:00
fusionate
67e77560a6 Database [Class]: Updates for PHP 8.1 2023-05-21 01:13:45 +00:00
fusionate
878e83fc80 Database [Class]: Updates for PHP 8.1 2023-05-20 23:57:07 +00:00
FusionPBX
25fdc12f18 Strict identical condition required
Otherwise this condition matches a numeric value of 0.
2023-05-19 15:29:38 -06:00
FusionPBX
778b5832be database save method returns result details 2023-05-18 16:29:03 -06:00
markjcrane
0dec70827d Change approach for handling the user_uuid 2023-05-18 00:49:20 -06:00
fusionate
1618c84e07 Database [Class]: Fix typo. 2023-05-17 20:36:48 +00:00
markjcrane
6d7e125743 Fix all PHP 8.1 messages for upgrade.php 2023-05-17 10:07:49 -06:00
FusionPBX
64c159931c Update database.php strlen replace with isset
Used isset instead of empty because empty treats a numeric value of 0 as empty.
2023-05-13 22:13:40 -06:00
FusionPBX
7a8b2b7d79 Update database.php prevent more php 8.1 warnings. 2023-05-13 12:35:17 -06:00