@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $objects = SiteTree::get()->sort(['ID' => 'ASC'])->limit($this->step, $i + $start); |
| 96 | 96 | } |
| 97 | 97 | $filter = $this->Config()->get('filtered_class_names'); |
| 98 | - if (! empty($filter)) { |
|
| 98 | + if (!empty($filter)) { |
|
| 99 | 99 | $objects = $objects->filter($filter); |
| 100 | 100 | } |
| 101 | 101 | foreach ($objects as $object) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ++$this->count; |
| 150 | 150 | $links = []; |
| 151 | 151 | foreach ($this->fieldsToTest as $field) { |
| 152 | - if (! empty($object->{$field})) { |
|
| 152 | + if (!empty($object->{$field})) { |
|
| 153 | 153 | $dom = new \DOMDocument(); |
| 154 | 154 | |
| 155 | 155 | @$dom->loadHTML( |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | // |
| 162 | 162 | // continue; |
| 163 | 163 | // } |
| 164 | - if (! $this->type || 'a' === strtolower($this->type)) { |
|
| 164 | + if (!$this->type || 'a' === strtolower($this->type)) { |
|
| 165 | 165 | $hrefs = $dom->getElementsByTagName('a'); |
| 166 | 166 | for ($i = 0; $i < $hrefs->length; ++$i) { |
| 167 | 167 | $href = $hrefs->item($i); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $links[$url] = $url . ' | A | ' . $field; |
| 172 | 172 | |
| 173 | - if (! isset($this->allLinks[$url])) { |
|
| 173 | + if (!isset($this->allLinks[$url])) { |
|
| 174 | 174 | $this->allLinks[$url] = [ |
| 175 | 175 | 'count' => 0, |
| 176 | 176 | 'type' => 'A', |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | ++$this->allLinks[$url]['count']; |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | - if (! $this->type || 'img' === strtolower($this->type)) { |
|
| 182 | + if (!$this->type || 'img' === strtolower($this->type)) { |
|
| 183 | 183 | $hrefs = $dom->getElementsByTagName('img'); |
| 184 | 184 | for ($i = 0; $i < $hrefs->length; ++$i) { |
| 185 | 185 | $href = $hrefs->item($i); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $links[$url] = $url . ' | IMG | ' . $field; |
| 190 | 190 | |
| 191 | - if (! isset($this->allLinks[$url])) { |
|
| 191 | + if (!isset($this->allLinks[$url])) { |
|
| 192 | 192 | $this->allLinks[$url] = [ |
| 193 | 193 | 'count' => 0, |
| 194 | 194 | 'type' => 'IMG', |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | //check all classes |
| 80 | 80 | foreach ($objectClassNames as $objectClassName) { |
| 81 | - if (count($this->onlyRunFor) && ! in_array($objectClassName, $this->onlyRunFor, true)) { |
|
| 81 | + if (count($this->onlyRunFor) && !in_array($objectClassName, $this->onlyRunFor, true)) { |
|
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | 84 | $fields = $this->dataObjectSchema->databaseFields($objectClassName, false); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->flushNow('... ' . $objectClassName . ' POTENTIALLY has a table with a full class name: ' . $tableName . ' it is recommended that you set the private static table_name', 'error'); |
| 94 | 94 | $allOK = false; |
| 95 | 95 | } |
| 96 | - if (! $tableName) { |
|
| 96 | + if (!$tableName) { |
|
| 97 | 97 | $this->flushNow('... Can not find: ' . $objectClassName . '.table_name in code ', 'error'); |
| 98 | 98 | $allOK = false; |
| 99 | 99 | } elseif ($this->tableExists($tableName)) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | ORDER BY C DESC' |
| 167 | 167 | ); |
| 168 | 168 | foreach ($rows as $row) { |
| 169 | - if (! $row[$fieldName]) { |
|
| 169 | + if (!$row[$fieldName]) { |
|
| 170 | 170 | $row[$fieldName] = '--- NO VALUE ---'; |
| 171 | 171 | } |
| 172 | 172 | $this->flushNow('... ... ' . $row['C'] . ' ' . $row[$fieldName]); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | foreach ($options as $key => $optionClassName) { |
| 197 | 197 | if ($optionClassName !== $objectClassName) { |
| 198 | 198 | $optionTableName = $this->dataObjectSchema->tableName($objectClassName); |
| 199 | - if (! $this->tableExists($optionTableName) || $optionTableName === $tableName) { |
|
| 199 | + if (!$this->tableExists($optionTableName) || $optionTableName === $tableName) { |
|
| 200 | 200 | unset($options[$key]); |
| 201 | 201 | } else { |
| 202 | 202 | $checkTables[$optionClassName] = $optionTableName; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | if (0 === $optionCount) { |
| 228 | - if (! $row[$fieldName]) { |
|
| 228 | + if (!$row[$fieldName]) { |
|
| 229 | 229 | $row[$fieldName] = '--- NO VALUE ---'; |
| 230 | 230 | } |
| 231 | 231 | $this->flushNow('... Updating ' . $fieldName . ' to ' . $objectClassName . ' for ID = ' . $row['ID'] . ' from ' . $fieldName . ' = ' . $row[$fieldName] . ' - based on inability to find matching IDs in any child class tables', 'created'); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | protected function bestClassName(string $objectClassName, string $tableName, string $fieldName): string |
| 290 | 290 | { |
| 291 | 291 | $keyForStore = $objectClassName . '_' . $tableName . '_' . $fieldName; |
| 292 | - if (! isset($this->bestClassNameStore[$keyForStore])) { |
|
| 292 | + if (!isset($this->bestClassNameStore[$keyForStore])) { |
|
| 293 | 293 | $obj = Injector::inst() |
| 294 | 294 | ->get($objectClassName) |
| 295 | 295 | ; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | break; |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | - if (! $bestValue) { |
|
| 322 | + if (!$bestValue) { |
|
| 323 | 323 | $bestValue = key($values); |
| 324 | 324 | } |
| 325 | 325 | $this->bestClassNameStore[$keyForStore] = $bestValue; |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | foreach ($liveRows as $liveRow) { |
| 78 | 78 | $results = array_diff($draftRow, $liveRow) + array_diff($liveRow, $draftRow); |
| 79 | 79 | foreach (array_keys($results) as $key) { |
| 80 | - if (! isset($draftRow[$key])) { |
|
| 80 | + if (!isset($draftRow[$key])) { |
|
| 81 | 81 | $draftRow[$key] = '???'; |
| 82 | 82 | } |
| 83 | - if (! isset($liveRow[$key])) { |
|
| 83 | + if (!isset($liveRow[$key])) { |
|
| 84 | 84 | $liveRow[$key] = '???'; |
| 85 | 85 | } |
| 86 | 86 | $allOk = false; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'deleted' |
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | - if (! $backwards) { |
|
| 128 | + if (!$backwards) { |
|
| 129 | 129 | $this->compareColumnsInner($rowB, $rowA, $table, true); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | if (file_exists($fullSubDir)) { |
| 46 | 46 | $toAdds = $this->getYMLFiles($fullSubDir); |
| 47 | 47 | foreach ($toAdds as $toAdd) { |
| 48 | - if (! in_array(basename($toAdd), $this->Config()->get('files_to_ignore'), true)) { |
|
| 48 | + if (!in_array(basename($toAdd), $this->Config()->get('files_to_ignore'), true)) { |
|
| 49 | 49 | $ymlFiles[] = $toAdd; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | $this->flushNowLine(); |
| 58 | 58 | $count = 0; |
| 59 | 59 | $alreadySet = []; |
| 60 | - if (! file_exists($fileName)) { |
|
| 60 | + if (!file_exists($fileName)) { |
|
| 61 | 61 | die(' Could not find ' . $fileName); |
| 62 | 62 | } |
| 63 | 63 | $fp = fopen($fileName, 'r'); |
| 64 | 64 | $hasLine = true; |
| 65 | 65 | while ($hasLine) { |
| 66 | 66 | $line = stream_get_line($fp, 1024 * 1024, "\n"); |
| 67 | - if (! $line) { |
|
| 67 | + if (!$line) { |
|
| 68 | 68 | break; |
| 69 | 69 | } |
| 70 | 70 | ++$count; |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | $property = trim($myItems[0], "'"); |
| 86 | 86 | $property = trim($myItems[0], '"'); |
| 87 | 87 | if (strpos($property, '\\')) { |
| 88 | - if (! class_exists($property)) { |
|
| 88 | + if (!class_exists($property)) { |
|
| 89 | 89 | $this->flushNow(' |
| 90 | 90 | ERROR ' . $className . '.' . $property . ' may not exist as class name but looks like one.<br>'); |
| 91 | 91 | } |
| 92 | 92 | } elseif (strpos($property, '*')) { |
| 93 | 93 | $this->flushNow(' |
| 94 | 94 | ERROR ' . $className . '.' . $property . ' contains *.<br>'); |
| 95 | - } elseif (! property_exists($className, $property)) { |
|
| 95 | + } elseif (!property_exists($className, $property)) { |
|
| 96 | 96 | $this->flushNow(' |
| 97 | 97 | ERROR ' . $className . '.' . $property . ' property could not be found<br>'); |
| 98 | 98 | } else { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | COULD NOT FIND ' . $className . '<br>'); |
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | - if (! strpos($line, '\\')) { |
|
| 115 | + if (!strpos($line, '\\')) { |
|
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | if (strpos($line, '*')) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ERROR: Two mentions of ' . $line . '<br>'); |
| 127 | 127 | } else { |
| 128 | 128 | $alreadySet[$line] = $line; |
| 129 | - if (! class_exists($line)) { |
|
| 129 | + if (!class_exists($line)) { |
|
| 130 | 130 | $this->flushNow(' |
| 131 | 131 | |
| 132 | 132 | ERROR: Could not find class ' . $line . '<br>'); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | // $subDir = array_merge($subDir, $directories); |
| 154 | 154 | // Foreach directory, recursively get and add sub directories |
| 155 | 155 | foreach ($directories as $directory) { |
| 156 | - if (! in_array(basename($directory), $ignore, true)) { |
|
| 156 | + if (!in_array(basename($directory), $ignore, true)) { |
|
| 157 | 157 | $subDirs[] = $directory; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -68,13 +68,13 @@ |
||
| 68 | 68 | $values = []; |
| 69 | 69 | //check all classes |
| 70 | 70 | foreach ($this->objectClassNames as $objectClassName) { |
| 71 | - if (count($this->onlyRunFor) && ! in_array($objectClassName, $this->onlyRunFor, true)) { |
|
| 71 | + if (count($this->onlyRunFor) && !in_array($objectClassName, $this->onlyRunFor, true)) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $summaryFields = Config::inst()->get($objectClassName, 'summary_fields'); |
| 76 | 76 | // $searchableFields = Config::inst()->get($objectClassName, 'searchable_fields'); |
| 77 | - if (! empty($summaryFields)) { |
|
| 77 | + if (!empty($summaryFields)) { |
|
| 78 | 78 | $dbFields = array_keys(Config::inst()->get($objectClassName, 'db')); |
| 79 | 79 | if (count($dbFields) > 5) { |
| 80 | 80 | $recommended = array_intersect($dbFields, $summaryFields); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | if ('' !== $fieldValue) { |
| 172 | 172 | $array = @json_decode($fieldValue, false); |
| 173 | - if (! empty($array)) { |
|
| 173 | + if (!empty($array)) { |
|
| 174 | 174 | $obj = $className::get_by_id($id); |
| 175 | 175 | $lookupClassName = $this->getlookupClassName($className, $lookupMethod); |
| 176 | 176 | $obj->{$lookupMethod}()->removeAll(); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | protected function getTableName(string $className, string $tableExtension): string |
| 207 | 207 | { |
| 208 | 208 | $key = $className . '_' . $tableExtension; |
| 209 | - if (! isset($this->tables[$key])) { |
|
| 209 | + if (!isset($this->tables[$key])) { |
|
| 210 | 210 | $dbtable = Config::inst()->get($className, 'table_name'); |
| 211 | 211 | $tableName = $dbtable . $tableExtension; |
| 212 | 212 | $this->tables[$key] = $tableName; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | protected function getLookupClassName(string $className, string $lookupMethod): string |
| 219 | 219 | { |
| 220 | 220 | $key = $className . '_' . $lookupMethod; |
| 221 | - if (! isset($this->lookupClassNames[$key])) { |
|
| 221 | + if (!isset($this->lookupClassNames[$key])) { |
|
| 222 | 222 | /** @var array $fields */ |
| 223 | 223 | $fields = Config::inst()->get($className, 'has_many'); |
| 224 | 224 | $fields += Config::inst()->get($className, 'many_many'); |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | if ([] !== $data) { |
| 85 | 85 | $this->flushNow('<h3>Migrating data - Core Migration</h3>'); |
| 86 | 86 | foreach ($data as $dataItem) { |
| 87 | - if (! isset($dataItem['include_inserts'])) { |
|
| 87 | + if (!isset($dataItem['include_inserts'])) { |
|
| 88 | 88 | $dataItem['include_inserts'] = true; |
| 89 | 89 | } |
| 90 | - if (! isset($dataItem['leftJoin'])) { |
|
| 90 | + if (!isset($dataItem['leftJoin'])) { |
|
| 91 | 91 | $dataItem['leftJoin'] = []; |
| 92 | 92 | } |
| 93 | - if (! isset($dataItem['where'])) { |
|
| 93 | + if (!isset($dataItem['where'])) { |
|
| 94 | 94 | $dataItem['where'] = ''; |
| 95 | 95 | } |
| 96 | - if (! isset($dataItem['include_inserts'])) { |
|
| 96 | + if (!isset($dataItem['include_inserts'])) { |
|
| 97 | 97 | $dataItem['include_inserts'] = true; |
| 98 | 98 | } |
| 99 | - if (! isset($dataItem['new_table'])) { |
|
| 99 | + if (!isset($dataItem['new_table'])) { |
|
| 100 | 100 | $dataItem['new_table'] = $dataItem['old_table']; |
| 101 | 101 | } |
| 102 | 102 | $dataItem['old_fields'] = []; |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | array $leftJoin = [], |
| 160 | 160 | string $where = '' |
| 161 | 161 | ) { |
| 162 | - if (! $this->tableExists($tableOld)) { |
|
| 162 | + if (!$this->tableExists($tableOld)) { |
|
| 163 | 163 | $this->flushNow("{$tableOld} (old table) does not exist", 'error'); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! $this->tableExists($tableNew)) { |
|
| 166 | + if (!$this->tableExists($tableNew)) { |
|
| 167 | 167 | $this->flushNow("{$tableNew} (new table) does not exist", 'error'); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | //add a new line using the ID as identifier |
| 179 | 179 | foreach ($oldEntries as $oldEntry) { |
| 180 | 180 | if ($includeInserts) { |
| 181 | - if (! in_array($oldEntry['ID'], $newEntryIDs, true)) { |
|
| 181 | + if (!in_array($oldEntry['ID'], $newEntryIDs, true)) { |
|
| 182 | 182 | $this->flushNow('Added row ' . $oldEntry['ID'] . ' to ' . $tableNew . '.'); |
| 183 | 183 | $this->runUpdateQuery('INSERT INTO "' . $tableNew . '" ("ID") VALUES (' . $oldEntry['ID'] . ');'); |
| 184 | 184 | } |
@@ -201,7 +201,7 @@ |
||
| 201 | 201 | { |
| 202 | 202 | if (null === $this->_schema) { |
| 203 | 203 | $this->_schema = DB::get_schema(); |
| 204 | - $this->_schema->schemaUpdate(function () { |
|
| 204 | + $this->_schema->schemaUpdate(function() { |
|
| 205 | 205 | return true; |
| 206 | 206 | }); |
| 207 | 207 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $objects = UserDefinedForm::get(); |
| 53 | 53 | foreach ($objects as $object) { |
| 54 | 54 | $this->flushNow('Publishing ' . $object->getTitle()); |
| 55 | - $isPublished = $object->IsPublished() && !$object->isModifiedOnDraft(); |
|
| 55 | + $isPublished = $object->IsPublished() && !$object->isModifiedOnDraft(); |
|
| 56 | 56 | ; |
| 57 | 57 | $object->writeToStage(Versioned::DRAFT); |
| 58 | 58 | $object->publishRecursive(); |