升级 PHP/MYSQL 应用程序?

发布于 2024-09-15 02:07:37 字数 578 浏览 4 评论 0原文

我正在寻找有关如何管理本地 php/mysql 应用程序的升级过程本身的信息。意思是,如果我们的生产服务器上有一个“稳定”版本的 php/mysql 应用程序,并且我们现在想要将其升级到我们已经开发的下一个版本 - 我们如何优雅地做到这一点?我应该实施哪些做法?

我本来打算做的只是

  1. 要求开发者停止 一切稳定后检查代码 / 功能测试完成

  2. 使应用程序离线***(问:我应该如何阻止 ppl 登录/访问公共页面?最佳实践?),但允许开发人员通过秘密登录页面 / url 进行访问< /p>

  3. 登录到生产服务器并查看最新版本 本地***
  4. 让开发人员/测试人员通过秘密访问页面/ url 测试他们的代码***
  5. 完成后,我们通过删除此秘密访问页面/ url、删除站点维护页面和恢复所有人的访问权限。

***注意:执行此操作的一个简单方法是将 /myapp/ 重命名为 /myapp.old/ 并将新的应用程序版本放入 /myapp.new/ 开发人员将访问 /myapp.new/,进行测试以使其满意并然后完成后,我们将其重命名回 /myapp/ (这只是基本想法)

I'm looking for inputs into how I can manage the upgrade process itself of a homegrown php/mysql application. Meaning, if we have a 'stable' version of our php/mysql application working on our production server, and we now want to upgrade it to the next version that we've worked on - how do we go about doing that elegantly? What practices should I be implementing?

What I was planning to do was just to

  1. Ask the developers to stop
    checking in code after all stability
    / functionality tests are done

  2. Take the application offline*** (Q: how should I prevent ppl for logging in / accessing public pages? Best practices for that?) but allow access to developers through a secret login page / url

  3. Log onto the production server and check out the latest version
    locally***
  4. Have the developers/testers test their code through the secret access page / url***
  5. After that is done, we restore access to all by removing this secret access page / url, removing the site-under-maintenance page and restoring access to all.

***NOTE: A simple way of doing this would be to rename /myapp/ to /myapp.old/ and put the new application version into /myapp.new/ Developers would access /myapp.new/, test to their satisfaction and then after we're done, we would rename this back to /myapp/ (this is just the basic idea)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

豆芽 2024-09-22 02:07:37

这是一个很大的问题,在很多方面它取决于您的具体项目。但这里有一些需要考虑的做法:

  1. 在代码中添加大量注释。当您在一两年后回去进行更改时,现在看起来完全合乎逻辑的事情将会变得混乱。

  2. 使用自己的数据库维护网站的开发版本。您可以在发布到生产站点之前测试对站点的更改。

  3. 使用PHP框架(例如CakePHP、CodeIgniter等)。如果您的项目进展顺利,这可能很难做到。但它将帮助您以易于更新的方式编写代码,并且将包含许多稳定、成熟的功能,您不必从头开始编写。使用这些框架之一(并遵循其最佳实践)可能是初学者学习如何编写易于更新的模块化代码的最佳方法。这也将鼓励您以与站点结构一致的方式开发数据库。

  4. 编写测试(框架应该帮助您)以编程方式检查代码是否有错误。

  5. 使用版本控制系统,例如 Subversion 或 Git。这使您可以跟踪站点的更改,并在您意识到更改有问题时轻松回滚更改。

This is a huge question, and in many ways it will depend on your specific project. But here are some practices to think about:

  1. Put lots of comments in your code. Things that seem perfectly logical now will be confusing when you go back to make changes in a year or two.

  2. Maintain a development version of the site with its own database. You can test changes to the site before publishing to your production site.

  3. Use a PHP framework (such as CakePHP, CodeIgniter, etc). If you are far along on your project, this may be difficult to do. But it will help you write code in a way that is easy to update, and will include a lot of stable, mature functions that you won't have to write from scratch. Using one of these frameworks (and following its best practices) is probably the best way for a beginner to learn to think about writing modular code that's easy to update. This will also encourage you to develop your database in a way that is consistent with the structure of your site.

  4. Write tests (the framework should help you with this) to programatically check your code for errors.

  5. Use a version control system such as Subversion or Git. This allows you to track changes to the site, and easily roll back changes if/when you realize they are buggy.

暖树树初阳… 2024-09-22 02:07:37

全面的单元测试覆盖范围将非常有帮助,小型、高内聚、低耦合的类也是如此。除了单元测试之外,集成级别的良好覆盖也很有价值。

Comprehensive unit test coverage would be very helpful, as would small, highly cohesive, low-coupled classes. In addition to the unit tests, good coverage from an integration level would be valuable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文