Skip to content

Commit

Permalink
Borrar una organización
Browse files Browse the repository at this point in the history
  • Loading branch information
ijaureguialzo committed Jul 6, 2024
1 parent 8d7d503 commit 68c87dd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/GiteaClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,4 +540,37 @@ public static function organization($name, $owner)
}
return false;
}

public static function borrar_organizacion($organization)
{
self::init();

try {
// Borrar los repositorios de la organizaciób
$repos = self::repos_usuario($organization);
while (count($repos) > 0) {
foreach ($repos as $repo) {
self::$cliente->delete('repos/' . $repo['owner']['username'] . '/' . $repo['name'], [
'headers' => self::$headers
]);
}

$repos = self::repos_usuario($organization);
}

// Borrar la organización
self::$cliente->delete('orgs/' . $organization, [
'headers' => self::$headers
]);

Log::info('Gitea: Organización borrada.', [
'organization' => $organization
]);
} catch (\Exception $e) {
Log::error('Gitea: Error al borrar la organización.', [
'organization' => $organization,
'exception' => $e->getMessage()
]);
}
}
}

0 comments on commit 68c87dd

Please sign in to comment.