Author Topic: Blacklist Poster - removeCrapReleases.php Update  (Read 3204 times)

Offline furgussen

  • Junior Indexer
  • **
  • Posts: 5
  • Helpful: +1/-0
Blacklist Poster - removeCrapReleases.php Update
« on: 2014-02-12, 11:19:56 AM »
Hello,

I posted this in the support forums a while back, but noticed in the latest release it still isn't in there. (http://nzedb.com/index.php?topic=537)

The GUI allows you to configure Blacklists by Poster, but the code doesn't actually do it!

So here's the updated code for removeCrapReleases.php.  Can this please be implemented into the repository?  I'd like to be able to blacklist certain posters.

Code: [Select]
// Use the site blacklists to delete releases.
function deleteBlacklist($and) {
        $db = new DB();
        $regexes = $db->queryDirect('SELECT regex, msgcol FROM binaryblacklist WHERE status = 1 AND optype = 1');
        $delcount = 0;
        $count = $regexes->rowCount();
        if ($count > 0) {
                foreach ($regexes as $regex) {
                        if ($regex['msgcol'] == "1") {
                                // Filter By Subject
                                if ($db->dbSystem() == 'mysql') {
                                        $regexsql = "(rf.name REGEXP " . $db->escapeString($regex['regex']) . " OR r.name REGEXP " . $db->escapeString(
$regex['regex']) . ")";
                                } else {
                                        $regexsql = "(rf.name ~ " . $db->escapeString($regex['regex']) . " OR r.name ~ " . $db->escapeString($regex['re
gex']) . ")";
                                }
                                $sql = $db->prepare("SELECT r.id, r.guid, r.searchname FROM releases r LEFT JOIN releasefiles rf ON rf.releaseid = r.id
 WHERE {$regexsql} " . $and);
                                $sql->execute();
                                $delcount += deleteReleases($sql, 'Blacklist');
                        } elseif ($regex['msgcol'] == "2") {
                                // Filter by Poster
                                 if ($db->dbSystem() == 'mysql') {
                    $regexsql = "(r.fromname REGEXP " . $db->escapeString($regex['regex']) . ")";
                } else {
                    $regexsql = "(r.fromname ~ " . $db->escapeString($regex['regex']) . ")";
                }
                $sql = $db->prepare("SELECT r.id, r.guid, r.fromname, r.searchname FROM releases r LEFT JOIN releasefiles rf ON rf.releaseid = r.id WHE
RE {$regexsql} " . $and);
                $sql->execute();
                $delcount += deleteReleases($sql, 'Blacklist');

                        }
                }
        }
        return $delcount;
}

Thanks
Tyler

Offline jonnyboy

  • Epic Indexer
  • *****
  • Posts: 1046
  • Helpful: +93/-1
  • Lazzy Trucker
    • nZEDb
Re: Blacklist Poster - removeCrapReleases.php Update
« Reply #1 on: 2014-02-12, 11:27:43 AM »
Try doing a pull request. If the code is valid, it will be merged. That's better than posting here and complaining that it wasn't added.