/** * 环境检测 */ public function actionEnv() { self::_checkInstall(); $isWritable = array(array('私有临时文件(protected/runtime)', true, Helper::is_writeable(Yii::app()->runtimePath), '系统核心', '必须可读写'), array('非模块化的静态文件(public)', false, is_readable(WWWPATH . DS . 'public'), '公共静态文件', '必须可读'), array('附件上传目录(uploads)', false, Helper::is_writeable(WWWPATH . DS . 'uploads'), '附件上传', '若无附件上传可不用写权限'), array('数据目录(data)', false, Helper::is_writeable(WWWPATH . DS . 'protected' . DS . 'data'), '数据库备份', '若不备份数据库可不用写权限'), array('配置文件目录(protected/config)', false, Helper::is_writeable(WWWPATH . DS . 'protected' . DS . 'config'), '安装程序', '若手动安装系统写可不用写权限'), array('公共资源文件(assets)', true, Helper::is_writeable(WWWPATH . DS . 'assets'), '系统核心', '必须可读写')); $requirements = array(array('PHP版本', true, version_compare(PHP_VERSION, "5.2.0", ">="), '系统核心', 'PHP 5.2.0 或更高版本是必须的.'), array('$_SERVER 服务器变量', true, '' === ($message = checkServerVar()), '系统核心', $message), array('Reflection 扩展模块', true, class_exists('Reflection', false), '系统核心', ''), array('PCRE 扩展模块', true, extension_loaded("pcre"), '系统核心', ''), array('SPL 扩展模块', true, extension_loaded("SPL"), '系统核心', ''), array('DOM 扩展模块', false, class_exists("DOMDocument", false), 'CHtmlPurifier, CWsdlGenerator', ''), array('PDO 扩展模块', true, extension_loaded('pdo'), '所有和使用PDO数据库连接相关的类', ''), array('PDO MySQL 扩展模块', true, extension_loaded('pdo_mysql'), 'MYSQL数据库', '使用MYSQL必须支持'), array('Mcrypt 扩展模块', false, extension_loaded("mcrypt"), 'CSecurityManager', '加密和解密方法'), array('SOAP 扩展模块', false, extension_loaded("soap"), 'CWebService, CWebServiceAction', ''), array('GD 扩展模块', false, '' === ($message = checkCaptchaSupport()), 'CCaptchaAction', $message), array('Ctype 扩展模块', false, extension_loaded("ctype"), 'CDateFormatter, CDateFormatter, CTextHighlighter, CHtmlPurifier', '')); $requireResult = 1; foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $requireResult = 0; } else { if ($requireResult > 0 && !$requirement[1] && !$requirement[2]) { $requireResult = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } $writeableResult = 1; foreach ($isWritable as $k => $val) { if ($val[1] && !$val[2]) { $writeableResult = 0; } else { if ($requireResult > 0 && !$val[1] && !$val[2]) { $writeableResult = -1; } } if ($val[4] === '') { $isWritable[$i][4] = ' '; } } $data = array('isWritable' => $isWritable, 'writeableResult' => $writeableResult, 'requireResult' => $requireResult, 'requirements' => $requirements); $this->titler = '检测运行环境'; $this->render('env', $data); }
if (!empty($basedir)) { if (!isAllowedDir(dirname(__FILE__))) { $reqMessages[3][] = installer_t('The base directory configuration directive is set, and it does not include the current working directory.'); $requirements['environment']['open_basedir'] = 0; } } // Check PHP version $requirements['environment']['php_version'] = 1; if (!version_compare(PHP_VERSION, "5.3.0", ">=")) { $reqMessages[3][] = installer_t("Your server's PHP version") . ': ' . PHP_VERSION . '; ' . installer_t("version 5.3 or later is required"); $requirements['environment']['php_version'] = 0; } // Check $_SERVER variable meets requirements of Yii $requirements['environment']['php_server_superglobal'] = 0; if ($mode == 'web') { if (($message = checkServerVar($thisFile)) !== '') { $reqMessages[3][] = installer_t($message); } else { $requirements['environment']['php_server_superglobal'] = 1; } } // Check for existence of Reflection class $requirements['extensions']['pcre'] = 0; $requirements['environment']['pcre_version'] = 0; if (!($requirements['classes']['Reflection'] = class_exists('Reflection', false))) { $reqMessages[3][] = '<a href="http://php.net/manual/class.reflectionclass.php">PHP reflection class</a>: ' . $rbm; } else { if ($requirements['extensions']['pcre'] = extension_loaded("pcre")) { // Check PCRE library version $pcreReflector = new ReflectionExtension("pcre"); ob_start();
public function check_requirements() { function t($category, $message, $params = array()) { return $message; } function checkProtectedDirectory() { $testfile = Yii::app()->getRequest()->getHostInfo() . Yii::app()->getBaseUrl() . '/protected/data/daemon/schema.mysql.sql'; $f = @file_get_contents($testfile); if (strlen($f)) { return 'The "protected" directory of your front end must not be accessible through the webserver, please see:<br/><a href="http://multicraft.org/site/page?view=troubleshooting#protected_accessible" target="_blank">Troubleshooting: "protected" directory</a>'; } return ''; } //BEGIN YII REQUIREMENTS CHECK SCRIPT /** * Yii Requirement Checker script * * This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Qiang Xue <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ * @version $Id: index.php 2986 2011-02-20 17:08:50Z alexander.makarow $ * @package system * @since 1.0 */ function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing))); } if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(dirname(__FILE__) . '/../../install.php')) { return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'); } if (!isset($_SERVER["REQUEST_URI"]) && isset($_SERVER["QUERY_STRING"])) { return t('yii', 'Either $_SERVER["REQUEST_URI"] or $_SERVER["QUERY_STRING"] must exist.'); } if (!isset($_SERVER["PATH_INFO"]) && strpos($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"]) !== 0) { return t('yii', 'Unable to determine URL path info. Please make sure $_SERVER["PATH_INFO"] (or $_SERVER["PHP_SELF"] and $_SERVER["SCRIPT_NAME"]) contains proper value.'); } return ''; } function checkGD() { if (extension_loaded('gd')) { $gdinfo = gd_info(); if ($gdinfo['FreeType Support']) { return ''; } return t('yii', 'GD installed<br />FreeType support not installed'); } return t('yii', 'GD not installed'); } /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), true, ($message = checkServerVar()) === '', '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'Protected directory'), true, ($message = checkProtectedDirectory()) === '', 'System Security', $message), array(t('yii', 'PDO extension'), true, extension_loaded('pdo'), t('mc', 'All database connections'), t('mc', 'The PHP PDO extension is always required.')), array(t('yii', 'PDO SQLite extension'), false, extension_loaded('pdo_sqlite'), t('yii', 'SQLite Database connection'), t('yii', 'This is required if you are using an SQLite database.')), array(t('yii', 'PDO MySQL extension'), false, extension_loaded('pdo_mysql'), t('yii', 'MySQL database connection'), t('yii', 'This is required if you are using a MySQL database.')), array(t('yii', 'GD extension with<br />FreeType support'), false, ($message = checkGD()) === '', t('mc', 'Multicraft status banner and registration captcha'), t('mc', 'Only required if you want to use the status banners or registration captcha.') . ' ' . $message)); $result = 1; // 1: all pass, 0: fail, -1: pass with warnings foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $result = 0; } else { if ($result > 0 && !$requirement[1] && !$requirement[2]) { $result = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } //END YII REQUIREMENTS CHECK SCRIPT if ($result > 0) { $this->p['actions'][] = 'All requirements met'; } else { if ($result < 0) { $this->p['actions'][] = 'Minimum requirements met, some functionality may be unavailable'; } else { $this->p['actions'][] = 'Minumum requirements not met'; } } $this->p['requirements'] = $requirements; $this->p['result'] = $result; return true; }
* Yii Requirement Checker script * * This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Qiang Xue <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright 2008-2013 Yii Software LLC * @license http://www.yiiframework.com/license/ * @package system * @since 1.0 */ /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM extension'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>, <a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'PDO SQLite extension'), false, extension_loaded('pdo_sqlite'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for SQLite database.')), array(t('yii', 'PDO MySQL extension'), false, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MySQL database.')), array(t('yii', 'PDO PostgreSQL extension'), false, extension_loaded('pdo_pgsql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for PostgreSQL database.')), array(t('yii', 'PDO Oracle extension'), false, extension_loaded('pdo_oci'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for Oracle database.')), array(t('yii', 'PDO MSSQL extension (pdo_mssql)'), false, extension_loaded('pdo_mssql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database from MS Windows')), array(t('yii', 'PDO MSSQL extension (pdo_dblib)'), false, extension_loaded('pdo_dblib'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database from GNU/Linux or other UNIX.')), array(t('yii', 'PDO MSSQL extension (<a href="http://sqlsrvphp.codeplex.com/">pdo_sqlsrv</a>)'), false, extension_loaded('pdo_sqlsrv'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database with the driver provided by Microsoft.')), array(t('yii', 'PDO ODBC extension'), false, extension_loaded('pdo_odbc'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required in case database interaction will be through ODBC layer.')), array(t('yii', 'Memcache extension'), false, extension_loaded("memcache") || extension_loaded("memcached"), '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>', extension_loaded("memcached") ? t('yii', 'To use memcached set <a href="http://www.yiiframework.com/doc/api/CMemCache#useMemcached-detail">CMemCache::useMemcached</a> to <code>true</code>.') : ''), array(t('yii', 'APC extension'), false, extension_loaded("apc"), '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>', ''), array(t('yii', 'Mcrypt extension'), false, extension_loaded("mcrypt"), '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>', t('yii', 'Required by encrypt and decrypt methods.')), array(t('yii', 'crypt() CRYPT_BLOWFISH option'), false, function_exists('crypt') && defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH, '<a href="http://www.yiiframework.com/doc/api/1.1/CPasswordHelper">CPasswordHelper</a>', t('yii', 'Required for secure password storage.')), array(t('yii', 'SOAP extension'), false, extension_loaded("soap"), '<a href="http://www.yiiframework.com/doc/api/CWebService">CWebService</a>, <a href="http://www.yiiframework.com/doc/api/CWebServiceAction">CWebServiceAction</a>', ''), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', 'Ctype extension'), false, extension_loaded("ctype"), '<a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateFormatter</a>, <a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateTimeParser</a>, <a href="http://www.yiiframework.com/doc/api/CTextHighlighter">CTextHighlighter</a>, <a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>', ''), array(t('yii', 'Fileinfo extension'), false, extension_loaded("fileinfo"), '<a href="http://www.yiiframework.com/doc/api/CFileValidator">CFileValidator</a>', t('yii', 'Required for MIME-type validation'))); function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing))); } if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) { return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'); }
* * This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Qiang Xue <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ * @version $Id$ * @package system * @since 1.0 */ /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), true, ($message = checkServerVar()) === '', '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM extension'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>, <a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'PDO SQLite extension'), false, extension_loaded('pdo_sqlite'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using SQLite database.')), array(t('yii', 'PDO MySQL extension'), false, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using MySQL database.')), array(t('yii', 'PDO PostgreSQL extension'), false, extension_loaded('pdo_pgsql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using PostgreSQL database.')), array(t('yii', 'Memcache extension'), false, extension_loaded("memcache") || extension_loaded("memcached"), '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>', extension_loaded("memcached") ? t('yii', 'To use memcached set <a href="http://www.yiiframework.com/doc/api/CMemCache#useMemcached-detail">CMemCache::useMemcached</a> to <code>true</code>.') : ''), array(t('yii', 'APC extension'), false, extension_loaded("apc"), '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>', ''), array(t('yii', 'Mcrypt extension'), false, extension_loaded("mcrypt"), '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>', t('yii', 'This is required by encrypt and decrypt methods.')), array(t('yii', 'SOAP extension'), false, extension_loaded("soap"), '<a href="http://www.yiiframework.com/doc/api/CWebService">CWebService</a>, <a href="http://www.yiiframework.com/doc/api/CWebServiceAction">CWebServiceAction</a>', ''), array(t('yii', 'GD extension with<br />FreeType support'), false, ($message = checkGD()) === '', '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', 'Ctype extension'), false, extension_loaded("ctype"), '<a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateFormatter</a>, <a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateTimeParser</a>, <a href="http://www.yiiframework.com/doc/api/CTextHighlighter">CTextHighlighter</a>, <a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>', '')); function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing))); } if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) { return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'); }
public function actionInstall() { // ppr($_REQUEST); $opt = null; // $show = new show(); $step = reqReq('step', 0); if (empty($step)) { $this->render('step0'); // $show->showLowVersion(); } elseif ($step == 1) { $this->render('step1'); // $show->showStep1(); } elseif ($step == 2) { $w_check = array(YLMF_ROOT . 'ajax/', YLMF_ROOT . 'html/', YLMF_BACKEND . 'assets/', YLMF_BACKEND . 'uploads/', YLMF_APP . 'runtime/', YLMF_APP . 'data/crond/', YLMF_APP . 'data/cachefile/', APP_DB); $check = 1; foreach ($w_check as $key => $value) { if (!file_exists($value) && !@touch($value)) { $w_check[$key] .= $this->_getLang('no_file'); $check = 0; } elseif (!is_writable($value)) { $w_check[$key] .= $this->_getLang('777_test'); $check = 0; } else { $w_check[$key] .= $this->_getLang('test_ok'); } } //YII环境配置 $requirements = array(array(t('yii', 'PHP版本'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0或更高版本是必须的。')), array(t('yii', '$_SERVER变量'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection扩展模块'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE扩展模块'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL扩展模块'), false, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM扩展模块'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>, <a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO扩展模块'), true, extension_loaded('pdo'), t('yii', '所有和<a href="http://www.yiiframework.com/doc/api/#system.db">数据库相关的类</a>'), ''), array(t('yii', 'PDO MySQL扩展模块'), true, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', '如果使用MySQL数据库,这是必须的。')), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message)); $result = 1; // 1: all pass, 0: fail, -1: pass with warnings foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $result = 0; } else { if ($result > 0 && !$requirement[1] && !$requirement[2]) { $result = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } $viewFile = array('requirements' => $requirements, 'result' => $result); // ppr($viewFile,1); if ($result == 0 || !$check) { $btn_disabled = 'disabled="disabled"'; } else { $btn_disabled = ''; } $this->render('step2', array('view_file' => $viewFile, 'w_check' => $w_check, 'btn_disabled' => $btn_disabled)); } elseif ($step == 3) { $this->render('step3', array('opt' => $opt, 'error_password' => 0)); } elseif ($step == 4) { $type = reqGet('t'); $GLOBALS['database']['db_host'] = reqReq('dbhost'); $GLOBALS['database']['db_name'] = reqReq('dbname'); $GLOBALS['database']['db_user'] = reqReq('dbuser'); $GLOBALS['database']['db_pass'] = reqReq('dbpw'); $GLOBALS['database']['db_charset'] = reqReq('charset'); $GLOBALS['database']['theme'] = 'default'; $GLOBALS['database']['table_prefix'] = reqReq('dbpre'); if (!empty($GLOBALS['database']['table_prefix'])) { if (substr($GLOBALS['database']['table_prefix'], -1) != '_') { $GLOBALS['database']['table_prefix'] .= '_'; } } $GLOBALS['database']['manager'] = reqReq('manager'); $GLOBALS['database']['password'] = reqReq('password'); $password_check = reqReq('password_check'); if ($GLOBALS['database']['password'] !== $password_check) { $error = 1; $error_txt = $this->_getLang('no_same_adminpw'); } else { $dbname = $GLOBALS['database']['db_name']; $yl_manager = $GLOBALS['database']['manager']; $yl_managerpw = md5($GLOBALS['database']['password']); $tblpre = $GLOBALS['database']['table_prefix']; if (!empty($type) && $type == 'rpw') { $adir = reqReq('admindir'); app_db::select_db($dbname); $sql = "UPDATE `{$tblpre}admin` SET `username`='{$yl_manager}',`password`='{$yl_managerpw}' WHERE `id` ='1'"; if (app_db::query($sql)) { //跳转到成功页面 $this->render('step7', array('t' => 1, 'adir' => $adir)); exit; } else { $error = 1; $error_txt = $this->_getLang('no_do_database'); } } else { app_db::query("SET character_set_connection=utf8, character_set_results=utf8"); app_db::query("SET NAMES utf8"); /* ppr($GLOBALS,1); $opt['dbhost'] = reqReq('dbhost'); $opt['dbname'] = reqReq('dbname'); $opt['dbuser'] = reqReq('dbuser'); $opt['dbpw'] = reqReq('dbpw'); $opt['dbpre'] = reqReq('dbpre'); $opt['manager'] = reqReq('manager'); $opt['password'] = reqReq('password'); $opt['password_check'] = reqReq('password_check'); */ $error = 0; $error_txt = ''; if ($GLOBALS['database']['password'] != $password_check) { //管理员密码错误,显示 $this->render('step3', array('opt' => $GLOBALS['database'], 'error_password' => 1)); } if (!app_db::select_db($dbname)) { $error = 1; $error_txt = $this->_getLang('no_database'); } else { $tb1 = $GLOBALS['database']['table_prefix'] . 'admin'; $tb2 = $GLOBALS['database']['table_prefix'] . 'admin_group'; $tb3 = $GLOBALS['database']['table_prefix'] . 'admin_logger'; $tb4 = $GLOBALS['database']['table_prefix'] . 'catalog'; $tb5 = $GLOBALS['database']['table_prefix'] . 'config'; $tb6 = $GLOBALS['database']['table_prefix'] . 'links'; $sql = "SELECT count( TABLE_NAME ) c FROM `INFORMATION_SCHEMA`.`TABLES` where `TABLE_SCHEMA`='{$dbname}' AND (\n `TABLE_NAME`='{$tb1}' OR \n `TABLE_NAME`='{$tb2}' OR \n `TABLE_NAME`='{$tb3}' OR \n `TABLE_NAME`='{$tb4}' OR \n `TABLE_NAME`='{$tb5}' OR \n `TABLE_NAME`='{$tb6}'\n )"; // $sql = "SELECT count( TABLE_NAME ) c FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$dbname'"; app_db::query($sql); $ar = app_db::fetch_one(); if (!empty($ar) && $ar['c'] > 0) { $error = 1; $error_txt = $this->_getLang('no_empty_database'); } } $result = $check = $this->_showCopy($GLOBALS['database']); if ($result && is_array($result)) { $check = 1; } else { $check = 0; } $installinfo = FALSE; if (!$error) { $installsqlfile = YLMF_INSTALL . 'data/install.sql'; $sql = file_get_contents($installsqlfile); $installinfo = $this->_creatTable($sql, $dbname, $yl_manager, $yl_managerpw, $tblpre); if ($installinfo) { //写入超级管理员信息 $sql = "INSERT INTO `{$tblpre}admin` SET `id`='1',`username`='{$yl_manager}',`password`='{$yl_managerpw}',`realname`='administrator',`group_id`='1',`last_login_ip`='127.0.0.1'"; app_db::query($sql); } else { $error = 1; $error_txt = $this->_getLang('donot_insert'); } } } } $this->render('step5', array('error' => $error, 'error_txt' => $error_txt, 'installinfo' => $installinfo, 'check' => $check)); } elseif ($step == 6) { $this->render('step6'); } elseif ($step == 7) { @$this->_delDir(YLMF_INSTALL); //若成功删除,则跳转 if (!file_exists(__FILE__)) { header('Location: ../admin/index.php'); echo "<script type='text/javascript'>window.location.href='../admin/index.php';</script>"; exit; } //若未,则显示手动删除页面 $this->render('step7'); } }
var_dump($this::$a); */ ?> <li><?php // check PHP version required by yii if (version_compare(PHP_VERSION, "5.1.0", ">=")) { echo "<span style='color:green'>You are running on PHP " . phpversion() . " which is compatible with PH</span>"; } else { echo "<span style='color:red'>You are running a too old PHP version [" . phpversion() . "]. PH requires PHP5.1.1.0 or earlier</span>"; } ?> </li> <li><?php // check server var $res = checkServerVar(); if (empty($res)) { echo '<span style="color:green"> variables $_SERVER are OK</span>'; } else { echo '<span style="color:red"> variables $_SERVER are not OK : [' . $res . ']</span>'; } ?> </li> <li><?php // check extension Reflection if (class_exists('Reflection', false)) { echo '<span style="color:green"> extension Reflection is installed.</span>'; } else { echo '<span style="color:red"> extension Reflection is not installed. Please install it on your PHP server</span>'; }
function getRequirements() { return $requirements = array(array(t('bugfree', 'PHP version'), version_compare(PHP_VERSION, "5.1.0", ">="), PHP_VERSION, '5.1.0+'), array(t('bugfree', 'MySQL version'), ($message = checkMysql()) !== t('bugfree', 'Not Install') && $message, $message !== t('bugfree', 'Not Install') ? mysql_get_client_info() : $message, '5.0+'), array(t('bugfree', '$_SERVER variable'), ($message = checkServerVar()) === t('bugfree', 'Supported'), $message, t('bugfree', 'Supported')), array(t('bugfree', 'Reflection extension'), ($flag = class_exists('Reflection', false)) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported')), array(t('bugfree', 'PCRE extension'), ($flag = extension_loaded("pcre")) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported')), array(t('bugfree', 'SPL extension'), ($flag = extension_loaded("SPL")) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported')), array(t('bugfree', 'PDO extension'), ($flag = extension_loaded('pdo')) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported')), array(t('bugfree', 'JSON extension'), ($flag = extension_loaded('json')) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported')), array(t('bugfree', 'PDO MySQL extension'), ($flag = extension_loaded('pdo_mysql')) === true, $flag ? t('bugfree', 'Supported') : t('bugfree', 'Not Install'), t('bugfree', 'Supported'))); }
* * This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Qiang Xue <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright 2008-2013 Yii Software LLC * @license http://www.yiiframework.com/license/ * @package system * @since 1.0 */ define('MOBCENT_FRAMEWORK', '<a href="http://www.appbyme.com/">安米网</a>'); /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), false, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'Mbstring extension'), true, extension_loaded("mbstring"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'JSON 扩展模块'), true, function_exists('json_encode'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '')), array(t('yii', 'iconv 扩展模块'), true, function_exists('iconv'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '')), array(t('yii', 'cURL 扩展模块'), false, function_exists('curl_init'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '会影响客户端性能速度, 如未通过,<a href="http://addon.discuz.com/?@appbyme_app.plugin.doc/FAQ">请点击查看说明</a>')), array(t('yii', 'openssl 扩展模块'), false, function_exists('openssl_open'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '会影响客户端ios的推送功能')), array(t('yii', '图像处理库 扩展模块(有FreeType支持的 GD 库 或 <br /> 有PNG支持 ImageMagick 库)'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', '需要可写目录'), true, checkDirectoryWritable(), '', t('yii', '请保证 discuz 根目录下的 data 目录可写')), array(t('yii', 'PHP 设置 allow_url_fopen'), true, checkAllowUrlFopen(), '', t('yii', '请保证 php.ini 中的 allow_url_fopen 为 On 或者为 1'))); function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing))); } if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) { return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'); }
* This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Matthieu PENICAUD <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright 2008-2013 Yii Software LLC * @license http://www.yiiframework.com/license/ * @package system * @since 1.0 */ require dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'protected/extensions/phpmailer/JPhpMailer.php'; require dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'CommonProperties.php'; /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.3.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'Mongo'), false, extension_loaded('mongo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'bddConnectionProperties'), true, checkDbConnectionProperties(), 'Application', t('yii', 'dbConnectionProperties')), array(t('yii', 'db version'), true, version_compare(checkDbVersion(), "db.version.v.2.4.0", ">="), '<a href="http://www.yiiframework.com">Application</a>', t('yii', 'Mongodb 2.4.0 or higher is required.found:' . checkDbVersion())), array(t('yii', 'mail'), true, sendCheckMail(), 'Application', t('yii', "checkMail {email}", array('email' => CommonProperties::$ADMIN_EMAIL))), array(t('yii', 'assets'), true, is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'assets'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'folder_assets required')), array(t('yii', 'runtime'), true, is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'runtime'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'folder_runtime required')), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', '$_SERVER variable'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Ctype extension'), false, extension_loaded("ctype"), '<a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateFormatter</a>, <a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateTimeParser</a>, <a href="http://www.yiiframework.com/doc/api/CTextHighlighter">CTextHighlighter</a>, <a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>', ''), array(t('yii', 'Fileinfo extension'), false, extension_loaded("fileinfo"), '<a href="http://www.yiiframework.com/doc/api/CFileValidator">CFileValidator</a>', t('yii', 'Required for MIME-type validation'))); $result = 1; // 1: all pass, 0: fail, -1: pass with warnings foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $result = 0; } else { if ($result > 0 && !$requirement[1] && !$requirement[2]) { $result = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } $lang = getPreferredLanguage();
<?php $requirements = array(array('PHP版本', true, version_compare(PHP_VERSION, "5.2.1", ">="), 'PHP 5.2.1或更高版本是必须的。'), array('$_SERVER变量', true, ($message = checkServerVar()) === '', $message), array('Reflection扩展模块', true, class_exists('Reflection', false), ''), array('PCRE扩展模块', true, extension_loaded("pcre"), ''), array('SPL扩展模块', true, extension_loaded("SPL"), ''), array('DOM扩展模块', false, class_exists("DOMDocument", false), ''), array('PDO扩展模块', false, extension_loaded('pdo'), '要使用数据库,此模块是必须'), array('PDO MySQL扩展模块', false, extension_loaded('pdo_mysql'), '如果使用MySQL数据库,这是必须的。'), array('Memcache扩展模块', false, extension_loaded("memcache") || extension_loaded("memcached"), '如果要使用memcached缓存服务器,需要此模块'), array('Mcrypt扩展模块', false, extension_loaded("mcrypt"), '如果用到加密解密功能,会需要此模块'), array('GD extension with<br />FreeType support', false, ($message = checkGD()) === '', $message === '' ? '验证码及图表功能会用到GD模块' : $message), array('Ctype extension', false, extension_loaded("ctype"), '')); function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return '$_SERVER does not have .' . array('{vars}' => implode(', ', $missing)); } // if(realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) // return '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'; if (!isset($_SERVER["REQUEST_URI"]) && isset($_SERVER["QUERY_STRING"])) { return 'Either $_SERVER["REQUEST_URI"] or $_SERVER["QUERY_STRING"] must exist.'; } if (!isset($_SERVER["PATH_INFO"]) && strpos($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"]) !== 0) { return 'Unable to determine URL path info. Please make sure $_SERVER["PATH_INFO"] (or $_SERVER["PHP_SELF"] and $_SERVER["SCRIPT_NAME"]) contains proper value.'; } return ''; } function checkGD() { if (extension_loaded('gd')) { $gdinfo = gd_info(); if ($gdinfo['FreeType Support']) { return '';
* * This script will check if your system meets the requirements for running * Yii-powered Web applications. * * @author Qiang Xue <*****@*****.**> * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2010 Yii Software LLC * @license http://www.yiiframework.com/license/ * @version $Id: index.php 1678 2010-01-07 21:02:00Z qiang.xue $ * @package system * @since 1.0 */ /** * @var array List of requirements (name, required or not, result, used by, memo) */ $requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), true, ($message = checkServerVar()) === '', '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM extension'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'PDO SQLite extension'), false, extension_loaded('pdo_sqlite'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using SQLite database.')), array(t('yii', 'PDO MySQL extension'), false, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using MySQL database.')), array(t('yii', 'PDO PostgreSQL extension'), false, extension_loaded('pdo_pgsql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'This is required if you are using PostgreSQL database.')), array(t('yii', 'Memcache extension'), false, extension_loaded("memcache"), '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>', ''), array(t('yii', 'APC extension'), false, extension_loaded("apc"), '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>', ''), array(t('yii', 'Mcrypt extension'), false, extension_loaded("mcrypt"), '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>', t('yii', 'This is required by encrypt and decrypt methods.')), array(t('yii', 'SOAP extension'), false, extension_loaded("soap"), '<a href="http://www.yiiframework.com/doc/api/CWebService">CWebService</a>, <a href="http://www.yiiframework.com/doc/api/CWebServiceAction">CWebServiceAction</a>', ''), array(t('yii', 'GD extension'), false, extension_loaded('gd'), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', '')); function checkServerVar() { $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT'); $missing = array(); foreach ($vars as $var) { if (!isset($_SERVER[$var])) { $missing[] = $var; } } if (!empty($missing)) { return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing))); } if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) { return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.'); }