mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-10 16:47:27 -07:00
* refactor(censor): migrate Censor class to singleton pattern - Convert TorrentPier\Censor to singleton pattern following Config class design - Add global censor() helper function for consistent API access - Replace all global $wordCensor declarations and usage across 12 files - Implement automatic reload functionality in admin panel - Add enhanced methods: isEnabled(), addWord(), getWordsCount(), reload() Files updated: - src/Legacy/Atom.php, src/Legacy/Post.php - viewforum.php, posting.php, search.php, index.php, viewtopic.php, privmsg.php - library/ajax/posts.php, library/includes/bbcode.php, library/includes/ucp/topic_watch.php - admin/admin_words.php, library/includes/init_bb.php - common.php (added global helper) - UPGRADE_GUIDE.md (documentation) Benefits: - Single instance shared across application for better performance - Memory efficient word loading only when censoring enabled - Consistent API pattern matching config() singleton - Automatic word reloading when admin updates censored words - Enhanced developer experience with new utility methods BREAKING CHANGE: None - full backward compatibility maintained. The global $wordCensor variable continues to work as before. New censor() function is the recommended approach going forward. * refactor(censor): add enable check to censorString method * refactor(dev): convert Dev class to singleton pattern (#1955) * refactor(dev): convert Dev class to singleton pattern - Convert TorrentPier\Dev class from direct instantiation to singleton pattern - Add getInstance() method and private constructor for singleton implementation - Introduce new instance methods with improved naming: * getSqlDebugLog() (replaces getSqlLog()) * checkSqlDebugAllowed() (replaces sqlDebugAllowed()) * formatShortQuery() (replaces shortQuery()) - Add dev() global helper function for consistent access pattern - Maintain full backward compatibility with existing static method calls - Update all internal usage across 18 files to use new singleton pattern: * src/Ajax.php, src/Legacy/SqlDb.php * All Cache classes (APCu, File, Memcached, Redis, Sqlite, Common) * All Datastore classes (APCu, File, Memcached, Redis, Sqlite, Common) * library/includes/page_footer_dev.php - Implement lazy initialization consistent with Config and Censor singletons - Add comprehensive migration guide in UPGRADE_GUIDE.md This refactoring improves resource management, provides consistent API patterns across all singleton classes, and maintains zero breaking changes for existing code. * refactor(dev): Added missing `\TorrentPier\Dev::init()` --------- Co-authored-by: Roman Kelesidis <roman25052006.kelesh@gmail.com> |
||
---|---|---|
.. | ||
avatar.php | ||
callseed.php | ||
change_tor_status.php | ||
change_torrent.php | ||
change_user_opt.php | ||
change_user_rank.php | ||
edit_group_profile.php | ||
edit_user_profile.php | ||
ffprobe_info.php | ||
group_membership.php | ||
index_data.php | ||
manage_admin.php | ||
manage_user.php | ||
mod_action.php | ||
passkey.php | ||
post_mod_comment.php | ||
posts.php | ||
sitemap.php | ||
thanks.php | ||
topic_tpl.php | ||
user_register.php | ||
view_post.php | ||
view_torrent.php |