Created
February 7, 2013 02:04
-
-
Save terwey/4727792 to your computer and use it in GitHub Desktop.
NewzNab's update_releases patch to increase the speed for Stage 7 Apply with: patch -p0 < update_releases.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: www/lib/releases.php | |
=================================================================== | |
1492c1492 | |
< if (preg_match("/\*$/i", $regexrow["groupname"])) | |
--- | |
> if ('*' == substr($regexrow["groupname"], -1)) // twisted // if (preg_match("/\*$/i", $regexrow["groupname"])) | |
1603a1604 | |
> | |
1905a1907 | |
> /* | |
1910a1913,1941 | |
> */ | |
> // | |
> // Create a new table, insert the data we want to keep, drop the old table. | |
> // | |
> $db->query('CREATE TABLE new_parts LIKE parts;'); | |
> if ($db->getAffectedRows() != 0) { die('Creating TABLE new_parts failed');} | |
> $db->query('CREATE TABLE new_binaries LIKE binaries;'); | |
> if ($db->getAffectedRows() != 0) { die('Creating TABLE new_binaries failed');} | |
> $db->query(sprintf("INSERT INTO new_parts SELECT parts.* FROM parts | |
> LEFT JOIN binaries ON binaries.ID = parts.binaryID | |
> WHERE binaries.procstat NOT IN (%d, %d) | |
> AND binaries.dateadded >= %s - INTERVAL %d HOUR", Releases::PROCSTAT_RELEASED, Releases::PROCSTAT_DUPLICATE, $db->escapeString($currTime_ori["now"]), ceil($page->site->rawretentiondays*24))); | |
> if ($db->getAffectedRows() == 0) { die('INSERT INTO new_parts failed');} | |
> $db->query(sprintf("INSERT INTO new_binaries SELECT * FROM binaries | |
> WHERE binaries.procstat NOT IN (%d, %d) | |
> AND binaries.dateadded >= %s - INTERVAL %d HOUR", Releases::PROCSTAT_RELEASED, Releases::PROCSTAT_DUPLICATE, $db->escapeString($currTime_ori["now"]), ceil($page->site->rawretentiondays*24))); | |
> if ($db->getAffectedRows() == 0) { die('INSERT INTO new_binaries failed');} | |
> | |
> $db->query('RENAME TABLE parts TO old_parts, new_parts TO parts;'); | |
> if ($db->getAffectedRows() != 0) { die('Renaming TABLE new_parts to parts failed');} | |
> | |
> $db->query('RENAME TABLE binaries TO old_binaries, new_binaries TO binaries;'); | |
> if ($db->getAffectedRows() != 0) { die('Renaming TABLE new_binaries to binaries failed');} | |
> | |
> $db->query('DROP TABLE old_parts;'); | |
> if ($db->getAffectedRows() != 0) { die('DROP TABLE old_parts failed');} | |
> | |
> $db->query('DROP TABLE old_binaries;'); | |
> if ($db->getAffectedRows() != 0) { die('DROP TABLE old_binaries failed');} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment