uninstall.php 661 B

123456789101112131415161718
  1. <?php
  2. // 推导路径(与安装脚本一致,确保兼容自定义 vendor 目录)
  3. $scriptPath = realpath(__FILE__);
  4. $libraryRoot = dirname($scriptPath,2);
  5. $projectRoot = dirname($libraryRoot,2) . '/..';
  6. $targetConfigFile = $projectRoot . '/config/elasticsearch.php';
  7. // 检查并删除配置文件
  8. if (file_exists($targetConfigFile)) {
  9. if (unlink($targetConfigFile)) {
  10. echo "[成功] 已删除配置文件:{$targetConfigFile}\n";
  11. } else {
  12. echo "[警告] 配置文件删除失败(可能权限不足):{$targetConfigFile}\n";
  13. }
  14. } else {
  15. echo "[提示] 未找到配置文件,无需删除:{$targetConfigFile}\n";
  16. }