Introduction
The company I’m working for I’m administrating a JIRA instance which is being used as an internal bugtracker.
Lately we’ve opened-up JIRA to the public and use it as a platform for part of our product.
There’s unfortunately one problem with that: Being a rather small company (with less than 20 employees) we develop our product for a large number of customers who only pay for the product once (no reoccurring costs). The cost is also quite low (around 10-50 Euro) if you compare this to the prices of larger products. If I had to guess, I’d assume we have a customer base which goes into the hundreds of thousands of users.
Compare this to other companies and you get a slight idea why we can not afford an unlimited JIRA license (which, at the time of writing this, would cost us $24,000 plus $12,000 every year, while our current 25 user license only costs $1,200 plus $600 per maintenance renewal).
Since the unlimited user license is out of question for us, we allowed anonymous access to our JIRA instance for some of the projects. That allows our user base to create and comment on issues directly in our bugtracker.
Unfortunately, allowing anonymous access in JIRA has one bad side effect: It also opens up the bugtracker to spammers, since it no-longer requires you to log-in before adding comments or creating issues.
For several months this worked out until a few days ago, when some spambot detected our instance and started created spam comments (around 1,500 the first day and another 5,000 the other day).
JIRA is really a great tool IMHO but understandably the product’s and company’s focus is directed towards larger companies. That’s also most likely the reason why there is almost no built-in protection against spam. Presumably most customers do not use the anonymous access and rather buy the unlimited license so that their users simply create their own accounts, while requests for improvements for anonymous spam protection have been on record for years already (see: JIRA issue 10236 and JIRA issue 8000).
But what do you do if you want to allow anonymous access and run into the situation of a spambot having created a shitload of comments on your instance? Deleting >5,000 comments manually is certainly not an option (that’s roughly 10,000 mouse-clicks to get rid of all the entries 🙂 ).
My first idea was obviously to alter the JIRA DB entries directly, but that certainly is not supported and bares a certain risk of breaking things, if you don’t know all the details of the DB structure.
Fortunately, I discovered a post from Henning Tietgens. Based on his post I was able to adjust his provided script to get rid of all the comments in just a few hours work.
How to bulk remove comments in JIRA?
(The following instructions were tested on JIRA 6.0.8. They might however also work for any later (or even earlier) version of JIRA).
Make sure you have a backup of your JIRA instance to be on the safe side in-case anything goes wrong with the script. While the description worked for me, it was only tested on a single instance and I can’t give any warranty at all.
- In the JIRA instance go to the Add-Ons Manager (CogIcon -> Addons -> Find New Add-Ons) or use the following link: http://[yourJIRAInstanceURL]/plugins/servlet/upm/marketplace
- In the search box enter “Script Runner”. This should bring-up the “ScriptRunner for JIRA Standard Edition” as the first entry. Click on Install to install the add-on
- On the admin panel you’d now see a new section (on the Add-Ons tab) called Script Runner. Click on Script Console.
- On this screen select Groovy as the Script engine, copy/paste the script provided below into the script frame, adjust the issueKey to the one which contains the spam comments, replace “Foo Bar Comment” with some entry in the spammer’s comment and click on Run Now.
123456789101112131415161718import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.IssueManagerimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.issue.comments.Commentimport com.atlassian.jira.issue.comments.CommentManagerString issueKey = 'FOOBAR-10'IssueManager issueManager = ComponentAccessor.issueManagerCommentManager commentManager = ComponentAccessor.commentManagerMutableIssue issue = issueManager.getIssueObject(issueKey)List<Comment> comments = commentManager.getComments(issue)comments.each {comment ->if (comment.body.contains('Foo Bar Comment')) {commentManager.delete(comment)}}
Voila. That’s it. All comments containing the phrase you specified above in the given issue should be gone.
Following is also the script (updated 08/19/15) I ran on our instance to clean-up all the spammers comments (based on the URLs the spambot entered in the comments).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.comments.Comment import com.atlassian.jira.issue.comments.CommentManager String issueKey = 'FOOBAR-10' IssueManager issueManager = ComponentAccessor.issueManager CommentManager commentManager = ComponentAccessor.commentManager MutableIssue issue = issueManager.getIssueObject(issueKey) List<Comment> comments = commentManager.getComments(issue) comments.each {comment -> if (comment.body.contains('http://www.olympiacycleomaha.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.tecnotelevision.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.oliver-sinz.de')) { commentManager.delete(comment) } else if (comment.body.contains('http://rentamom.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.sniderscyclery.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://modernhomeauction.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://souleye.se')) { commentManager.delete(comment) } else if (comment.body.contains('http://parametricmodel.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://graceibc.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.armanios.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.malaysiaflora.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.salomontrailtour.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://efjakarta.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.antabusebuy.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://akss.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://villave.no')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.diabeticcareassociates.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://buyventolin.info')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.heycupcakebakery.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.commonstudio.pl')) { commentManager.delete(comment) } else if (comment.body.contains('https://www.ijmuk.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.drijendesigns.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://lynnefreeman.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.intwinedbows.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.jugarcasinoonline.co')) { commentManager.delete(comment) } else if (comment.body.contains('http://paxil.info')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.whiteslaw.com.au')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.irishmaritimelaw.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.davehebb.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.marcovernaschi.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.cleanmedeurope.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://buffalovisiongames.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.elsiemagazine.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://fundraisingboxes.ie')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.dreambulgarianproperty.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.bigredtank.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.piritubafuscaclub.com.br')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.overheardinpittsburgh.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.ymirbc.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.iobm.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.maxicrop.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.trumbly.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.winsorcreative.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.borytucholskie.las.pl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.thecanoeman.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.allhotelsnepal.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fivepointsnacks.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.intrige.nl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.graphicdetail.co.nz')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.smhv.nl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fabulousfordsforever.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.waynehastings.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fuzzyfocus.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.gagaku.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.samhardenburgh.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.indiamanufacturingshow.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://coactiv.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.jmktrust.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.bristolcyclingcampaign.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.glasfryn.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.mediagang.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.rehabilitacja-amed.pl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.aslan.ie')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.thinkcms.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://modtriangle.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.ctahperd.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.ethical-pets.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('https://www.manxfarmcottages.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.iamcreative.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.gesitra-seimc.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.stypendia-bialystok.pl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.iniomusic.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.flyeauclaire.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://ferso.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://teawithanarchitect.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.ccborobia.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://teawithanarchitect.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.adrenalicia.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://midwestdrafting.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://mobilewebghana.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.rpptl.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://madebywe.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.pizzaamorewoodfire.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.7pennies.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://globalenglish.co.il')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.wetyourpantsfilmfest.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.lynnlyonsnh.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.cellogel.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://amazinglist.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.townofcaroline.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://arsitektur.upi.edu')) { commentManager.delete(comment) } else if (comment.body.contains('http://buycytotec.storemeds.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://donterra.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://escenadigital.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://fipac.ca')) { commentManager.delete(comment) } else if (comment.body.contains('http://greenhomeoregon.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://jubileetroupe.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://playground.danielvasquez.cl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.alternative-regionalisms.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.armandobayolo.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.aufildujeu.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.bergstatt.at')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.civilprocedurereview.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.consumosolidario.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fundacionmasaveu.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.governmentbudgetofficersurvey.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.greatnoiseensemble.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.greenmountaincreamery.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.japansociety-ni.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.larneda.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.medicallab.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.nickscullion.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.piscesttjobs.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.pujcovnachmela.cz')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.queenofsmalladventures.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.texascremationservices.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.tomitadesigns.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.oakleymentalhealth.co.nz')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.ucheducationcentre.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.studio.langford.co.il')) { commentManager.delete(comment) } else if (comment.body.contains('http://lettertoadisciple.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.myriam-gourfink.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.internet-casinos.es')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.lynnesdesigns.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.athenaadvisors.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://landofthewaterfalls.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://anestasiavodka.com')) { commentManager.delete(comment) } else if (comment.body.contains('https://ummgc.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://uberdorkdesigns.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.2seotons.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.azurrestaurant.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fitxpress.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.phoebe-berlin.de')) { commentManager.delete(comment) } else if (comment.body.contains('http://michigansportscenter.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.uberdorkcafe.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://meamaximaculpa.ie')) { commentManager.delete(comment) } else if (comment.body.contains('http://buycytotec.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.janedakool.ee')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.buynaltrexone.info')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.highlineathleticclub.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.criminallawonline.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.crickethillwinery.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.khsauter.de')) { commentManager.delete(comment) } else if (comment.body.contains('http://nation-branding.info')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.museeaustralien.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.empex.pl')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.hagada.pl')) { commentManager.delete(comment) } else if (comment.body.contains('http://beyond-digital.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.chriskeam.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.johnbarry.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.thinkgenealogy.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.beyond-digital.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.adsprecision.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.crisishq.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://tulsacf.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://bowhunterwebsites.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.currentconservation.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.biodiesel.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://dematosryan.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.facturaok.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.sleepinischeatin.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.hysens.eu')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.carriagecrossing.ca')) { commentManager.delete(comment) } else if (comment.body.contains('http://tedxbrum.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.thesmetimes.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://cotswoldgold.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.karhuski.fi')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.mercachem.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.choosecornish.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.twindots.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://clueb.it')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.icbonline.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://lovl.ee')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.adityamooley.net')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.petersencreative.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://berkshiresailing.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.feritbulut.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.eduxconsult.com.br')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.weeboos.nl')) { commentManager.delete(comment) } else if (comment.body.contains('http://ailleriverhosteldoolin.ie')) { commentManager.delete(comment) } else if (comment.body.contains('http://ninemeds.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://annbrandeis.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://feops.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://thefratellis.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://theacceleratornetwork.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.hurricanemedia.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://cymhin.offordcentre.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.lullinferrari.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.medasil.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.dinebirmingham.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.amblesideac.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.champoegnursery.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.emilyballatseawhite.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('https://diverseabilities.org.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.circle-one.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.tomandsteve.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.varosvillage.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://idealcases.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://fit2rundirect.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.dr-pap.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.fasrm.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.bvpanthers.com.au')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.meridianwest.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://bucintoro.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://theplanets.org')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.racingtoregister.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.cygnetmarquees.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://aidenbyrne.co.uk')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.el-tom.de')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.pitturaedintorni.it')) { commentManager.delete(comment) } else if (comment.body.contains('http://teamkbs.com')) { commentManager.delete(comment) } else if (comment.body.contains('http://www.restorantfloga.com')) { commentManager.delete(comment) } } |
Bare in mind to double-check the URLs before running it against your instance. Since spambots tend to use also just completely normal URLs (so to hide which URLs they actually want to spam), it’s quite possible that in your case the script would remove absolutely fine comments as well.