Conditions | 3 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function run($request) |
||
15 | { |
||
16 | Config::inst()->update('DataObject', 'validation_enabled', false); |
||
|
|||
17 | $ct = 0; |
||
18 | $updateEmail = function ($location) use (&$ct) { |
||
19 | if (!$location->Email && $location->EmailAddress) { |
||
20 | $location->Email = $location->EmailAddress; |
||
21 | $location->write(); |
||
22 | ++$ct; |
||
23 | } |
||
24 | }; |
||
25 | Location::get()->each($updateEmail); |
||
26 | Config::inst()->update('DataObject', 'validation_enabled', true); |
||
27 | echo '<p>'.$ct.' Locations updated</p>'; |
||
28 | } |
||
30 |