Completed
Push — master ( ec8fbc...686b54 )
by Mark
22:56
created
tasks/BuildVFI.php 1 patch
Braces   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,8 +27,12 @@  discard block
 block discarded – undo
27 27
 			$count  = $list->count();
28 28
 			for ($i = $n; $i < $count; $i += 10) {
29 29
 				$chunk = $list->limit(10, $i);
30
-				if (Controller::curr() instanceof TaskRunner) echo "Processing VFI #$i...\n";
31
-				foreach ($chunk as $rec) $rec->rebuildVFI();
30
+				if (Controller::curr() instanceof TaskRunner) {
31
+					echo "Processing VFI #$i...\n";
32
+				}
33
+				foreach ($chunk as $rec) {
34
+					$rec->rebuildVFI();
35
+				}
32 36
 			}
33 37
 			VirtualFieldIndex::build($c);
34 38
 
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 
59 63
 		if (isset($_GET['class']) && isset($_GET['id'])) {
60 64
 			$item = DataObject::get($_GET['class'])->byID($_GET['id']);
61
-			if (!$item || !$item->exists()) die('not found: ' . $_GET['id']);
65
+			if (!$item || !$item->exists()) {
66
+				die('not found: ' . $_GET['id']);
67
+			}
62 68
 			$item->rebuildVFI();
63 69
 			echo "done";
64 70
 			return;
@@ -66,7 +72,9 @@  discard block
 block discarded – undo
66 72
 
67 73
 		if (isset($_GET['link'])) {
68 74
 			$item = SiteTree::get_by_link($_GET['link']);
69
-			if (!$item || !$item->exists()) die('not found: ' . $_GET['link']);
75
+			if (!$item || !$item->exists()) {
76
+				die('not found: ' . $_GET['link']);
77
+			}
70 78
 			$item->rebuildVFI();
71 79
 			echo "done";
72 80
 			return;
@@ -74,8 +82,7 @@  discard block
 block discarded – undo
74 82
 
75 83
 		if (isset($_GET['start'])) {
76 84
 			$this->runFrom($_GET['class'], $_GET['start'], $_GET['field']);
77
-		}
78
-		else {
85
+		} else {
79 86
 			foreach(array('framework','sapphire') as $dirname) {
80 87
 				$script = sprintf("%s%s$dirname%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
81 88
 				if(file_exists($script)) {
@@ -85,7 +92,9 @@  discard block
 block discarded – undo
85 92
 
86 93
 			$classes = VirtualFieldIndex::get_classes_with_vfi();
87 94
 			foreach ($classes as $class) {
88
-				if (isset($_GET['class']) && $class != $_GET['class']) continue;
95
+				if (isset($_GET['class']) && $class != $_GET['class']) {
96
+					continue;
97
+				}
89 98
 				$singleton = singleton($class);
90 99
 				$query = $singleton->get($class);
91 100
 				$dtaQuery = $query->dataQuery();
@@ -100,9 +109,13 @@  discard block
 block discarded – undo
100 109
 				for ($offset = $startFrom; $offset < $total; $offset += $this->stat('recordsPerRequest')) {
101 110
 					echo "$offset..";
102 111
 					$cmd = "php $script dev/tasks/$self class=$class start=$offset field=$field";
103
-					if($verbose) echo "\n  Running '$cmd'\n";
112
+					if($verbose) {
113
+						echo "\n  Running '$cmd'\n";
114
+					}
104 115
 					$res = $verbose ? passthru($cmd) : `$cmd`;
105
-					if($verbose) echo "  ".preg_replace('/\r\n|\n/', '$0  ', $res)."\n";
116
+					if($verbose) {
117
+						echo "  ".preg_replace('/\r\n|\n/', '$0  ', $res)."\n";
118
+					}
106 119
 				}
107 120
 			}
108 121
 		}
Please login to merge, or discard this patch.