Ejemplo n.º 1
0
<?php

// New line for CLI.
$n = PHP_EOL;
// Include config.php
require_once dirname(__FILE__) . '/../../../www/config.php';
// ColorCLI class.
$cli = new ColorCLI();
// Print arguments/usage.
$totalArgs = count($argv);
if ($totalArgs < 2) {
    exit($cli->info($n . 'This deletes releases based on a list of criteria you pass.' . $n . 'Usage:' . $n . $n . 'List of supported criteria:' . $n . 'fromname   : Look for names of people who posted releases (the poster name). (modifiers: equals, like)' . $n . 'groupname  : Look in groups. (modifiers: equals, like)' . $n . 'guid       : Look for a specific guid. (modifiers: equals)' . $n . 'name       : Look for a name (the usenet name). (modifiers: equals, like)' . $n . 'searchname : Look for a name (the search name). (modifiers: equals, like)' . $n . 'size       : Release must be (bigger than |smaller than |exactly) this size.(bytes) (modifiers: equals,bigger,smaller)' . $n . 'adddate    : Look for releases added to our DB (older than|newer than) x hours. (modifiers: bigger,smaller)' . $n . 'postdate   : Look for posted to usenet (older than|newer than) x hours. (modifiers: bigger,smaller)' . $n . 'completion : Look for completion (less than) (modifiers: smaller)' . $n . $n . 'List of Modifiers:' . $n . 'equals     : Match must be exactly this. (fromname=equals="john" will only look for "john", not "johndoe")' . $n . 'like       : Match can be similar to this. Separate words using spaces(ie:"cars hdtv x264").' . $n . '             (fromname=like="john" will look for any posters with john in it (ie:john@smith.com)' . $n . 'bigger     : Match must be bigger than this. (postdate=bigger="3" means older than 3 hours ago)' . $n . 'smaller    : Match must be smaller than this (postdate=smaller="3" means between now and 3 hours ago.' . $n . $n . 'Extra:' . $n . 'ignore     : Ignore the user check. (before running we ask you if you want to run the query to delete)' . $n . $n . 'Examples:' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' groupname=equals="alt.binaries.teevee" searchname=like="olympics 2014" postdate=bigger="5"' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' guid=equals="8fb5956bae3de4fb94edcc69da44d6883d586fd0"' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' size=smaller="104857600" size=bigger="2048" groupname=like="movies"' . $n . $_SERVER['_'] . ' ' . $argv[0] . ' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore'));
}
$RR = new ReleaseRemover();
// Remove argv[0] and send the array.
$RR->removeByCriteria(array_slice($argv, 1, $totalArgs - 1));
Ejemplo n.º 2
0
<?php

/* This script deletes releases that match certain criteria, type php removeCrapReleases.php false for details. */
require_once dirname(__FILE__) . '/../../../www/config.php';
$cli = new ColorCLI();
$n = PHP_EOL;
$argCnt = count($argv);
if ($argCnt === 1) {
    exit($cli->error($n . 'Run fixReleaseNames.php first to attempt to fix release names.' . $n . 'This will miss some releases if you have not set fixReleaseNames to set the release as checked.' . $n . $n . "php {$argv['0']} false Display full usage of this script." . $n . "php {$argv['0']} true full Run this script with all options."));
}
if ($argCnt === 2) {
    if ($argv[1] === 'false') {
        exit("php {$argv['0']} arg1 arg2 arg3 arg4" . $n . $n . 'arg1 (Required) = true/false' . $n . '                  true   = Run this script and delete releases.' . $n . '                  false  = Run this script and show what could be deleted.' . $n . $n . 'arg2 (Required) = full/number' . $n . '                  full   = Run without a time limit.' . $n . '                  number = Run on releases up to this old.' . $n . $n . 'arg3 (Optional) = blacklist | blfiles | executable | gibberish | hashed | installbin | passworded | passwordurl | sample | scr | short | size | wmv' . $n . '                  blacklist   = Remove releases using the enabled blacklists in admin section of site.' . $n . '                  blfiles     = Remove releases using the enabled blacklists in admin section of site against filenames.' . $n . '                  executable  = Remove releases containing an exe file.' . $n . '                  gibberish   = Remove releases where the name is letters/numbers only and 15 characters or longer.' . $n . '                  hashed      = Remove releases where the name is letters/numbers only and 25 characters or longer.' . $n . '                  installbin  = Remove releases which contain an install.bin file.' . $n . '                  passworded  = Remove releases which contain the word password in the title.' . $n . '                  passwordurl = Remove releases which contain a password.url file.' . $n . '                  sample      = Remove releases that are smaller than 40MB more than 1 file and have sample in the title' . $n . '                  scr         = Remove releases where .scr extension is found in the files or subject.' . $n . '                  short       = Remove releases where the name is only numbers or letters and is 5 characters or less.' . $n . '                  codec       = Remove releases where the release contains WMV file, x264 name, and Codec\\Setup.exe file (Spammer).' . $n . '                  size        = Remove releases smaller than 2MB and have only 1 file and not in books or mp3 section.' . $n . '                  huge        = Remove releases bigger than 200MB with just a single file.' . $n . $n . 'arg4 (Optional) = blacklist regular expression id number.  Only works when blacklist is selected as third argument.' . $n . '                  100001      = Remove releases where the Binary Blacklist ID is 100001.' . $n . $n . 'examples:' . $n . "php {$argv['0']} true 12 blacklist     = Remove releases up to 12 hours old using site blacklists." . $n . "php {$argv['0']} false full            = Show what releases could have been removed." . $n . "php {$argv['0']} true full installbin  = Remove releases which containing an install.bin file." . $n . "php {$argv['0']} true full blacklist 1 = Remove releases matching blacklist id 1." . $n);
    } else {
        exit($cli->error("Wrong usage! Type php {$argv['0']} false"));
    }
}
if ($argCnt < 3) {
    exit($cli->error("Wrong usage! Type php {$argv['0']} false"));
}
if (isset($argv[3]) && $argv[3] === 'blacklist' && isset($argv[4])) {
    $blacklistID = $argv[4];
}
$RR = new ReleaseRemover();
$RR->removeCrap($argv[1] === 'true' ? true : false, $argv[2], isset($argv[3]) ? $argv[3] : '', isset($blacklistID) ? $argv[4] : '');
Ejemplo n.º 3
0
<?php

require_once './config.php';
$page = new AdminPage();
$page->title = "Delete Releases";
$page->smarty->assign(array('error', 'done'), '');
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        $values = parseResponse($_POST);
        if ($values === false) {
            $page->smarty->assign('error', 'Your search criteria is wrong.');
        } else {
            $RR = new ReleaseRemover(['Browser' => true, 'Settings' => $page->settings]);
            $succeeded = $RR->removeByCriteria($values);
            if (is_string($succeeded) && substr($succeeded, 0, 7) === 'Success') {
                $page->smarty->assign('done', $succeeded);
            } else {
                $page->smarty->assign('error', $succeeded);
            }
        }
        $release = array();
        foreach ($_POST as $key => $value) {
            $release[$key] = $value;
        }
        $page->smarty->assign('release', $release);
        break;
    case 'view':
    default:
        $release = array('name' => '', 'searchname' => '', 'fromname' => '', 'groupname' => '', 'relsize' => '', 'adddate' => '', 'postdate' => '', 'relguid' => '', 'completion' => '', 'nametypesel' => '1', 'snametypesel' => '1', 'fnametypesel' => '1', 'gnametypesel' => '1', 'sizetypesel' => '0', 'adatetypesel' => '0', 'pdatetypesel' => '0');