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

Offline furgussen

  • Junior Indexer
  • **
  • Posts: 5
  • Helpful: +1/-0
Blacklist Poster - removeCrapReleases.php
« on: 2013-08-25, 08:30:18 pm »

I'm not sure, but I may have fixed a small oversight in removeCrapReleases.php.  It wasn't removing releases when you chose to blacklist by Poster.  The function in removeCrapReleases.php was only looking for the searchname field.

Here's my updated function. 

The initial $regexes query needed the msgcol column.  Then I added an IF clause to see what field we needed to search for.

Code: [Select]
// Use the site blacklists to delete releases.
        function deleteBlacklist($and)
                $type = "Blacklist";
                $db = new DB();
                $regexes = $db->query('select regex, msgcol from binaryblacklist where status = 1');
                $delcount = 0;
                if(sizeof($regexes > 0))
                        foreach ($regexes as $regex)
                                if ($regex['msgcol'] == "1") {
                                        $sql = $db->query("select r.ID, r.guid, r.searchname from releases r left join releasefiles rf
 on rf.releaseID = r.ID where ( REGEXP".$db->escapeString($regex["regex"])." or REGEXP".$db->escapeString($regex["regex"
                                        $delcount += deleteReleases($sql, $type);
                                } elseif ($regex['msgcol'] == "2") {
                                        $sql = $db->query("select r.ID, r.guid, r.fromname, r.searchname from releases r left join rel
easefiles rf on rf.releaseID = r.ID where (r.fromname REGEXP".$db->escapeString($regex["regex"]).")".$and);
                                        $delcount += deleteReleases($sql, $type);
                return $delcount;

It seems to work for me now.  I haven't coded in PHP in years so I'm sure there's an easier way to do this.  Maybe it can be added to the master repo.