From 203d9d5f065983e6779596da3cfbdd3e8153cb32 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 18:20:47 +0530 Subject: [PATCH] Remove console logging from library --- composer.json | 1 - composer.lock | 48 ----------------------------- src/Migration/Destinations/CSV.php | 9 ++++-- src/Migration/Destinations/JSON.php | 9 ++++-- src/Migration/Sources/CSV.php | 9 ++++-- 5 files changed, 21 insertions(+), 55 deletions(-) diff --git a/composer.json b/composer.json index d32957f..3430b0e 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,6 @@ "utopia-php/database": "5.*", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", - "utopia-php/console": "0.0.*", "halaxa/json-machine": "^1.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 1f32dda..ee17709 100644 --- a/composer.lock +++ b/composer.lock @@ -2226,54 +2226,6 @@ }, "time": "2025-01-15T15:15:51+00:00" }, - { - "name": "utopia-php/console", - "version": "0.0.1", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/console.git", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/console/zipball/f77104e4a888fa9cb3e08f32955ec09479ab7a92", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92", - "shasum": "" - }, - "require": { - "php": ">=7.4" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", - "swoole/ide-helper": "4.8.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Console helpers for logging, prompting, and executing commands", - "keywords": [ - "cli", - "console", - "php", - "terminal", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/console/issues", - "source": "https://github.com/utopia-php/console/tree/0.0.1" - }, - "time": "2025-10-20T14:41:36+00:00" - }, { "name": "utopia-php/database", "version": "5.0.0", diff --git a/src/Migration/Destinations/CSV.php b/src/Migration/Destinations/CSV.php index df37f09..8b0acd0 100644 --- a/src/Migration/Destinations/CSV.php +++ b/src/Migration/Destinations/CSV.php @@ -2,7 +2,6 @@ namespace Utopia\Migration\Destinations; -use Utopia\Console; use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Structure; @@ -10,6 +9,7 @@ use Utopia\Migration\Resource as UtopiaResource; use Utopia\Migration\Resources\Database\Row; use Utopia\Migration\Transfer; +use Utopia\Migration\Warning; use Utopia\Storage\Device; use Utopia\Storage\Device\Local; @@ -185,7 +185,12 @@ public function shutdown(): void } finally { // Clean up the temporary directory if (!$this->local->deletePath('') || $this->local->exists($this->local->getRoot())) { - Console::error('Error cleaning up: ' . $this->local->getRoot()); + $this->addWarning(new Warning( + UtopiaResource::TYPE_ROW, + Transfer::GROUP_DATABASES, + 'Error cleaning up: ' . $this->local->getRoot(), + $this->resourceId + )); } } } diff --git a/src/Migration/Destinations/JSON.php b/src/Migration/Destinations/JSON.php index cbb2d0c..9166047 100644 --- a/src/Migration/Destinations/JSON.php +++ b/src/Migration/Destinations/JSON.php @@ -3,7 +3,6 @@ namespace Utopia\Migration\Destinations; use Exception; -use Utopia\Console; use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Structure; @@ -12,6 +11,7 @@ use Utopia\Migration\Resource as UtopiaResource; use Utopia\Migration\Resources\Database\Row; use Utopia\Migration\Transfer; +use Utopia\Migration\Warning; use Utopia\Storage\Device; use Utopia\Storage\Device\Local; @@ -212,7 +212,12 @@ public function shutdown(): void } finally { // Clean up the temporary directory if (!$this->local->deletePath('') || $this->local->exists($this->local->getRoot())) { - Console::error('Error cleaning up: ' . $this->local->getRoot()); + $this->addWarning(new Warning( + UtopiaResource::TYPE_ROW, + Transfer::GROUP_DATABASES, + 'Error cleaning up: ' . $this->local->getRoot(), + $this->resourceId + )); } } } diff --git a/src/Migration/Sources/CSV.php b/src/Migration/Sources/CSV.php index 7aaeaa3..b82e289 100644 --- a/src/Migration/Sources/CSV.php +++ b/src/Migration/Sources/CSV.php @@ -2,7 +2,6 @@ namespace Utopia\Migration\Sources; -use Utopia\Console; use Utopia\Database\Database as UtopiaDatabase; use Utopia\Migration\Exception; use Utopia\Migration\Resource as UtopiaResource; @@ -15,6 +14,7 @@ use Utopia\Migration\Sources\Appwrite\Reader; use Utopia\Migration\Sources\Appwrite\Reader\Database as DatabaseReader; use Utopia\Migration\Transfer; +use Utopia\Migration\Warning; use Utopia\Storage\Device; use Utopia\Storage\Storage; @@ -438,7 +438,12 @@ private function validateCSVHeaders(array $headers, array $columnTypes, array $r $messages[] = "$label: '" . \implode("', '", $unknown) . "' (will be ignored)"; } if (!empty($unknown)) { - Console::warning(\implode(', ', $messages)); + $this->addWarning(new Warning( + UtopiaResource::TYPE_ROW, + Transfer::GROUP_DATABASES, + \implode(', ', $messages), + $this->resourceId + )); } }