mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:01:24 +00:00
Update composer
This commit is contained in:
Generated
+5
-5
@@ -1061,16 +1061,16 @@
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/materialize",
|
||||
"version": "v0.98.1",
|
||||
"version": "v0.98.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Dogfalo/materialize.git",
|
||||
"reference": "2a27dc5fc5745001986055fdf3985aef32fa2def"
|
||||
"reference": "138be0b945cc8e1ee24d76ab6c1240c3f3628565"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Dogfalo/materialize/zipball/2a27dc5fc5745001986055fdf3985aef32fa2def",
|
||||
"reference": "2a27dc5fc5745001986055fdf3985aef32fa2def",
|
||||
"url": "https://api.github.com/repos/Dogfalo/materialize/zipball/138be0b945cc8e1ee24d76ab6c1240c3f3628565",
|
||||
"reference": "138be0b945cc8e1ee24d76ab6c1240c3f3628565",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3895,7 +3895,7 @@
|
||||
"source": "https://github.com/UnionOfRAD/manual/tree/1.1",
|
||||
"issues": "https://github.com/UnionOfRAD/manual/issues"
|
||||
},
|
||||
"time": "2016-05-31 20:16:51"
|
||||
"time": "2016-05-31T20:16:51+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require_once dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
|
||||
use nntmux\ReleaseCleaning;
|
||||
use nntmux\SphinxSearch;
|
||||
use nntmux\db\DB;
|
||||
|
||||
$message =
|
||||
'Shows old searchname vs new searchname for releases in a group using the releaseCleaning class. (Good for testing new regex)' .
|
||||
PHP_EOL .
|
||||
'Argument 1 is the group name.' . PHP_EOL .
|
||||
'Argument 2 is how many releases to limit this to, must be a number.' . PHP_EOL .
|
||||
'Argument 3 (true|false) true renames the releases, false only displays what could be changed.' . PHP_EOL .
|
||||
'Argument 4 is a categoryID, pass 0 to do all, 0010 to do misc, etc.' . PHP_EOL .
|
||||
'php ' . $argv[0] . ' alt.binaries.comics.dcp 1000 false' . PHP_EOL;
|
||||
|
||||
if ($argc < 5) {
|
||||
exit($message);
|
||||
}
|
||||
if (!is_numeric($argv[2]) || !is_numeric($argv[4])) {
|
||||
exit($message);
|
||||
}
|
||||
if (!in_array($argv[3], ['true', 'false'], false)) {
|
||||
exit($message);
|
||||
}
|
||||
|
||||
$category = '';
|
||||
if ($argv[4] !== '0' && strlen($argv[4]) === 4) {
|
||||
$category = 'AND categories_id = ' . $argv[4];
|
||||
}
|
||||
|
||||
$rename = false;
|
||||
if ($argv[3] === 'true') {
|
||||
$rename = true;
|
||||
}
|
||||
|
||||
$pdo = new DB();
|
||||
|
||||
$group = $pdo->queryOneRow(sprintf('SELECT id FROM groups WHERE name = %s', $pdo->escapeString($argv[1])));
|
||||
|
||||
if ($group === false) {
|
||||
exit('No group with name ' . $argv[1] . ' found in the database.');
|
||||
}
|
||||
|
||||
$releases = $pdo->query(sprintf('SELECT name, searchname, fromname, size, id FROM releases WHERE groups_id = %d %s ORDER BY postdate LIMIT %d', $group['id'], $category, $argv[2]));
|
||||
|
||||
if (count($releases) === 0) {
|
||||
exit('No releases found in your database for group ' . $argv[1] . PHP_EOL);
|
||||
}
|
||||
|
||||
$RC = new ReleaseCleaning($pdo);
|
||||
$sphinx = new SphinxSearch();
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$newName = $RC->releaseCleaner($release['name'], $release['fromname'], $release['size'], $argv[1]);
|
||||
if (is_array($newName)) {
|
||||
$newName = $newName['cleansubject'];
|
||||
}
|
||||
if ($newName !== $release['searchname']) {
|
||||
echo 'Old name: ' . $release['searchname'] . PHP_EOL;
|
||||
echo 'New name: ' . $newName . PHP_EOL . PHP_EOL;
|
||||
|
||||
if ($rename === true) {
|
||||
$newName = $pdo->escapeString($newName);
|
||||
$pdo->queryExec(sprintf('UPDATE releases SET searchname = %s WHERE id = %d', $newName, $release['id']));
|
||||
$sphinx->updateRelease($release['id'], $pdo);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user