Commit Graph

21 Commits

Author SHA1 Message Date
frytimo b5af974d34
Add backslash to the trim command (#7338) 2025-03-26 14:56:55 -06:00
frytimo c165afc53e
Fix trim command on interface name (#7336) 2025-03-26 13:11:37 -06:00
frytimo 1572c76963
Use regex in autoloader instead of include (#7322) 2025-03-17 10:01:11 -06:00
frytimo 0a42d8f198
Add caching to the auto_loader for interfaces (#7320)
* update auto loader to load and cache interfaces

* use new method to update the auto loader cache

* use new interface

* use new interface to trigger a cache flush

* update the console upgrade menu

* update the missing implements syntax

* add the clear_cache to the flush cache button
2025-03-15 09:13:36 -06:00
FusionPBX 31a88e3a15
Update auto_loader.php 2025-03-12 14:48:33 -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
frytimo f8e1e81546
fix wrong logical check (#7282)
Forgot to remove the '!' (not) operator from the cache check when re-organizing the update cache function
2025-02-27 21:09:31 -07:00
frytimo d919a3cc1b
Add the apcu caching ability for performance (#7276)
* add the apcu caching ability for performance
When the PHP extension APCu is loaded, the settings class and the auto_loader will cache their results across requests in RAM. For more information about the APCu extension visit the PHP page: https://www.php.net/apcu

* use global instead of default terminology
2025-02-25 17:21:41 -07:00
frytimo fd34a000a6
Add old search method for auto loading classes (#7261)
Adding this commit to ensure backwards compatibility and a fail-safe mechanism for loading a class
2025-02-20 11:24:39 -07:00
frytimo 5e6ec475df
update auto_loader cache file when updating (#7255) 2025-02-15 10:44:46 -07:00
FusionPBX c4aa9e9b02
Update the cache after loading classes array 2025-02-13 15:05:27 -07:00
frytimo 0931197137
build array in auto_loader constructor (#7158)
* Build an array in the auto_loader constructor

* Update auto_loader.php

* Update auto_loader.php

* minor adjustment to name and comment and remove trailing closing tag

* use best practices for the loader method
Allowing the loader method:
- Should Never Be Called Manually
- Prevents External Modification
- Hides Implementation Details

* cache array in the temp folder and load if available

* re-organize functions within the class

* add cache recreation for auto_loader in upgrade_menu

* add cache recreation for auto_loader in upgrade_menu

* Update app_languages.php
2025-02-13 14:48:40 -07:00
frytimo 5fda9b2dda
allow auto_loader to search in traits directories (#7005)
Co-authored-by: Tim Fry <tim@fusionpbx.com>
2024-06-11 10:17:02 -06:00
frytimo aeee90d56e
update auto_loader to use magic dir constant (#6963) 2024-04-26 13:49:56 -06:00
FusionPBX 63d215192d
Use an array in auto_loader
- Added a search for interfaces
- Updated the indentation
2024-03-21 10:33:05 -06:00
fusionate 6d4463a5b7
Auto Loader [Class]: Updates for PHP 8.1 2023-05-10 22:39:48 +00:00
fusionate 4de76b44f2
Auto Loader [Class]: Updates for PHP 8.1 2023-05-10 22:37:47 +00:00
FusionPBX edb12399ce
Add not empty debug 2023-05-08 17:21:52 -06:00
frytimo 2bdf0d382e
add isset($_REQUEST['debug']) before testing value for true (#6486)
Co-authored-by: Tim Fry <tim@voipstratus.com>
2022-10-19 11:49:31 -06:00
FusionPBX ad3a4825a1
Use a log prefix that makes more sense. 2022-06-01 18:57:33 -06:00
FusionPBX 91f2721925
Create auto_loader.php 2021-11-26 13:11:20 -07:00