Delete.php 804 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * This file is part of the ForkBB <https://github.com/forkbb>.
  4. *
  5. * @copyright (c) Visman <mio.visman@yandex.ru, https://github.com/MioVisman>
  6. * @license The MIT License (MIT)
  7. */
  8. declare(strict_types=1);
  9. namespace ForkBB\Models\Group;
  10. use ForkBB\Models\Action;
  11. use ForkBB\Models\Group\Group;
  12. class Delete extends Action
  13. {
  14. /**
  15. * Удаляет группу
  16. */
  17. public function delete(Group $group, Group $new = null): void
  18. {
  19. if (null !== $new) {
  20. $this->c->users->promote($group, $new);
  21. }
  22. $this->manager->Perm->delete($group);
  23. $vars = [
  24. ':gid' => $group->g_id,
  25. ];
  26. $query = 'DELETE
  27. FROM ::groups
  28. WHERE g_id=?i:gid';
  29. $this->c->DB->exec($query, $vars);
  30. }
  31. }