diff --git a/app/Console/Commands/ReleasesFixNamesGroup.php b/app/Console/Commands/ReleasesFixNamesGroup.php index 80a9dd105..e5315486d 100644 --- a/app/Console/Commands/ReleasesFixNamesGroup.php +++ b/app/Console/Commands/ReleasesFixNamesGroup.php @@ -330,9 +330,9 @@ class ReleasesFixNamesGroup extends Command return Release::fromQuery(sprintf(" SELECT r.id AS releases_id, r.fromname, r.guid, r.groups_id, r.categories_id, r.name, r.searchname, r.proc_nfo, - r.proc_uid, r.proc_files, r.proc_par2, r.ishashed, r.dehashstatus, r.nfostatus, + r.proc_uid, r.proc_files, r.proc_par2, r.nfostatus, r.size AS relsize, r.predb_id, r.proc_hash16k, r.proc_srr, r.proc_crc32, - IFNULL(rf.releases_id, 0) AS fileid, IF(rf.ishashed = 1, rf.name, 0) AS filehash, + IFNULL(rf.releases_id, 0) AS fileid, IFNULL(GROUP_CONCAT(rf.name ORDER BY rf.name ASC SEPARATOR '|'), '') AS filestring, IFNULL(UNCOMPRESS(rn.nfo), '') AS textstring, IFNULL(ru.uniqueid, '') AS uid, @@ -356,7 +356,6 @@ class ReleasesFixNamesGroup extends Command OR r.proc_srr = %d OR r.proc_hash16k = %d OR r.proc_crc32 = %d - OR (r.ishashed = 1 AND r.dehashstatus BETWEEN -6 AND 0) ) AND r.categories_id IN (%s) GROUP BY r.id diff --git a/app/Http/Controllers/Admin/AdminTmuxController.php b/app/Http/Controllers/Admin/AdminTmuxController.php index 5331c397c..3d4aa2e46 100644 --- a/app/Http/Controllers/Admin/AdminTmuxController.php +++ b/app/Http/Controllers/Admin/AdminTmuxController.php @@ -51,8 +51,6 @@ class AdminTmuxController extends BasePageController 'backfill_group' => ['Newest', 'Oldest', 'Alphabetical', 'Alphabetical - Reverse', 'Most Posts', 'Fewest Posts'], 'backfill_days' => ['Days per Group', 'Safe Backfill day'], 'backfill_days_ids' => [1, 2], - 'dehash_ids' => [0, 1], - 'dehash_names' => ['Disabled', 'Enabled'], 'import_ids' => [0, 1, 2], 'import_names' => ['Disabled', 'Import - Do Not Use Filenames', 'Import - Use Filenames'], 'releases_ids' => [0, 1], diff --git a/app/Models/Release.php b/app/Models/Release.php index ebae58a61..59ba58ea2 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -163,7 +163,6 @@ class Release extends Model 'iscategorized' => 1, 'predb_id' => $parameters['predb_id'], 'source' => $parameters['source'] ?? null, - 'ishashed' => $parameters['ishashed'] ?? 0, ] ); diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index 6ce5d6e3a..4b39508b2 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -13,14 +13,12 @@ use Illuminate\Support\Facades\Log; * @property int $releases_id FK to releases.id * @property string $name * @property int $size - * @property bool $ishashed * @property \Carbon\Carbon|null $created_at * @property \Carbon\Carbon|null $updated_at * @property bool $passworded * @property-read Release $release * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereIshashed($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile wherePassworded($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ReleaseFile whereReleasesId($value) @@ -112,7 +110,6 @@ class ReleaseFile extends Model 'updated_at' => now()->timestamp, 'passworded' => $hasPassword, 'crc32' => $crc, - 'ishashed' => preg_match('/^[a-fA-F0-9]{32}\b|^[a-fA-F0-9]{40}\b|^[a-fA-F0-9]{64}\b|^[a-fA-F0-9]{96}\b|^[a-fA-F0-9]{128}\b/i', $name) ? 1 : 0, ]); } catch (\PDOException $e) { Log::alert($e->getMessage()); diff --git a/app/Services/NameFixing/ReleaseUpdateService.php b/app/Services/NameFixing/ReleaseUpdateService.php index e2664db3a..e394164e1 100644 --- a/app/Services/NameFixing/ReleaseUpdateService.php +++ b/app/Services/NameFixing/ReleaseUpdateService.php @@ -316,7 +316,6 @@ class ReleaseUpdateService 'NFO, ' => ['isrenamed' => 1, 'iscategorized' => 1, 'proc_nfo' => 1], 'PAR2, ' => ['isrenamed' => 1, 'iscategorized' => 1, 'proc_par2' => 1], 'Filenames, ', 'file matched source: ' => ['isrenamed' => 1, 'iscategorized' => 1, 'proc_files' => 1], - 'SHA1, ', 'MD5, ' => ['isrenamed' => 1, 'iscategorized' => 1, 'dehashstatus' => 1], 'PreDB FT Exact, ' => ['isrenamed' => 1, 'iscategorized' => 1], 'sorter, ' => ['isrenamed' => 1, 'iscategorized' => 1, 'proc_sorter' => 1], 'UID, ', 'Mediainfo, ' => ['isrenamed' => 1, 'iscategorized' => 1, 'proc_uid' => 1], diff --git a/app/Services/Nzb/NzbImportService.php b/app/Services/Nzb/NzbImportService.php index 6d4f63021..20672a204 100644 --- a/app/Services/Nzb/NzbImportService.php +++ b/app/Services/Nzb/NzbImportService.php @@ -394,7 +394,6 @@ class NzbImportService 'isrenamed' => $renamed, 'predb_id' => 0, 'nzbstatus' => NzbService::NZB_ADDED, - 'ishashed' => 0, ] ); } else { diff --git a/app/Services/ReleaseCreationService.php b/app/Services/ReleaseCreationService.php index bd9be7a83..14e8c9e89 100644 --- a/app/Services/ReleaseCreationService.php +++ b/app/Services/ReleaseCreationService.php @@ -112,7 +112,6 @@ class ReleaseCreationService 'isrenamed' => $properName === true ? 1 : 0, 'predb_id' => $preID === false ? 0 : $preID, 'nzbstatus' => NzbService::NZB_NONE, - 'ishashed' => preg_match('/^[a-fA-F0-9]{32}\b|^[a-fA-F0-9]{40}\b|^[a-fA-F0-9]{64}\b|^[a-fA-F0-9]{96}\b|^[a-fA-F0-9]{128}\b/i', $searchName) ? 1 : 0, ]); if ($releaseID !== null) { diff --git a/app/Services/Tmux/Tmux.php b/app/Services/Tmux/Tmux.php index b1b44842d..4d2d818b7 100644 --- a/app/Services/Tmux/Tmux.php +++ b/app/Services/Tmux/Tmux.php @@ -169,8 +169,6 @@ class Tmux 'monitor_path_a' => 'monitor_path_a', 'monitor_path_b' => 'monitor_path_b', 'progressive' => 'progressive', - 'dehash' => 'dehash', - 'dehash_timer' => 'dehash_timer', 'backfill_days' => 'backfilldays', 'post_amazon' => 'post_amazon', 'post_timer_amazon' => 'post_timer_amazon', @@ -307,8 +305,7 @@ class Tmux SUM(IF(categories_id BETWEEN %d AND %d AND xxxinfo_id = 0,1,0)) AS processxxx, SUM(IF(1=1 %s,1,0)) AS processnfo, SUM(IF(isrenamed = %d AND predb_id = 0 AND passwordstatus >= 0 AND nfostatus > %d - AND ((nfostatus = %d AND proc_nfo = %d) OR proc_files = %d OR proc_par2 = %d - OR (ishashed = 1 AND dehashstatus BETWEEN -6 AND 0)) AND categories_id IN (%s),1,0)) AS processrenames, + AND ((nfostatus = %d AND proc_nfo = %d) OR proc_files = %d OR proc_par2 = %d) AND categories_id IN (%s),1,0)) AS processrenames, SUM(IF(isrenamed = %d,1,0)) AS renamed, SUM(IF(nfostatus = %20$d,1,0)) AS nfo, SUM(IF(predb_id > 0,1,0)) AS predb_matched, diff --git a/database/migrations/2026_02_11_000000_remove_ishashed_and_dehashstatus_columns.php b/database/migrations/2026_02_11_000000_remove_ishashed_and_dehashstatus_columns.php new file mode 100644 index 000000000..29c59eff3 --- /dev/null +++ b/database/migrations/2026_02_11_000000_remove_ishashed_and_dehashstatus_columns.php @@ -0,0 +1,98 @@ +hasIndex('release_files', 'ix_releasefiles_ishashed')) { + $table->dropIndex('ix_releasefiles_ishashed'); + } + + if (Schema::hasColumn('release_files', 'ishashed')) { + $table->dropColumn('ishashed'); + } + }); + + // Drop index and columns from releases table + Schema::table('releases', function (Blueprint $table) { + if ($this->hasIndex('releases', 'ix_releases_dehashstatus')) { + $table->dropIndex('ix_releases_dehashstatus'); + } + + if (Schema::hasColumn('releases', 'ishashed')) { + $table->dropColumn('ishashed'); + } + + if (Schema::hasColumn('releases', 'dehashstatus')) { + $table->dropColumn('dehashstatus'); + } + }); + + // Remove dehash settings from settings table + DB::table('settings')->whereIn('name', ['dehash', 'dehash_timer'])->delete(); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // Restore columns to release_files table + Schema::table('release_files', function (Blueprint $table) { + if (! Schema::hasColumn('release_files', 'ishashed')) { + $table->boolean('ishashed')->default(false)->after('size'); + } + + if (! $this->hasIndex('release_files', 'ix_releasefiles_ishashed')) { + $table->index('ishashed', 'ix_releasefiles_ishashed'); + } + }); + + // Restore columns to releases table + Schema::table('releases', function (Blueprint $table) { + if (! Schema::hasColumn('releases', 'dehashstatus')) { + $table->tinyInteger('dehashstatus')->default(0)->after('audiostatus'); + } + + if (! Schema::hasColumn('releases', 'ishashed')) { + $table->boolean('ishashed')->default(false)->after('isrenamed'); + } + + if (! $this->hasIndex('releases', 'ix_releases_dehashstatus')) { + $table->index(['dehashstatus', 'ishashed'], 'ix_releases_dehashstatus'); + } + }); + + // Restore dehash settings + DB::table('settings')->insert([ + ['name' => 'dehash', 'value' => '0', 'section' => 'site', 'subsection' => '', 'hint' => 'dehash'], + ['name' => 'dehash_timer', 'value' => '30', 'section' => 'site', 'subsection' => '', 'hint' => 'dehash_timer'], + ]); + } + + /** + * Check if an index exists on a table. + */ + private function hasIndex(string $table, string $indexName): bool + { + $indexes = Schema::getIndexes($table); + + foreach ($indexes as $index) { + if ($index['name'] === $indexName) { + return true; + } + } + + return false; + } +}; diff --git a/database/schema/mariadb-schema.sql b/database/schema/mariadb-schema.sql index e9e9920ca..e2a3b777f 100644 --- a/database/schema/mariadb-schema.sql +++ b/database/schema/mariadb-schema.sql @@ -812,13 +812,11 @@ CREATE TABLE `release_files` ( `releases_id` int(10) unsigned NOT NULL COMMENT 'FK to releases.id', `name` varchar(255) NOT NULL DEFAULT '', `size` bigint(20) unsigned NOT NULL DEFAULT 0, - `ishashed` tinyint(1) NOT NULL DEFAULT 0, `crc32` varchar(255) NOT NULL DEFAULT '', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `passworded` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`releases_id`,`name`), - KEY `ix_releasefiles_ishashed` (`ishashed`), CONSTRAINT `FK_rf_releases` FOREIGN KEY (`releases_id`) REFERENCES `releases` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; DROP TABLE IF EXISTS `release_informs`; @@ -912,12 +910,10 @@ CREATE TABLE `releases` ( `jpgstatus` tinyint(1) NOT NULL DEFAULT 0, `videostatus` tinyint(1) NOT NULL DEFAULT 0, `audiostatus` tinyint(1) NOT NULL DEFAULT 0, - `dehashstatus` tinyint(1) NOT NULL DEFAULT 0, `reqidstatus` tinyint(1) NOT NULL DEFAULT 0, `nzbstatus` tinyint(1) NOT NULL DEFAULT 0, `iscategorized` tinyint(1) NOT NULL DEFAULT 0, `isrenamed` tinyint(1) NOT NULL DEFAULT 0, - `ishashed` tinyint(1) NOT NULL DEFAULT 0, `proc_pp` tinyint(1) NOT NULL DEFAULT 0, `proc_sorter` tinyint(1) NOT NULL DEFAULT 0, `proc_par2` tinyint(1) NOT NULL DEFAULT 0, @@ -937,7 +933,6 @@ CREATE TABLE `releases` ( KEY `ix_releases_predb_id_searchname` (`predb_id`,`searchname`), KEY `ix_releases_haspreview_passwordstatus` (`haspreview`,`passwordstatus`), KEY `ix_releases_nfostatus` (`nfostatus`,`size`), - KEY `ix_releases_dehashstatus` (`dehashstatus`,`ishashed`), KEY `ix_releases_name` (`name`), KEY `ix_releases_guid` (`guid`), KEY `ix_releases_videos_id` (`videos_id`), diff --git a/database/schema/mysql-schema.sql b/database/schema/mysql-schema.sql index e9e9920ca..e2a3b777f 100644 --- a/database/schema/mysql-schema.sql +++ b/database/schema/mysql-schema.sql @@ -812,13 +812,11 @@ CREATE TABLE `release_files` ( `releases_id` int(10) unsigned NOT NULL COMMENT 'FK to releases.id', `name` varchar(255) NOT NULL DEFAULT '', `size` bigint(20) unsigned NOT NULL DEFAULT 0, - `ishashed` tinyint(1) NOT NULL DEFAULT 0, `crc32` varchar(255) NOT NULL DEFAULT '', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `passworded` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`releases_id`,`name`), - KEY `ix_releasefiles_ishashed` (`ishashed`), CONSTRAINT `FK_rf_releases` FOREIGN KEY (`releases_id`) REFERENCES `releases` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; DROP TABLE IF EXISTS `release_informs`; @@ -912,12 +910,10 @@ CREATE TABLE `releases` ( `jpgstatus` tinyint(1) NOT NULL DEFAULT 0, `videostatus` tinyint(1) NOT NULL DEFAULT 0, `audiostatus` tinyint(1) NOT NULL DEFAULT 0, - `dehashstatus` tinyint(1) NOT NULL DEFAULT 0, `reqidstatus` tinyint(1) NOT NULL DEFAULT 0, `nzbstatus` tinyint(1) NOT NULL DEFAULT 0, `iscategorized` tinyint(1) NOT NULL DEFAULT 0, `isrenamed` tinyint(1) NOT NULL DEFAULT 0, - `ishashed` tinyint(1) NOT NULL DEFAULT 0, `proc_pp` tinyint(1) NOT NULL DEFAULT 0, `proc_sorter` tinyint(1) NOT NULL DEFAULT 0, `proc_par2` tinyint(1) NOT NULL DEFAULT 0, @@ -937,7 +933,6 @@ CREATE TABLE `releases` ( KEY `ix_releases_predb_id_searchname` (`predb_id`,`searchname`), KEY `ix_releases_haspreview_passwordstatus` (`haspreview`,`passwordstatus`), KEY `ix_releases_nfostatus` (`nfostatus`,`size`), - KEY `ix_releases_dehashstatus` (`dehashstatus`,`ishashed`), KEY `ix_releases_name` (`name`), KEY `ix_releases_guid` (`guid`), KEY `ix_releases_videos_id` (`videos_id`), diff --git a/resources/views/admin/site/tmux-edit.blade.php b/resources/views/admin/site/tmux-edit.blade.php index 64841e9ce..c4e22e406 100644 --- a/resources/views/admin/site/tmux-edit.blade.php +++ b/resources/views/admin/site/tmux-edit.blade.php @@ -284,7 +284,7 @@

Fix Release Names

- + @foreach($yesno_ids as $index => $val)