Add patch and edit processReleases class to add entries to releases_regexes table

This commit is contained in:
DariusIII
2017-02-14 14:34:23 +01:00
parent 86b54e617d
commit ae19f3a2bd
4 changed files with 24 additions and 0 deletions
+2
View File
@@ -1,3 +1,5 @@
2017-02-14 DariusIII
* Chg: Add model for new releases_regexes table
2017-02-13 DariusIII
* Chg: Add bad regex logging (bad regex, not regex with 0 matches)
* Chg: Improve performance by doing poster check in PHP instead of single row MySQL queries (by b3rs3rk@nZEDb)
+10
View File
@@ -3,6 +3,7 @@ namespace nntmux\processing;
use app\models\MultigroupPosters;
use app\models\ReleasesGroups;
use app\models\ReleasesRegexes;
use app\models\Settings;
use nntmux\Categorize;
use nntmux\Category;
@@ -686,6 +687,15 @@ class ProcessReleases
)
);
// Add the id of regex that matched the collection to releases_regexes table
$releasesRegexes = ReleasesRegexes::create(
[
'releases_id' => $releaseID,
'regex_id' => $collection['collections_regexes_id'],
]
);
$releasesRegexes->save();
if (preg_match_all('#(\S+):\S+#', $collection['xref'], $matches)) {
foreach ($matches[1] as $grp) {
//check if the group name is in a valid format
@@ -0,0 +1,12 @@
# Create the new releases_regexes table
DROP TABLE IF EXISTS releases_regexes;
CREATE TABLE releases_regexes (
releases_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
regex_id INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (releases_id, regex_id)
)
ENGINE = MYISAM
DEFAULT CHARSET = utf8
COLLATE = utf8_unicode_ci
AUTO_INCREMENT = 1;