Refactor code & implement autoloader#2247
Conversation
|
I added some instance caching of results for a few static methods as well. I found out |
|
Thanks, very massive pull request, I will check it later.
|
|
|
|
In the current implementation we may have several user's profiles for the single ruTorrent instllation. And even if yes, then now we have strange situation, when configuration partially inside global variables and partially in the class declarations. This is not good thing IMHO. |
|
There is a problem with user specific |
|
I reverted the |
commit 319977d Merge: e8f0fef 6cc49f4 Author: Novik <Novik@users.noreply.github.com> Date: Wed Jan 12 15:52:14 2022 +0300 Merge pull request Novik#2261 from njutn95/patch-1 Fix the typo/syntax error in the static method call commit 6cc49f4 Author: njutn95 <njutn95@yahoo.com> Date: Wed Jan 12 13:01:27 2022 +0100 Fix the typo/syntax error in the static method call commit e8f0fef Merge: cc8d4b1 13a75f5 Author: Novik <Novik@users.noreply.github.com> Date: Mon Jan 10 14:43:22 2022 +0300 Merge pull request Novik#2254 from Micdu70/patch-7 Fix task.php commit 13a75f5 Author: Micdu70 <Micdu70@gmx.fr> Date: Mon Jan 10 12:42:10 2022 +0100 Fix task.php commit cc8d4b1 Merge: 25580d7 fec4bdd Author: Novik <Novik@users.noreply.github.com> Date: Mon Jan 10 12:36:59 2022 +0300 Merge pull request Novik#2253 from stickz/Namespace-Fix Fix loading utility classes from namespaces commit fec4bdd Author: stickz <stickman002@mail.com> Date: Mon Jan 10 04:01:07 2022 -0500 Fix PHP Notice commit 25580d7 Author: Novik <novik65@gmail.com> Date: Mon Jan 10 11:28:42 2022 +0300 fix context menu error commit 2897543 Merge: 795bd19 bcea8a6 Author: Novik <Novik@users.noreply.github.com> Date: Mon Jan 10 11:07:21 2022 +0300 Merge pull request Novik#2252 from Micdu70/patch-11 Add 'copyToClipboard' function in common.js + a few fixes commit d92e194 Author: stickz <stickman002@mail.com> Date: Mon Jan 10 02:53:31 2022 -0500 Go to end of exploded array instead commit bcea8a6 Author: Micdu70 <Micdu70@gmx.fr> Date: Sat Jan 8 19:04:30 2022 +0100 Add 'copyToClipboard' function in common.js + a few fixes commit d12228d Author: stickz <stickman002@mail.com> Date: Mon Jan 10 01:27:00 2022 -0500 Fix loading utility classes commit 795bd19 Merge: 0d44ec9 27e4882 Author: Novik <Novik@users.noreply.github.com> Date: Sun Jan 9 14:20:14 2022 +0300 Merge pull request Novik#2241 from stickz/MemoryLeakFixes Improve memory management commit 0d44ec9 Merge: fd35e22 db16d33 Author: Novik <Novik@users.noreply.github.com> Date: Sun Jan 9 14:07:37 2022 +0300 Merge pull request Novik#2247 from stickz/Utility2 Refactor code & implement autoloader commit db16d33 Author: stickz <stickman002@mail.com> Date: Sat Jan 8 18:49:52 2022 -0500 Fix json.php commit fd35e22 Merge: be26ce3 0d91672 Author: Novik <Novik@users.noreply.github.com> Date: Fri Jan 7 14:24:08 2022 +0300 Merge pull request Novik#2251 from Micdu70/patch-11 Fix 'check_port' and 'extsearch' plugins commit 0d91672 Author: Micdu70 <Micdu70@gmx.fr> Date: Fri Jan 7 10:46:15 2022 +0100 Fix 'check_port' and 'extsearch' plugins commit d815e75 Author: stickz <stickman002@mail.com> Date: Thu Jan 6 16:53:14 2022 -0500 Fix third party plugin compatibility commit 2ec6b86 Author: stickz <stickman002@mail.com> Date: Thu Jan 6 16:22:21 2022 -0500 Remove $user arg for paths commit 3f60a43 Author: stickz <stickman002@mail.com> Date: Thu Jan 6 16:12:12 2022 -0500 Remove ruTorrentConfig commit df7c0d0 Author: stickz <stickman002@mail.com> Date: Thu Jan 6 16:09:17 2022 -0500 Fix whitespaces commit 9f3aee8 Author: stickz <stickman002@mail.com> Date: Thu Jan 6 16:06:41 2022 -0500 Revert ruTorrentConfig class commit be26ce3 Merge: 9be549f 28fa12c Author: Novik <Novik@users.noreply.github.com> Date: Mon Jan 3 13:20:19 2022 +0300 Merge pull request Novik#2249 from Micdu70/patch-11 Fix Novik#2248 commit 28fa12c Author: Micdu70 <Micdu70@gmx.fr> Date: Mon Jan 3 10:25:41 2022 +0100 Fix Novik#2248 commit c63b61a Author: stickz <stickman002@mail.com> Date: Sun Jan 2 21:55:53 2022 -0500 Refactor more code commit 6429984 Author: stickz <stickman002@mail.com> Date: Sun Jan 2 13:03:15 2022 -0500 Refactor code commit 27e4882 Author: stickz <stickman002@mail.com> Date: Thu Dec 30 01:20:31 2021 -0500 Improve memory management
This pull request refactors the ruTorrent utility code to reduce script execution times and improve overall code readability. It moves all of the functions in
php/util.phpout of the global context and into classes. When the utility file is included, only the required functionality is added is each time. This prevents loading of unnecessary functionality for PHP scripts.It implements a very basic auto loader function to simplify the including process of utility classes. The only file which needs to be included is
php/util.php. When a utility class is used, PHP will automatically go to the/php/utilityfolder to include the file.Utility class names can have any mixture of lower or upper case letters. However, the files in the utility folder:
.php.Other Notes:
The default value of
profilePathvariable had to be changed from../shareto../../share.The reason is because it accessed fromfileutil.phpin/php/utilitynow instead ofutil.phpin/php. The folder context is different to reach the root folder.In the
sqlite_exists()function in/plugins/geoip/sqlite.phpthe second argumentclass_existshad to be changed fromtruetofalse. It may be required to update thespl_autoload_register()function, if SQLite3 does not automatically load.