Skip to content

Commit

Permalink
Add misc/testing/DB/mark_as_passworded.php script
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Aug 16, 2019
1 parent 58761de commit 311e787
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2019-08-16 DariusIII
* Chg: Add misc/testing/DB/mark_as_passworded.php script
* Chg: Set release as passworded if files inside archives are passworded
* Chg: Update tinyMCE config
* Fix: Fix opening existing forum posts
Expand Down
19 changes: 19 additions & 0 deletions misc/testing/DB/mark_as_passworded.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use App\Models\Release;
use App\Models\ReleaseFile;
use Blacklight\Releases;

require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';

$passFiles = ReleaseFile::query()->where('passworded', '=', 1)->select(['releases_id'])->groupBy('releases_id')->get();

$count = 0;

if ($passFiles->isNotEmpty()) {
foreach ($passFiles as $passFile) {
Release::query()->where('id', $passFile->releases_id)->update(['passwordstatus' => Releases::PASSWD_RAR]);
$count++;
}
}
(new \Blacklight\ColorCLI())->info($count.' releases marked as passworded');

0 comments on commit 311e787

Please sign in to comment.