File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1447,6 +1447,52 @@ public static function get()
14471447 SET short_description = \'Not reached \'
14481448 WHERE activity_type_id = 100;
14491449 ' ,
1450+ '377 ' => 'PHP:
1451+ $lastActivityID = 0;
1452+ $batchSize = 200;
1453+
1454+ while (true)
1455+ {
1456+ $rows = $db->getAllAssoc(
1457+ "SELECT activity_id, notes
1458+ FROM activity
1459+ WHERE activity_id > " . (int) $lastActivityID . "
1460+ AND notes LIKE \'%<span% \'
1461+ AND notes LIKE \'%#ff6c00% \'
1462+ ORDER BY activity_id ASC
1463+ LIMIT " . (int) $batchSize
1464+ );
1465+
1466+ if (empty($rows))
1467+ {
1468+ break;
1469+ }
1470+
1471+ foreach ($rows as $row)
1472+ {
1473+ $activityID = (int) $row[ \'activity_id \'];
1474+ $lastActivityID = $activityID;
1475+ $notes = $row[ \'notes \'];
1476+
1477+ $cleanedNotes = preg_replace(
1478+ "/<span \\b(?=[^>]* \\bstyle \\s*= \\s*([ \\\" \\\'])[^ \\\" \\\']* \\bcolor \\s*: \\s*#ff6c00 \\b[^ \\\" \\\']* \\1)[^>]*>(.*?)< \\/span>/is",
1479+ "$2",
1480+ $notes
1481+ );
1482+
1483+ if ($cleanedNotes === null || $cleanedNotes === $notes)
1484+ {
1485+ continue;
1486+ }
1487+
1488+ $db->query(
1489+ "UPDATE activity
1490+ SET notes = " . $db->makeQueryString($cleanedNotes) . "
1491+ WHERE activity_id = " . $activityID
1492+ );
1493+ }
1494+ }
1495+ ' ,
14501496
14511497 );
14521498 }
You can’t perform that action at this time.
0 commit comments