Commit graph

4136 commits

Author SHA1 Message Date
Roman Kelesidis
6e7e3dd9ef
fix: handle Nette DateTime objects in birthday validation (#2032)
Some checks failed
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
PHPMD / Run PHPMD scanning (push) Has been cancelled
* fix: handle Nette DateTime objects in birthday validation

* Update register.php

* Update User.php
2025-07-03 23:07:09 +02:00
Roman Kelesidis
423fb65dbf
release: v2.8.3
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-07-03 10:51:21 +03:00
Roman Kelesidis
51f2c70d81
feat(updater): Added exceptions logging (#2026)
* feat(updater): Added exceptions logging
* refactor(updater): Use `sha256` hash if available
2025-07-03 10:48:25 +03:00
Roman Kelesidis
fd46d3d04a
feat(lang): Added RTL languages support (#2031) 2025-07-03 10:43:02 +03:00
Roman Kelesidis
d4d82101dd
refactor(TorrentFileList): Reduce duplication in root directory unset logic (#2027) 2025-07-03 10:40:56 +03:00
Roman Kelesidis
9e3f3588f2
release: v2.8.2
Some checks failed
PHPMD / Run PHPMD scanning (push) Has been cancelled
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
2025-06-30 10:49:42 +03:00
Roman Kelesidis
915e1d817c
fix(TorrentFileList): Avoid array_merge reindexing for numeric folder names (#2014)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
Co-authored-by: zxc <17812947+metalwarrior88@users.noreply.github.com>
2025-06-29 15:03:56 +03:00
Roman Kelesidis
7ac335974b
refactor: Use DEFAULT_CHARSET constant instead of hardcoded string (#2011)
Some checks failed
PHPMD / Run PHPMD scanning (push) Has been cancelled
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
2025-06-26 13:32:45 +03:00
Roman Kelesidis
c2e3a13a04
release: v2.8.1 2025-06-24 13:00:37 +03:00
Roman Kelesidis
f1d6e74e5d
fix(ip-api): Add error handling and logging for freeipapi.com requests (#2006) 2025-06-24 12:55:41 +03:00
Roman Kelesidis
7f4cc9d3b9
fix(filelist): Undefined property: FileTree::$length when v2 torrent only (#2004) 2025-06-23 21:49:53 +03:00
Roman Kelesidis
a0fc2a9da9
release: v2.8.0
Some checks failed
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
PHPMD / Run PHPMD scanning (push) Has been cancelled
2025-06-21 22:16:28 +03:00
Yury Pikhtarev
c6076c2c27
fix(template): handle L_ variables in template vars when not found in lang vars (#1998)
Template variables starting with L_ (like L_MY_PROFILE) are now properly
resolved when they exist in template variables but not in language variables.
Previously, these would fall back to showing the literal variable name.

The L_ variable regex now checks both $L (language) and $V (template) arrays
before falling back to the literal string, maintaining backward compatibility
while fixing composite language variables set via template assignment.
2025-06-21 22:13:01 +03:00
Roman Kelesidis
714dd6255e
release: v2.7.0 🐈‍⬛
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-06-21 10:52:01 +03:00
Roman Kelesidis
9b322c7093
chore: Update minimum PHP requirement to 8.2 (#1987)
* chore: Update minimum PHP requirement to 8.2

* chore: Update PHP version references to 8.2 in documentation and templates

* chore: Update issue template labels to array format for consistency

* refactor: Changed `local` environment name to `development`

* chore(composer.json): Changed version of `gemorroj/m3u-parser` package

* chore(composer): Removed `matthiasmullie/scrapbook` package

* fix(template): Update variable fallback behavior to return empty string for missing variables

---------

Co-authored-by: Yury Pikhtarev <exileum@icloud.com>
2025-06-21 11:45:56 +04:00
Roman Kelesidis
423424e947
chore: Removed useless composer update from workflows & installer (#1986) 2025-06-21 09:25:43 +03:00
belomaxorka
27b5815aee changelog: Update CHANGELOG.md 📖 2025-06-21 01:39:56 +00:00
Yury Pikhtarev
bccbad0c57
New Crowdin updates (#1983)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
* New translations main.php (Romanian)

* New translations main.php (French)

* New translations main.php (Spanish)

* New translations main.php (Afrikaans)

* New translations main.php (Arabic)

* New translations main.php (Belarusian)

* New translations main.php (Bulgarian)

* New translations main.php (Catalan)

* New translations main.php (Czech)

* New translations main.php (Danish)

* New translations main.php (German)

* New translations main.php (Greek)

* New translations main.php (Finnish)

* New translations main.php (Hebrew)

* New translations main.php (Hungarian)

* New translations main.php (Armenian)

* New translations main.php (Italian)

* New translations main.php (Japanese)

* New translations main.php (Georgian)

* New translations main.php (Korean)

* New translations main.php (Lithuanian)

* New translations main.php (Dutch)

* New translations main.php (Norwegian)

* New translations main.php (Polish)

* New translations main.php (Russian)

* New translations main.php (Slovak)

* New translations main.php (Slovenian)

* New translations main.php (Albanian)

* New translations main.php (Serbian (Cyrillic))

* New translations main.php (Swedish)

* New translations main.php (Turkish)

* New translations main.php (Ukrainian)

* New translations main.php (Chinese Traditional)

* New translations main.php (English)

* New translations main.php (Vietnamese)

* New translations main.php (Portuguese, Brazilian)

* New translations main.php (Indonesian)

* New translations main.php (Thai)

* New translations main.php (Croatian)

* New translations main.php (Kazakh)

* New translations main.php (Estonian)

* New translations main.php (Latvian)

* New translations main.php (Azerbaijani)

* New translations main.php (Hindi)

* New translations main.php (Bosnian)

* New translations main.php (Uzbek)

* New translations main.php (Tajik)

* New translations admin_send_email.html (Japanese)

* New translations admin_send_email.html (Chinese Traditional)

* New translations admin_send_email.html (Portuguese, Brazilian)

* New translations group_added.html (Spanish)

* New translations group_added.html (Japanese)

* New translations group_added.html (Chinese Traditional)

* New translations group_added.html (Thai)

* New translations group_approved.html (Spanish)

* New translations group_approved.html (Japanese)

* New translations group_approved.html (Chinese Traditional)

* New translations group_approved.html (Thai)

* New translations group_request.html (Chinese Traditional)

* New translations privmsg_notify.html (Spanish)

* New translations privmsg_notify.html (Japanese)

* New translations privmsg_notify.html (Chinese Traditional)

* New translations profile_send_email.html (Spanish)

* New translations profile_send_email.html (Japanese)

* New translations profile_send_email.html (Thai)

* New translations topic_notify.html (Spanish)

* New translations topic_notify.html (Chinese Traditional)

* New translations topic_notify.html (Thai)

* New translations user_activate.html (Spanish)

* New translations user_activate.html (Chinese Traditional)

* New translations user_activate_passwd.html (Spanish)

* New translations user_activate_passwd.html (Japanese)

* New translations user_activate_passwd.html (Chinese Traditional)

* New translations user_activate_passwd.html (Portuguese, Brazilian)

* New translations user_activate_passwd.html (Thai)

* New translations user_welcome.html (German)

* New translations user_welcome.html (Chinese Traditional)

* New translations user_welcome.html (Portuguese, Brazilian)

* New translations user_welcome.html (Thai)

* New translations user_welcome_inactive.html (Spanish)

* New translations user_welcome_inactive.html (Chinese Traditional)

* New translations user_welcome_inactive.html (Portuguese, Brazilian)

* New translations user_welcome_inactive.html (Thai)

* New translations copyright_holders.html (Chinese Traditional)

* New translations copyright_holders.html (Thai)

* New translations sidebar2.html (Romanian)

* New translations sidebar2.html (French)

* New translations sidebar2.html (Spanish)

* New translations sidebar2.html (Afrikaans)

* New translations sidebar2.html (Arabic)

* New translations sidebar2.html (Belarusian)

* New translations sidebar2.html (Bulgarian)

* New translations sidebar2.html (Catalan)

* New translations sidebar2.html (Czech)

* New translations sidebar2.html (Danish)

* New translations sidebar2.html (German)

* New translations sidebar2.html (Greek)

* New translations sidebar2.html (Finnish)

* New translations sidebar2.html (Hebrew)

* New translations sidebar2.html (Hungarian)

* New translations sidebar2.html (Armenian)

* New translations sidebar2.html (Italian)

* New translations sidebar2.html (Japanese)

* New translations sidebar2.html (Georgian)

* New translations sidebar2.html (Korean)

* New translations sidebar2.html (Lithuanian)

* New translations sidebar2.html (Dutch)

* New translations sidebar2.html (Norwegian)

* New translations sidebar2.html (Polish)

* New translations sidebar2.html (Russian)

* New translations sidebar2.html (Slovak)

* New translations sidebar2.html (Slovenian)

* New translations sidebar2.html (Albanian)

* New translations sidebar2.html (Serbian (Cyrillic))

* New translations sidebar2.html (Swedish)

* New translations sidebar2.html (Turkish)

* New translations sidebar2.html (Ukrainian)

* New translations sidebar2.html (Chinese Traditional)

* New translations sidebar2.html (English)

* New translations sidebar2.html (Vietnamese)

* New translations sidebar2.html (Portuguese, Brazilian)

* New translations sidebar2.html (Indonesian)

* New translations sidebar2.html (Thai)

* New translations sidebar2.html (Croatian)

* New translations sidebar2.html (Kazakh)

* New translations sidebar2.html (Estonian)

* New translations sidebar2.html (Latvian)

* New translations sidebar2.html (Azerbaijani)

* New translations sidebar2.html (Hindi)

* New translations sidebar2.html (Bosnian)

* New translations sidebar2.html (Uzbek)

* New translations sidebar2.html (Tajik)

* New translations user_agreement.html (Thai)

* New translations main.php (Russian)

* New translations sidebar2.html (Russian)

* New translations main.php (Russian)

* New translations main.php (Ukrainian)

* New translations main.php (Romanian)

* New translations main.php (French)

* New translations main.php (Spanish)

* New translations main.php (Afrikaans)

* New translations main.php (Arabic)

* New translations main.php (Belarusian)

* New translations main.php (Bulgarian)

* New translations main.php (Catalan)

* New translations main.php (Czech)

* New translations main.php (Danish)

* New translations main.php (German)

* New translations main.php (Greek)

* New translations main.php (Finnish)

* New translations main.php (Hebrew)

* New translations main.php (Hungarian)

* New translations main.php (Armenian)

* New translations main.php (Italian)

* New translations main.php (Japanese)

* New translations main.php (Georgian)

* New translations main.php (Korean)

* New translations main.php (Lithuanian)

* New translations main.php (Dutch)

* New translations main.php (Norwegian)

* New translations main.php (Polish)

* New translations main.php (Russian)

* New translations main.php (Slovak)

* New translations main.php (Slovenian)

* New translations main.php (Albanian)

* New translations main.php (Serbian (Cyrillic))

* New translations main.php (Swedish)

* New translations main.php (Turkish)

* New translations main.php (Ukrainian)

* New translations main.php (Chinese Traditional)

* New translations main.php (English)

* New translations main.php (Vietnamese)

* New translations main.php (Portuguese, Brazilian)

* New translations main.php (Indonesian)

* New translations main.php (Thai)

* New translations main.php (Croatian)

* New translations main.php (Kazakh)

* New translations main.php (Estonian)

* New translations main.php (Latvian)

* New translations main.php (Azerbaijani)

* New translations main.php (Hindi)

* New translations main.php (Bosnian)

* New translations main.php (Uzbek)

* New translations main.php (Tajik)
2025-06-21 03:52:59 +04:00
Yury Pikhtarev
728116d6dc
refactor(stats): improve database row fetching in tr_stats.php (#1985)
- Updated the method of fetching rows from the database to use a more streamlined approach with `DB()->fetch_row()`.
- Extracted the first column value directly from the result array for clarity and maintainability.
2025-06-21 03:34:11 +04:00
Yury Pikhtarev
a33574c28f
feat(language): add new language variable for migration file and enhance template fallback logic (#1984)
* feat(language): add new language variable for migration file and enhance template fallback logic

- Introduced a new language variable 'MIGRATIONS_FILE' to improve migration management clarity.
- Updated template handling to provide graceful fallbacks for missing language and regular variables, ensuring better user experience and debugging capabilities.
- Added comprehensive unit tests to validate the new fallback logic and ensure existing functionality remains intact.

* refactor(tests): remove debugging test for compiled template output

- Removed the test case that debugged compiled output for troubleshooting in the TemplateGracefulFallbackTest.
- This change streamlines the test suite by focusing on essential functionality, specifically the handling of missing language variables.

* feat(tests): introduce executeTemplate function for streamlined template execution

- Added a new helper function `executeTemplate` to encapsulate the logic for executing compiled templates, improving code readability and reducing duplication in unit tests.
- Updated existing tests in `TemplateGracefulFallbackTest.php` to utilize the new function, ensuring consistent handling of template execution and variable scope.
- Enhanced test coverage by adding edge case scenarios for variable handling, including special characters, empty values, and nested braces.
2025-06-21 03:09:59 +04:00
Roman Kelesidis
e9a9e09576
chore: Added --no-dev composer flag for some workflows (#1982) 2025-06-20 22:39:17 +03:00
Roman Kelesidis
e8cba5dd3f
chore: Added --no-dev composer flag for some workflows (#1981) 2025-06-20 22:27:34 +03:00
Yury Pikhtarev
4f9cc9fe0f
fix(database): update affected rows tracking in Database class (#1980)
* fix(database): update affected rows tracking in Database class

- Enhanced the logic for tracking affected rows in the Database class to accurately reflect the number of rows modified by INSERT, UPDATE, and DELETE operations using the getRowCount() method.
- Added a new unit test suite for the affected_rows method, ensuring comprehensive coverage for various scenarios including tracking of affected rows and validation of the last_affected_rows property.

This update improves the reliability of the Database class's affected rows reporting, facilitating better data handling and debugging.

* feat(install): add developer prompt for dependency installation

- Introduced a prompt during the installation process to ask users if they require development tools and dependencies.
- Adjusted the dependency installation command to conditionally include or exclude development dependencies based on user input.
- Added warnings for users with PHP versions below 8.2 when opting for development dependencies.

This enhancement improves the installation experience by allowing developers to easily set up their environment while ensuring compatibility checks are in place.

* docs(README): clarify PHP version requirements and installation instructions

- Updated PHP version requirements to specify that PHP 8.2+ is required for development dependencies.
- Enhanced installation instructions to differentiate between production and development setups, including commands for Composer installation.
- Added a note regarding the necessity of PHP 8.2+ for running tests, improving clarity for developers.

These changes aim to provide clearer guidance for users setting up their development environments.
2025-06-20 23:06:36 +04:00
Yury Pikhtarev
cc9d412522
feat(test): add comprehensive testing infrastructure with Pest PHP (#1979)
* feat(tests): integrate Pest testing framework and set up initial test structure

- Added Pest as a development dependency for enhanced testing capabilities.
- Created a PHPUnit configuration file (`phpunit.xml`) for test suite management.
- Established a base test case class (`TestCase.php`) for consistent test structure.
- Implemented example tests in both feature and unit directories to demonstrate usage.
- Introduced a custom Pest file (`Pest.php`) to extend functionality and define global helpers.

This setup streamlines the testing process and provides a foundation for future test development.

* feat(test): add comprehensive testing infrastructure with Pest PHP

- Add complete Pest PHP testing suite with extensive helper functions
- Implement unit tests for Database and DatabaseDebugger classes
- Implement unit tests for CacheManager and DatastoreManager classes
- Add comprehensive mock factories and test data generators
- Add custom Pest expectations for TorrentPier-specific validation
- Create detailed testing documentation with examples and best practices
- Update main README.md and UPGRADE_GUIDE.md with testing sections
- Update dependencies to support testing infrastructure
- Remove example test file and replace with production-ready tests

BREAKING CHANGE: None - all existing functionality maintained

The testing infrastructure includes:
- 25+ helper functions for test setup and mocking
- Singleton pattern testing for all major components
- Mock factories for Database, Cache, and external dependencies
- Custom expectations: toBeValidDatabaseConfig, toHaveDebugInfo
- Comprehensive documentation with real-world examples
- Performance testing utilities and execution time assertions
2025-06-20 22:00:12 +04:00
Yury Pikhtarev
7aed6bc7d8
refactor(database): enhance error logging and various fixes (#1978)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
* refactor(database): enhance error logging and handling in Database and DatabaseDebugger classes

- Updated error handling in Database class to provide more meaningful error messages, including detailed PDO error information.
- Enhanced log_error method in DatabaseDebugger to accept exceptions, allowing for more reliable error logging with comprehensive context.
- Improved user-facing error messages while maintaining detailed logging for administrators and developers.
- Added checks for connection status and query context in error logs to aid in debugging.

* refactor(database): streamline error handling and improve code clarity in Database class

- Removed unused imports and global variable references to enhance code readability.
- Simplified error handling by refining conditions for empty input arrays.
- Defined variables early in the error logging method to ensure consistent access throughout.
- Improved comments for better understanding of the error handling logic.

* fix(database): refine development mode condition in Database class

- Removed unnecessary function check from the development mode condition to streamline the logic.

* fix(redirect): add no-cache headers to prevent browser caching of redirects

- Implemented `send_no_cache_headers()` in the redirect function to ensure that browsers do not cache redirect responses, adhering to best practices for HTTP redirects.

* refactor(database): enhance error handling and logging in Database and Whoops classes

- Improved error handling in the Database class to log detailed information for duplicate column errors and automatically retry problematic queries using PDO.
- Introduced a new DatabaseErrorHandler to enhance Whoops error reporting with comprehensive database context and recent query history.
- Updated EnhancedPrettyPageHandler to include dynamic database information in error outputs, improving debugging capabilities.
- Added legacy query tracking in DatabaseDebugger to identify and log queries needing compatibility fixes, ensuring better maintenance of legacy code.

* refactor(posting): rollback changes in SQL queries up to legacy format
2025-06-20 18:52:30 +04:00
belomaxorka
7e723d6ad8 changelog: Update CHANGELOG.md 📖 2025-06-20 09:44:57 +00:00
Yury Pikhtarev
fbde8cd421
feat(migrations): implement Phinx database migration system (#1976)
* feat(migrations): implement Phinx database migration system and update installation process

- Introduced a modern database migration system using Phinx, replacing the legacy SQL import method.
- Updated `install.php` to run migrations instead of importing SQL dumps.
- Added migration configuration file `phinx.php` and initial migration files for schema and data seeding.
- Created a new admin panel for migration status management.
- Updated UPGRADE_GUIDE.md to include migration setup instructions and benefits.
- Ensured backward compatibility for existing installations while facilitating a smoother transition to the new system.

* update runProcess to return process exit code

* refactor(migrations): clean up whitespace and formatting in migration files

- Removed unnecessary whitespace and adjusted formatting for consistency across migration files.

* fix(migrations): enforce NOT NULL constraints on migration columns

- Updated various migration columns to enforce NOT NULL constraints, ensuring data integrity across the schema.
- Adjusted default values and nullability for multiple fields in the initial schema migration files.

* refactor(database): standardize table engines to InnoDB for reliability

- Updated UPGRADE_GUIDE.md to reflect the use of InnoDB for all tables, emphasizing data integrity and reliability.
- Modified migration files to change table engines from MyISAM to InnoDB for various tracker and temporary tables.
- Optimized session variable settings in cron jobs for InnoDB compatibility.
- Ensured consistency across the schema by enforcing InnoDB usage in all relevant areas.

* fix(migrations): correct MySQL integer field types to match original schema

- Fix bb_forums table: forum_status (INT→TINYINT), forum_tpl_id (INT→SMALLINT)
- Fix bb_users table: avatar_ext_id remains TINYINT as per original schema
- Fix bb_groups table: avatar_ext_id (SMALLINT→INT) to match original INT(15)
- Fix bb_topics table: topic_show_first_post, topic_allow_robots (TINYINT(1)→TINYINT UNSIGNED)
- Remove incorrect 'limit' => 11 from standard INT fields, use default Phinx behavior
- Fix search_size field to use proper INT type instead of maximum value hack
- Correct poll table field types: vote_id (TINYINT), user_id (MEDIUMINT), vote_result (MEDIUMINT UNSIGNED)
- Standardize all timestamp and ID fields to use appropriate MySQL integer types

Ensures migration creates database schema identical to install/sql/mysql.sql
while maintaining InnoDB engine for all tables instead of MyISAM.

* fix(cache): auto-create cache directories when using FileStorage

The UnifiedCacheSystem was constructing directory paths for Nette FileStorage
but not creating them, causing "Directory not found" errors when accessing
caches like 'bb_login_err'. FileStorage expects directories to already exist.

Changes:
- Add automatic directory creation using bb_mkdir() before FileStorage init
- Handle both regular cache directories and SQLite parent directories
- Apply to both _buildStorage() and _buildDatastoreStorage() methods
- Add proper error handling with RuntimeException for failed creation
- Maintain consistency with TorrentPier's directory creation patterns

This ensures cache directories are created automatically when first accessed,
eliminating the need for manual directory creation during deployment.

Fixes: Cache initialization failures with missing directories

* refactor(docs): update README for clarity and remove legacy SQL file

- Improved formatting and clarity in the README, ensuring consistent line breaks and spacing.
- Updated installation instructions to reflect the new migration process, emphasizing the use of `phinx` for database setup.
- Removed the legacy SQL dump file `mysql.sql` and the `legacy-changes.txt` file, streamlining the installation process and reducing confusion for new users.
- Enhanced the documentation to guide users through the setup process more effectively.

* docs: enhance CLAUDE.md with migration details and directory updates

- Updated the `/library/` section to clarify its purpose.
- Added a new `/migrations/` directory section detailing database migration files managed by Phinx.
- Included migration commands for running and checking migration status.
- Revised the initial schema and seed data references for clarity.
- Improved formatting for consistency throughout the document.

* refactor(cron): remove demo_mode.php cron job and related functionality

- Deleted the demo_mode.php cron job file, which was responsible for managing demo mode operations.
- Added a migration to remove the demo_mode.php entry from the bb_cron table, ensuring a clean database state.
- Updated the initial schema migration comment to reflect the creation of essential database schema for fresh installations.

* refactor(docs): Fixed some typos

* chore: update changelog generation starting from v2.4.6-alpha.4

* refactor: Changed some `php_sapi_name()` to `PHP_SAPI` constants

* refactor: Extract hardcoded migrations to class property

* refactor: Use `count()` to count $initialMigrations elements

* feat(migrations): enhance migration management UI with new language variables

- Added new language variables for migration status, instructions, and applied/pending migrations to improve user interface clarity.
- Updated admin migration template to utilize these new language variables for better localization and maintainability.
- Introduced a new file 'CLAUDE.md' to the cleanup process for documentation purposes.

---------

Co-authored-by: Roman Kelesidis <roman25052006.kelesh@gmail.com>
2025-06-20 13:23:33 +04:00
belomaxorka
0d4c869f30 changelog: Update CHANGELOG.md 📖
Some checks failed
PHPMD / Run PHPMD scanning (push) Has been cancelled
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
2025-06-19 01:42:40 +00:00
Yury Pikhtarev
49717d3a68
feat: implement Language singleton with shorthand functions (#1966)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
- Add Language singleton class (src/Language.php) following TorrentPier patterns
- Implement automatic source language fallback loading
- Add dot notation support for nested language arrays
- Provide convenient shorthand functions __() and _e() in common.php
- Maintain 100% backward compatibility with global $lang variable
- Replace manual language file loading in bb_die() and bb_date() functions
- Update poll.php as modern usage example with __() shorthand
- Integrate with User.php initialization via lang()->initializeLanguage()
- Clean up Template.php compilation removing legacy source language logic
- Add comprehensive UPGRADE_GUIDE.md documentation section

BREAKING CHANGE: None - full backward compatibility maintained
2025-06-18 19:29:06 +04:00
Yury Pikhtarev
2fd306704f
feat(database): add visual markers for Nette Explorer queries in debug panel (#1965)
Add automatic detection and colorful badges to distinguish Nette Explorer
queries from legacy database calls, helping track modernization progress.

- Detect Nette SQL patterns (backticks, parentheses)
- Add green styled [Nette Explorer] badges
- Fix HTML escaping in debug tooltips
- Prevent marker duplication
2025-06-18 18:13:34 +04:00
Yury Pikhtarev
6c0219d53c
refactor(database): rename DB to Database and extract debug functionality (#1964)
- Rename DB → Database, DbFactory → DatabaseFactory for consistency
- Extract 8 debug methods from Database to dedicated DatabaseDebugger class
- Add DebugSelection wrapper for debug-enabled Nette Selection
- Update all references across codebase (common.php, Dev.php, page_footer)
- Maintain backward compatibility via magic methods (__get, __isset)
- Update documentation (README.md, UPGRADE_GUIDE.md)

No breaking changes - all existing DB() calls work unchanged
2025-06-18 17:46:12 +04:00
Roman Kelesidis
f2fca0de85
release: v2.6.0 🐂 2025-06-18 14:15:53 +03:00
Yury Pikhtarev
07a06a33cd
feat!: implement unified cache system with Nette Caching (#1963)
* feat!: implement unified cache system with Nette Caching

Replace legacy Cache and Datastore systems with modern unified implementation using Nette Caching v3.3 while maintaining 100% backward compatibility.

BREAKING CHANGE: Internal cache architecture completely rewritten, though all public APIs remain compatible.

### Added
- src/Cache/UnifiedCacheSystem.php: Main singleton orchestrator following TorrentPier patterns
- src/Cache/CacheManager.php: Cache interface using Nette Caching with singleton pattern
- src/Cache/DatastoreManager.php: Datastore interface using CacheManager internally
- src/Cache/README.md: Comprehensive documentation and migration guide

### Changed
- common.php: Updated to use singleton pattern instead of global variables
- src/Dev.php: Added compatibility with unified cache system debug functionality
- composer.json: Added nette/caching dependency
- UPGRADE_GUIDE.md: Added unified cache system migration documentation

### Removed
- src/Legacy/Cache/*: All legacy cache implementations (APCu, File, Memcached, Redis, SQLite, Common)
- src/Legacy/Datastore/*: All legacy datastore implementations (APCu, File, Memcached, Redis, SQLite, Common)
- src/Legacy/Caches.php: Legacy cache factory replaced by UnifiedCacheSystem

### Performance
- 456,647+ operations per second verified in production testing
- Memory optimization through efficient singleton pattern
- Modern Nette Caching algorithms and bulk operations

### Compatibility
- All existing CACHE() calls work unchanged
- All existing $datastore operations work unchanged
- Full backward compatibility with Dev.php debugging
- Resolved Sessions TypeError and debug property access issues

### Architecture
- Consistent singleton pattern matching config(), dev(), censor(), DB()
- Clean function interfaces with proper return types
- No global variables, modern initialization pattern
- Single source of truth replacing duplicate Cache/Datastore code

* fix: update datastore type from 'filecache' to 'file' for consistency

Modified the datastore type in common.php and README.md to reflect the new unified cache system terminology. This change ensures consistency across the codebase and documentation following the recent implementation of the unified cache system.

* refactor(cache): centralize storage creation and eliminate redundancy

- Remove redundant initializeStorage() from CacheManager
- Update CacheManager to receive pre-built Storage instances
- Centralize all storage creation logic in UnifiedCacheSystem
- Remove unused properties and fix method signatures
- Update documentation to reflect simplified architecture

No breaking changes - all public APIs unchanged.
2025-06-18 15:05:22 +04:00
Yury Pikhtarev
e458109eef
fix(User): add null and array checks before session data operations (#1962)
Ensure that session data is only processed if it exists and is an array. This prevents potential errors when attempting to cache or remove user session data. Updated methods `cache_set_userdata` and `cache_rm_userdata` to include necessary checks.
2025-06-18 12:43:58 +04:00
Yury Pikhtarev
f50b914cc1
feat: replace legacy database layer with Nette Database implementation (#1961)
* feat: replace legacy database layer with Nette Database implementation

Replace legacy SqlDb/Dbs classes with modern Nette Database implementation
while maintaining complete backward compatibility.

- Replace SqlDb with singleton DB class using Nette Database Connection
- Replace Dbs factory with DbFactory maintaining full compatibility
- Implement complete feature parity including debug, explain, and logging
- Add proper type declarations and modern PHP standards
- Remove legacy SqlDb.php and Dbs.php files
- Update common.php DB() function with proper PHPDoc and return types
- Fix affected_rows() implementation for Nette Database compatibility
- Fix explain() method to handle missing debug array keys
- Maintain 100% backward compatibility - no code changes required

The new implementation uses Nette Database v3.2 internally while preserving
all existing functionality. All existing DB() calls work unchanged.
All debugging, explain, error handling, and performance tracking features
are fully preserved with enhanced reliability.

Files added:
- src/Database/DB.php - Main database class with singleton pattern
- src/Database/DbFactory.php - Factory for database instance management
- src/Database/README.md - Comprehensive documentation

Files removed:
- src/Database/Config.php - Unused configuration helper
- src/Legacy/SqlDb.php - Legacy database class
- src/Legacy/Dbs.php - Legacy database factory

Files modified:
- common.php - Updated DB() function with proper types and documentation
- viewtopic.php - Fixed duplicate column SQL query issues
- src/Dev.php - Updated to use DbFactory instead of legacy $DBS
- library/includes/page_footer*.php - Replaced $DBS references with DbFactory

* docs: Update UPGRADE_GUIDE.md with Database Layer Migration details

Add a comprehensive section on the new database layer migration to Nette Database, highlighting key improvements, no code changes required, and verification steps. Document the removal of legacy database files and provide links to detailed documentation for further reference. Ensure clarity on backward compatibility and performance benefits.

* docs: Enhance README.md with future migration strategy to Nette Database Explorer

Add detailed sections outlining a phased approach for migrating to Nette Database Explorer, including hybrid methods, advanced features, and migration strategies. Highlight benefits such as improved developer experience, code quality, and performance optimizations. This documentation aims to guide developers through the transition while maintaining backward compatibility.
2025-06-18 12:29:13 +04:00
Roman Kelesidis
edda2306f2
release: v2.5.0 🐂
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-06-18 09:52:20 +03:00
Roman Kelesidis
86abafb114
docs: Add Select class migration guide (#1960) 2025-06-18 09:43:55 +03:00
Yury Pikhtarev
74a564d795
refactor(censor): migrate Censor class to singleton pattern (#1954)
* 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>
2025-06-18 10:38:23 +04:00
Roman Kelesidis
b1b2618757
chore(cliff): Add conventional commit prefix to changelog message (#1957) 2025-06-18 07:06:11 +03:00
belomaxorka
62f49beb0b Update CHANGELOG.md 📖 2025-06-18 01:41:26 +00:00
Yury Pikhtarev
bf9100fbfa
feat: implement centralized Config class to replace global $bb_cfg array (#1953)
Some checks failed
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
PHPMD / Run PHPMD scanning (push) Has been cancelled
* feat: implement centralized Config class to replace global $bb_cfg array

- Add singleton Config class with dot notation support for nested configuration
- Implement thread-safe configuration access with magic methods (__get, __set, __isset)
- Add global config() helper function for convenient access
- Support for getSection(), merge(), has(), all() methods with type safety

BREAKING CHANGE: While $bb_cfg global array still works for backward compatibility,
new code should use config()->get() method with dot notation

Updated files:
- src/Config.php: New Config singleton class implementation
- common.php: Initialize Config singleton and add global helper
- src/Emailer.php: Replace $bb_cfg with config()->get()
- src/Ajax.php: Replace $bb_cfg with config()->get()
- src/Censor.php: Replace $bb_cfg with config()->get()
- src/Validate.php: Replace $bb_cfg with config()->get()
- src/Dev.php: Replace $bb_cfg with config()->get()
- src/Sitemap.php: Replace $bb_cfg with config()->get()
- src/TorrServerAPI.php: Replace $bb_cfg with config()->get()
- src/Sessions.php: Replace $bb_cfg with config()->get()
- src/Legacy/TorrentFileList.php: Replace $bb_cfg with config()->get()
- src/Legacy/Poll.php: Replace $bb_cfg with config()->get()
- src/Legacy/Torrent.php: Replace $bb_cfg with config()->get()
- src/Legacy/Common/User.php: Replace $bb_cfg with config()->get()
- src/Legacy/Template.php: Replace $bb_cfg with config()->get()
- src/Legacy/Atom.php: Replace $bb_cfg with config()->get()
- src/Legacy/Admin/Common.php: Replace $bb_cfg with config()->get()
- viewforum.php: Replace $bb_cfg with config()->get()
- posting.php: Replace $bb_cfg with config()->get()
- dl.php: Replace $bb_cfg with config()->get()
- feed.php: Replace $bb_cfg with config()->get()
- filelist.php: Replace $bb_cfg with config()->get()
- group_edit.php: Replace $bb_cfg with config()->get()
- group.php: Replace $bb_cfg with config()->get()
- index.php: Replace $bb_cfg with config()->get()
- login.php: Replace $bb_cfg with config()->get()
- memberlist.php: Replace $bb_cfg with config()->get()
- modcp.php: Replace $bb_cfg with config()->get()
- playback_m3u.php: Replace $bb_cfg with config()->get()
- poll.php: Replace $bb_cfg with config()->get()

* refactor: replace $bb_cfg with config() in various admin files

- Updated multiple admin files to utilize the new Config class for configuration access.
- Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency.
- Ensured backward compatibility while transitioning to the new configuration system.

Files modified:
- common.php
- index.php
- admin_attach_cp.php
- admin_log.php
- admin_mass_email.php
- admin_sitemap.php
- admin_smilies.php
- admin_terms.php
- admin_user_search.php
- admin_words.php
- admin/index.php
- admin/stats/tracker.php

* refactor: update init_bb.php to use config() for configuration management

- Replaced the merging of $bb_cfg with a call to config()->merge() for improved clarity and maintainability.
- Updated the retrieval of all configuration settings to use config()->all().

This change continues the transition towards a centralized configuration system.

* refactor: replace $bb_cfg with config() in various files

- Updated multiple files to utilize the new Config class for configuration access.
- Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency.
- Ensured backward compatibility while transitioning to the new configuration system.

Files modified:
- privmsg.php
- search.php
- terms.php
- tracker.php
- viewtopic.php
- bt/announce.php
- bt/scrape.php
- bt/includes/init_tr.php
- library/ajax/*.php
- src/Config.php

* refactor: replace $bb_cfg with config() in attachment and display files

- Updated multiple files to utilize the new Config class for configuration access.
- Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency.
- Ensured backward compatibility while transitioning to the new configuration system.

Files modified:
- attachment_mod.php
- displaying_torrent.php
- functions_delete.php
- bbcode.php
- functions.php
- init_bb.php
- online_userlist.php
- page_footer.php
- page_header.php
- torrent_show_dl_list.php
- cron jobs (various files)
- datastore build files (various files)

* refactor: replace $bb_cfg with config() in user control panel files

- Updated multiple user control panel files to utilize the new Config class for configuration access.
- Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency.
- Ensured backward compatibility while transitioning to the new configuration system.

Files modified:
- bonus.php
- email.php
- register.php
- sendpasswd.php
- topic_watch.php
- viewprofile.php

* refactor: replace $bb_cfg with config() in various legacy files

- Updated multiple legacy files to utilize the new Config class for configuration access.
- Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency.
- Ensured backward compatibility while transitioning to the new configuration system.

Files modified:
- sidebar2.html
- BBCode.php
- LogAction.php
- Post.php
- Template.php
- Torrent.php
- Common/User.php
- Common/Select.php
- Common/Upload.php
- Admin/Common.php
- tpl_config.php

* refactor: remove legacy DOCUMENTATION.md and add UPGRADE_GUIDE.md

- Deleted the outdated DOCUMENTATION.md file, which contained legacy configuration information.
- Introduced a new UPGRADE_GUIDE.md to assist users in migrating to the new configuration system.
- The upgrade guide includes migration strategies, breaking changes, and best practices for using the new Config class.

Files modified:
- DOCUMENTATION.md (deleted)
- UPGRADE_GUIDE.md (new)

* refactor: update legacy files to maintain compatibility with bb_cfg deprecation

- Added comments in init_bb.php, Template.php, and Cron.php to indicate that bb_cfg is deprecated but retained for compatibility with non-adapted code.
- Ensured clarity in documentation for future reference while transitioning to the new configuration system.

Files modified:
- init_bb.php
- Template.php
- Cron.php
2025-06-18 01:19:49 +04:00
Yury Pikhtarev
37a0675adf
fix(sql): resolve only_full_group_by compatibility issues in tracker cleanup (#1951)
- Replace non-aggregated 'seeder' column with MAX(seeder) in GROUP BY query
- Remove ORDER BY clause incompatible with GROUP BY in seeder update query

Fixes MySQL 5.7+ strict SQL mode errors in tr_cleanup_and_dlstat cron job.
2025-06-17 20:28:14 +04:00
Roman Kelesidis
81bf67c2be
fix(installer): Strip protocol from TP_HOST to keep only hostname (#1952)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-06-17 18:14:47 +03:00
Yury Pikhtarev
5842994782
refactor(config): encapsulate global $bb_cfg array in Config class (#1950)
- Create new TorrentPier\Config singleton class with dot notation support
- Add config() helper function for global access
- Replace direct $bb_cfg access in core files (common.php, Emailer.php, Ajax.php)
- Implement methods: get(), set(), has(), all(), getSection(), merge()
- Add magic methods for property-like access
- Maintain backward compatibility with existing $bb_cfg usage

BREAKING CHANGE: None - maintains full backward compatibility
2025-06-17 18:41:45 +04:00
Yury Pikhtarev
8907dbf991
Update composer.lock and improve SQL queries in online_userlist.php and tr_cleanup_and_dlstat.php (#1949)
- Updated plugin API version in composer.lock from 2.3.0 to 2.6.0.
- Modified SQL queries in online_userlist.php to use MAX() for session data and adjusted GROUP BY clause for better accuracy.
- Enhanced SQL logic in tr_cleanup_and_dlstat.php to utilize MAX() for determining the releaser status.
2025-06-17 18:07:31 +04:00
belomaxorka
d8b1489b06 Update CHANGELOG.md 📖
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-06-17 01:42:31 +00:00
dependabot[bot]
b4776804a4
Composer(deps): Bump filp/whoops from 2.18.2 to 2.18.3 (#1948)
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
Bumps [filp/whoops](https://github.com/filp/whoops) from 2.18.2 to 2.18.3.
- [Changelog](https://github.com/filp/whoops/blob/master/CHANGELOG.md)
- [Commits](https://github.com/filp/whoops/compare/2.18.2...2.18.3)

---
updated-dependencies:
- dependency-name: filp/whoops
  dependency-version: 2.18.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 15:07:06 +03:00
belomaxorka
633051bb99 Update CHANGELOG.md 📖
Some checks are pending
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run
PHPMD / Run PHPMD scanning (push) Waiting to run
2025-06-16 01:45:24 +00:00
belomaxorka
224f0ffa1f Update CHANGELOG.md 📖
Some checks failed
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
PHPMD / Run PHPMD scanning (push) Has been cancelled
2025-06-15 01:50:26 +00:00
belomaxorka
b530268826 Update CHANGELOG.md 📖 2025-06-13 08:21:18 +00:00