File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1442,6 +1442,56 @@ public static function get()
14421442 $db->query("ALTER TABLE `".$row[ \'table_name \']."` ENGINE=InnoDB");
14431443 }
14441444 ' ,
1445+ '376 ' => 'PHP:
1446+ $lastActivityID = 0;
1447+ $batchSize = 200;
1448+ $highlightPattern = "/<span \\b(?=[^>]* \\bstyle \\s*= \\s*([ \\" \\\']).*? \\bcolor \\s*: \\s*#ff6c00 \\s*;?.*? \\1)[^>]*>(.*?)< \\/span>/is";
1449+
1450+ while (true)
1451+ {
1452+ $activityRS = $db->getAllAssoc(
1453+ "SELECT
1454+ activity_id,
1455+ notes
1456+ FROM
1457+ activity
1458+ WHERE
1459+ activity_id > " . $lastActivityID . "
1460+ AND notes LIKE \'%<span% \'
1461+ AND notes LIKE \'%#ff6c00% \'
1462+ ORDER BY
1463+ activity_id ASC
1464+ LIMIT " . $batchSize
1465+ );
1466+
1467+ if (empty($activityRS))
1468+ {
1469+ break;
1470+ }
1471+
1472+ foreach ($activityRS as $rowIndex => $row)
1473+ {
1474+ $updatedNotes = preg_replace($highlightPattern, \'$2 \', $row[ \'notes \']);
1475+
1476+ if ($updatedNotes === null)
1477+ {
1478+ $lastActivityID = (int) $row[ \'activity_id \'];
1479+ continue;
1480+ }
1481+
1482+ if ($updatedNotes !== $row[ \'notes \'])
1483+ {
1484+ $db->query(
1485+ "UPDATE activity
1486+ SET notes = " . $db->makeQueryString($updatedNotes) . "
1487+ WHERE activity_id = " . (int) $row[ \'activity_id \']
1488+ );
1489+ }
1490+
1491+ $lastActivityID = (int) $row[ \'activity_id \'];
1492+ }
1493+ }
1494+ ' ,
14451495
14461496 );
14471497 }
You can’t perform that action at this time.
0 commit comments