Remove ishashed and dehashstatus columns

This commit is contained in:
DariusIII
2026-02-11 12:40:10 +01:00
parent 47ce4c69a7
commit cc0d7fca87
12 changed files with 102 additions and 27 deletions
@@ -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
@@ -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],
-1
View File
@@ -163,7 +163,6 @@ class Release extends Model
'iscategorized' => 1,
'predb_id' => $parameters['predb_id'],
'source' => $parameters['source'] ?? null,
'ishashed' => $parameters['ishashed'] ?? 0,
]
);
-3
View File
@@ -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());
@@ -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],
-1
View File
@@ -394,7 +394,6 @@ class NzbImportService
'isrenamed' => $renamed,
'predb_id' => 0,
'nzbstatus' => NzbService::NZB_ADDED,
'ishashed' => 0,
]
);
} else {
-1
View File
@@ -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) {
+1 -4
View File
@@ -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,
@@ -0,0 +1,98 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Drop index and column from release_files table
Schema::table('release_files', function (Blueprint $table) {
if ($this->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;
}
};
-5
View File
@@ -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`),
-5
View File
@@ -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`),
@@ -284,7 +284,7 @@
<div class="border-b border-gray-200 dark:border-gray-700 pb-6">
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-4">Fix Release Names</h2>
<div class="space-y-4">
<x-form.group label="Fix Release Names" for="fix_names" help="Fix release names using NFOs, par2 files, filenames, md5 and sha1.">
<x-form.group label="Fix Release Names" for="fix_names" help="Fix release names using NFOs, par2 files, and filenames.">
<x-select id="fix_names" name="fix_names" class="w-full">
@foreach($yesno_ids as $index => $val)
<option value="{{ $val }}" {{ ($site['fix_names'] ?? '') == $val ? 'selected' : '' }}>