| @@ 291-303 (lines=13) @@ | ||
| 288 | $log->endAction($msg); |
|
| 289 | return; |
|
| 290 | } |
|
| 291 | foreach ($tables->$tableName as $group => $contents) { |
|
| 292 | if (isset($tables->$tableName->$group->$key)) { |
|
| 293 | // remove the entry |
|
| 294 | unset($tables->$tableName->$group->$key); |
|
| 295 | ||
| 296 | // remove the table if it's empty |
|
| 297 | if (!count(get_object_vars($tables->$tableName->$group))) { |
|
| 298 | $log->addStep("table group '{$tableName}->{$group}' is empty, removing from runtime config", function() use ($tables, $tableName, $group){ |
|
| 299 | unset($tables->$tableName->$group); |
|
| 300 | }); |
|
| 301 | } |
|
| 302 | } |
|
| 303 | } |
|
| 304 | // save the changes |
|
| 305 | $this->st->saveRuntimeConfig(); |
|
| 306 | ||
| @@ 305-318 (lines=14) @@ | ||
| 302 | } |
|
| 303 | ||
| 304 | $groupNames = (array_keys($groups)); |
|
| 305 | foreach ($groupNames as $groupName) { |
|
| 306 | $group = $tables->$tableName->$targetEnv->$groupName; |
|
| 307 | if (isset($group->$key)) { |
|
| 308 | // remove the entry |
|
| 309 | unset($group->$key); |
|
| 310 | } |
|
| 311 | ||
| 312 | // remove the table if it's empty |
|
| 313 | if (!count(get_object_vars($tables->$tableName->$targetEnv->$groupName))) { |
|
| 314 | $log->addStep("table group '{$tableName}->{$targetEnv}->{$groupName}' is empty, removing from runtime config", function() use ($tables, $tableName, $targetEnv, $groupName){ |
|
| 315 | unset($tables->$tableName->$targetEnv->$groupName); |
|
| 316 | }); |
|
| 317 | } |
|
| 318 | } |
|
| 319 | ||
| 320 | // save the changes |
|
| 321 | $this->st->saveRuntimeConfig(); |
|