如何确定是否已安装和设置Web应用程序? [英] How to determine if a web application has been installed and set up?

查看:100
本文介绍了如何确定是否已安装和设置Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我的问题是否足够... 好吧,我正在使用Zend Framework在PHP中开发CMS. 在某个地方解压缩后,我想拥有一个不错的Web gui来安装和设置该应用程序... 某些CMS或任何应用程序,都可以通过简单地输入' http://localhost /app/install '

I am not sure to be enough be by my question... Well i'm developping a CMS in PHP with Zend Framework. I would like to have a nice web gui to install and set up the application after unpacked it somewhere... Some CMS or whatever the application is, offer this way to do by simply entering an 'install url' like 'http://localhost/app/install'

我想做同样的事情,但我不想让任何用户对其进行设置,所以我正在寻找一种确定应用程序是否已设置的方法.

I'd like to do the same but i don't want to let any users to set it up, so i am looking for a way to determine if the application has been set up or no.

受unix世界中pid文件的启发,尽管我对InstallState文件也是如此. 在其中写入任何布尔值,然后检查可能是一个主意.

Inspired by the pid file in the unix world, i though to do the same with an InstallState file. Writing any boolean value inside and then check could be an idea..

您对此有何看法?你有更好的主意吗?

What do you think about that ? Do you have better ideas ?

推荐答案

尽管我赞成Sam152的答案,但我仍需要进一步说明(这实际上并不适合发表评论).我在这些情况下使用的做法如下:

Though I upvoted Sam152's answer, I felt the need to give some further clarification (that just didn't really fit in a comment). The practice I use for these situations is as follows:

  1. 让用户运行安装程序.
  2. 成功完成后,生成某种形式的锁定文件(许多应用程序仅创建了一个"installer.lock"文件,其中没有任何内容).此文件的存在应该使用户停止运行 安装程序 再次.
  3. 防止主脚本执行(即使成功完成安装之后),直到从服务器中删除整个安装目录为止.
  1. Let the user run the installer.
  2. Upon successful completion, generate some form of lock file (many applications just create an 'installer.lock' file, with nothing in it). The presence of this file should stop the user running the installer again.
  3. Prevent the main script from executing (even after a successful setup) until the entire installation directory is removed from the server.

这提供了两个方面的保护措施.它可以防止再次运行安装程序(可能对您的应用程序造成问题,也可能不是问题),并且可以防止产品运行.您可以使用锁定文件的存在来告诉用户他们已经成功完成了安装,他们不需要再次安装,并且应该删除目录.

This provides safeguards on two levels. It prevents the installer being run again (which may or may not be a problem for your application), and it prevents the product being run. You can use the presence of the locking file to tell the user that they've already compleed the install successfully, they don't need to install again, and that they should remove the directory.

简单,安全,已排序. :)

Simple, safe, sorted. :)

这篇关于如何确定是否已安装和设置Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆