mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
chore: improve deprecation warning
This commit is contained in:
parent
c7bbb6ad68
commit
262be06b0d
1 changed files with 7 additions and 1 deletions
|
|
@ -1065,7 +1065,6 @@ App::init()
|
|||
*/
|
||||
/** @var \Appwrite\SDK\Method $sdk */
|
||||
$sdk = $route->getLabel('sdk', false);
|
||||
$deprecationWarning = 'This route is deprecated. See the updated documentation for improved compatibility and migration details.';
|
||||
$sdkItems = is_array($sdk) ? $sdk : (!empty($sdk) ? [$sdk] : []);
|
||||
if (!empty($sdkItems) && count($sdkItems) > 0) {
|
||||
$allDeprecated = true;
|
||||
|
|
@ -1076,6 +1075,13 @@ App::init()
|
|||
}
|
||||
}
|
||||
if ($allDeprecated) {
|
||||
$deprecatedMethod = $sdkItems[0]->getDeprecated();
|
||||
$replaceWith = $deprecatedMethod->getReplaceWith();
|
||||
if ($replaceWith) {
|
||||
$replaceWith = preg_replace('/\./', '#', $replaceWith, 1);
|
||||
}
|
||||
$deprecatedReplaceWithLink = 'https://appwrite.io/docs/references/cloud/server-rest/' . $replaceWith;
|
||||
$deprecationWarning = 'Route ' . $route->getPath() . ' is deprecated since ' . $deprecatedMethod->getSince() . '. Please use ' . $deprecatedMethod->getReplaceWith() . ' instead. See: ' . $deprecatedReplaceWithLink;
|
||||
$warnings[] = $deprecationWarning;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue