From 3ea63072225a473239227facfabde294bb58ed1d Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 3 Dec 2005 16:19:08 +0000 Subject: --- requirements/index.php | 123 ++++++++++++++++++++++++++++++++++++++++++ requirements/messages-zh.txt | 11 ++++ requirements/messages.txt | 11 ++++ requirements/template-zh.html | 48 +++++++++++++++++ requirements/template.html | 49 +++++++++++++++++ 5 files changed, 242 insertions(+) create mode 100644 requirements/index.php create mode 100644 requirements/messages-zh.txt create mode 100644 requirements/messages.txt create mode 100644 requirements/template-zh.html create mode 100644 requirements/template.html (limited to 'requirements') diff --git a/requirements/index.php b/requirements/index.php new file mode 100644 index 00000000..5a83da62 --- /dev/null +++ b/requirements/index.php @@ -0,0 +1,123 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package prado + */ + +/** + * PRADO Requirements Checker script + * + * This script will check if your system meets the requirements for running PRADO. + * It will check if you are running the right version of PHP, if you included + * the right libraries and if your php.ini file settings are correct. + * + * This script is capable of displaying localized messages. + * All messages are stored in messages.txt. A localized message file is named as + * messsages-.txt, and it will be used when the client browser + * chooses the corresponding language. + * The script output uses a template named template.html. + * Its localized version is stored in template-.html. + */ + +/** + * Includes Prado class file + */ +require_once(dirname(__FILE__).'/../framework/prado.php'); + +/** + * @var array List of requirements (required or not, check item, hint) + */ +$requirements = array( + array(true,'version_compare(PHP_VERSION,"5.0.4",">=")','PHP version check','PHP 5.0.4 or higher required'), + array(false,'extension_loaded("zlib")','Zlib check','Zlib extension optional'), + array(false,'extension_loaded("sqlite")','SQLite check','SQLite extension optional'), + array(false,'extension_loaded("memcache")','Memcache check','Memcache extension optional'), +); + +$results = "\n"; +$conclusion = 0; +foreach($requirements as $requirement) +{ + list($required,$expression,$aspect,$hint)=$requirement; + eval('$ret='.$expression.';'); + if($required) + { + if($ret) + $ret='passed'; + else + { + $conclusion=1; + $ret='error'; + } + } + else + { + if($ret) + $ret='passed'; + else + { + if($conclusion!==1) + $conclusion=2; + $ret='warning'; + } + } + $results.="\n"; +} +$results .= '
".lmessage($aspect)."".lmessage($hint)."
'; +if($conclusion===0) + $conclusion=lmessage('all passed'); +else if($conclusion===1) + $conclusion=lmessage('failed'); +else + $conclusion=lmessage('passed with warnings'); + +$tokens = array( + '%%Conclusion%%' => $conclusion, + '%%Details%%' => $results, + '%%Version%%' => $_SERVER['SERVER_SOFTWARE'].' PRADO/'.Prado::getVersion(), + '%%Time%%' => strftime('%Y-%m-%d %H:%m',time()), +); + +$lang = Prado::getPreferredLanguage(); +$templateFile=dirname(__FILE__)."/template-$lang.html"; +if(!is_file($templateFile)) + $templateFile=dirname(__FILE__).'/template.html'; +if(($content=@file_get_contents($templateFile))===false) + die("Unable to open template file '$templateFile'."); + +header('Content-Type: text/html; charset=UTF-8'); +echo strtr($content,$tokens); + +/** + * Returns a localized message according to user preferred language. + * @param string message to be translated + * @return string translated message + */ +function lmessage($token) +{ + static $messages=null; + if($messages===null) + { + $lang = Prado::getPreferredLanguage(); + $msgFile=dirname(__FILE__)."/messages-$lang.txt"; + if(!is_file($msgFile)) + $msgFile=dirname(__FILE__).'/messages.txt'; + if(($entries=@file($msgFile))!==false) + { + foreach($entries as $entry) + { + @list($code,$message)=explode('=',$entry,2); + $messages[trim($code)]=trim($message); + } + } + } + return isset($messages[$token])?$messages[$token]:$token; +} + +?> \ No newline at end of file diff --git a/requirements/messages-zh.txt b/requirements/messages-zh.txt new file mode 100644 index 00000000..29888113 --- /dev/null +++ b/requirements/messages-zh.txt @@ -0,0 +1,11 @@ +all passed = 恭喜!您的服务器配置完全符合PRADO的要求。 +passed with warnings = 您的服务器配置符合PRADO的最低要求。请关注以下的警告信息。 +failed = 对不起,您的服务器配置不符合PRADO的要求。 +PHP version check = PHP版本检查 +PHP 5.0.4 or higher required = PRADO需要PHP 5.0.4或更高版本。 +SQLite check = SQLite模块检查 +SQLite extension optional = SQLite模块是可选的。如果它不存在,您将无法使用TSQLiteCache。 +Memcache check = Memcache模块检查 +Memcache extension optional = Memcache模块是可选的。如果它不存在,您将无法使用TMemCache。 +Zlib check = Zlib模块检查 +Zlib extension optional = Zlib模块是可选的。如果它不存在,页面的状态信息将无法压缩,由此可能导致您的页面传送数据量增大。 \ No newline at end of file diff --git a/requirements/messages.txt b/requirements/messages.txt new file mode 100644 index 00000000..6aecf6a2 --- /dev/null +++ b/requirements/messages.txt @@ -0,0 +1,11 @@ +all passed = Congratulations! Your server configuration satisfies all requirements by PRADO. +passed with warnings = Your server configuration satisfies minimum requirements by PRADO. Please pay attention to the warnings listed below. +failed = Sorry, your server configuration does not satisfy the requirements by PRADO. +PHP version check = PHP version check +PHP 5.0.4 or higher required = PHP version 5.0.4 or higher is required by PRADO. +SQLite check = SQLite check +SQLite extension optional = SQLite extension is optional. If it is absent, you will not be able to use TSqliteCache. +Memcache check = Memcache check +Memcache extension optional = Memcache extension is optional. If it is absent, you will not be able to use TMemCache. +Zlib check = Zlib check +Zlib extension optional = Zlib extension is optional. If it is absent, page state will not be compressed and your page size may increase. \ No newline at end of file diff --git a/requirements/template-zh.html b/requirements/template-zh.html new file mode 100644 index 00000000..966d04ce --- /dev/null +++ b/requirements/template-zh.html @@ -0,0 +1,48 @@ + + + + +PRADO配置需求检查 + + + + +

PRADO配置需求检查

+

检查说明

+

+本页面用于检查您的服务器配置是否达到运行PRADO应用程序所需的标准。 +它将检查服务器运行的PHP版本,PHP加载的模块,以及php.ini文件中的一些设置。 +

+

检查结果

+

+%%Conclusion%% +

+

具体情况

+

+%%Details%% +

+

+ + + + + + +
 通过 失败 警告
+

+
+%%Time%% %%Version%% + +
+ + \ No newline at end of file diff --git a/requirements/template.html b/requirements/template.html new file mode 100644 index 00000000..def4a6a7 --- /dev/null +++ b/requirements/template.html @@ -0,0 +1,49 @@ + + + + +PRADO Requirements Checker + + + + +

PRADO Requirements Checker

+

Description

+

+This script checks if your server configuration meets the requirements +for running PRADO-powered applications. +It checks if the server is running the right version of PHP, +if appropriate PHP extensions have been loaded, and if php.ini file settings are correct. +

+

Conclusion

+

+%%Conclusion%% +

+

Details

+

+%%Details%% +

+

+ + + + + + +
 passed failed warning
+

+
+%%Time%% %%Version%% +
+ + \ No newline at end of file -- cgit v1.2.3