Skip to content

Commit 9390494

Browse files
authored
Merge pull request #147 from utopia-php/remove-console-logs
2 parents b5fe198 + 203d9d5 commit 9390494

5 files changed

Lines changed: 21 additions & 55 deletions

File tree

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"utopia-php/database": "5.*",
3030
"utopia-php/storage": "0.18.*",
3131
"utopia-php/dsn": "0.2.*",
32-
"utopia-php/console": "0.0.*",
3332
"halaxa/json-machine": "^1.2"
3433
},
3534
"require-dev": {

composer.lock

Lines changed: 0 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Migration/Destinations/CSV.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Utopia\Migration\Destinations;
44

5-
use Utopia\Console;
65
use Utopia\Database\Exception\Authorization;
76
use Utopia\Database\Exception\Conflict;
87
use Utopia\Database\Exception\Structure;
98
use Utopia\Migration\Destination;
109
use Utopia\Migration\Resource as UtopiaResource;
1110
use Utopia\Migration\Resources\Database\Row;
1211
use Utopia\Migration\Transfer;
12+
use Utopia\Migration\Warning;
1313
use Utopia\Storage\Device;
1414
use Utopia\Storage\Device\Local;
1515

@@ -185,7 +185,12 @@ public function shutdown(): void
185185
} finally {
186186
// Clean up the temporary directory
187187
if (!$this->local->deletePath('') || $this->local->exists($this->local->getRoot())) {
188-
Console::error('Error cleaning up: ' . $this->local->getRoot());
188+
$this->addWarning(new Warning(
189+
UtopiaResource::TYPE_ROW,
190+
Transfer::GROUP_DATABASES,
191+
'Error cleaning up: ' . $this->local->getRoot(),
192+
$this->resourceId
193+
));
189194
}
190195
}
191196
}

src/Migration/Destinations/JSON.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Utopia\Migration\Destinations;
44

55
use Exception;
6-
use Utopia\Console;
76
use Utopia\Database\Exception\Authorization;
87
use Utopia\Database\Exception\Conflict;
98
use Utopia\Database\Exception\Structure;
@@ -12,6 +11,7 @@
1211
use Utopia\Migration\Resource as UtopiaResource;
1312
use Utopia\Migration\Resources\Database\Row;
1413
use Utopia\Migration\Transfer;
14+
use Utopia\Migration\Warning;
1515
use Utopia\Storage\Device;
1616
use Utopia\Storage\Device\Local;
1717

@@ -212,7 +212,12 @@ public function shutdown(): void
212212
} finally {
213213
// Clean up the temporary directory
214214
if (!$this->local->deletePath('') || $this->local->exists($this->local->getRoot())) {
215-
Console::error('Error cleaning up: ' . $this->local->getRoot());
215+
$this->addWarning(new Warning(
216+
UtopiaResource::TYPE_ROW,
217+
Transfer::GROUP_DATABASES,
218+
'Error cleaning up: ' . $this->local->getRoot(),
219+
$this->resourceId
220+
));
216221
}
217222
}
218223
}

src/Migration/Sources/CSV.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Utopia\Migration\Sources;
44

5-
use Utopia\Console;
65
use Utopia\Database\Database as UtopiaDatabase;
76
use Utopia\Migration\Exception;
87
use Utopia\Migration\Resource as UtopiaResource;
@@ -15,6 +14,7 @@
1514
use Utopia\Migration\Sources\Appwrite\Reader;
1615
use Utopia\Migration\Sources\Appwrite\Reader\Database as DatabaseReader;
1716
use Utopia\Migration\Transfer;
17+
use Utopia\Migration\Warning;
1818
use Utopia\Storage\Device;
1919
use Utopia\Storage\Storage;
2020

@@ -438,7 +438,12 @@ private function validateCSVHeaders(array $headers, array $columnTypes, array $r
438438
$messages[] = "$label: '" . \implode("', '", $unknown) . "' (will be ignored)";
439439
}
440440
if (!empty($unknown)) {
441-
Console::warning(\implode(', ', $messages));
441+
$this->addWarning(new Warning(
442+
UtopiaResource::TYPE_ROW,
443+
Transfer::GROUP_DATABASES,
444+
\implode(', ', $messages),
445+
$this->resourceId
446+
));
442447
}
443448
}
444449

0 commit comments

Comments
 (0)