| Conditions | 7 |
| Paths | 5 |
| Total Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function run($request) |
||
| 11 | { |
||
| 12 | echo "<h1>Total count: ".CountryPrice::get()->count()."</h1>"; |
||
| 13 | increase_time_limit_to(3600); |
||
| 14 | increase_memory_limit_to('512M'); |
||
| 15 | for ($i = 0; $i < 1000000; $i = $i + 100) { |
||
| 16 | $objects = CountryPrice::get()->limit(100, $i); |
||
| 17 | if ($objects->count() == 0) { |
||
| 18 | echo "<h1>Total count in the end: ".CountryPrice::get()->count()."</h1>"; |
||
| 19 | die("=========================== THE END ============================="); |
||
| 20 | } |
||
| 21 | flush(); |
||
| 22 | ob_end_flush(); |
||
| 23 | DB::alteration_message("<h2>Limit $i, 100</h2>"); |
||
| 24 | ob_start(); |
||
| 25 | foreach ($objects as $object) { |
||
| 26 | if ($object->Price == 0 || !$object->Buyable() || $object->isObsolete()) { |
||
| 27 | flush(); |
||
| 28 | ob_end_flush(); |
||
| 29 | DB::alteration_message("Deleting object: ".$object->ID, "deleted"); |
||
| 30 | ob_start(); |
||
| 31 | $object->delete(); |
||
| 32 | DB::query("DELETE FROM CountryPrice WHERE ID = ".$object->ID); |
||
| 33 | } else { |
||
| 34 | flush(); |
||
| 35 | ob_end_flush(); |
||
| 36 | DB::alteration_message("object OK: ".$object->ID, "created"); |
||
| 37 | ob_start(); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 |