102 lines
3.1 KiB
PHP
102 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* The model file of install module of ZenTaoMS.
|
|
*
|
|
* ZenTaoMS is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* ZenTaoMS is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @copyright Copyright: 2009 Chunsheng Wang
|
|
* @author Chunsheng Wang <wwccss@263.net>
|
|
* @package install
|
|
* @version $Id$
|
|
* @link http://www.zentao.cn
|
|
*/
|
|
?>
|
|
<?php
|
|
class installModel extends model
|
|
{
|
|
/* 获得PHP版本。*/
|
|
public function getPhpVersion()
|
|
{
|
|
return PHP_VERSION;
|
|
}
|
|
|
|
/* 检查PHP版本是否符合要求。*/
|
|
public function checkPHP()
|
|
{
|
|
return $result = version_compare(PHP_VERSION, '5.2.0') >= 0 ? 'ok' : 'fail';
|
|
}
|
|
|
|
/* 检查PDO扩展是否载入。*/
|
|
public function checkPDO()
|
|
{
|
|
return $result = extension_loaded('pdo') ? 'ok' : 'fail';
|
|
}
|
|
|
|
/* 检查PDO_MySQL扩展是否载入。*/
|
|
public function checkPDOMySQL()
|
|
{
|
|
return $result = extension_loaded('pdo_mysql') ? 'ok' : 'fail';
|
|
}
|
|
|
|
/* 获得tmpRoot目录的信息。*/
|
|
public function getTmpRoot()
|
|
{
|
|
$result['path'] = $this->app->getTmpRoot();
|
|
$result['exists'] = is_dir($result['path']);
|
|
$result['writable']= is_writable($result['path']);
|
|
return $result;
|
|
}
|
|
|
|
/* 检查tmpRoot目录权限。*/
|
|
public function checkTmpRoot()
|
|
{
|
|
$tmpRoot = $this->app->getTmpRoot();
|
|
return $result = (is_dir($tmpRoot) and is_writable($tmpRoot)) ? 'ok' : 'fail';
|
|
}
|
|
|
|
/* 获得DataRoot目录的信息。*/
|
|
public function getDataRoot()
|
|
{
|
|
$result['path'] = $this->app->getAppRoot() . 'www' . $this->app->getPathFix() . 'data';
|
|
$result['exists'] = is_dir($result['path']);
|
|
$result['writable']= is_writable($result['path']);
|
|
return $result;
|
|
}
|
|
|
|
/* 检查dataRoot目录权限。*/
|
|
public function checkDataRoot()
|
|
{
|
|
$dataRoot = $this->app->getAppRoot() . 'www' . $this->app->getPathFix() . 'data';
|
|
return $result = (is_dir($dataRoot) and is_writable($dataRoot)) ? 'ok' : 'fail';
|
|
}
|
|
|
|
/* 获得INI文件的信息。*/
|
|
public function getIniInfo()
|
|
{
|
|
$iniInfo = '';
|
|
ob_start();
|
|
phpinfo(1);
|
|
$lines = explode("\n", strip_tags(ob_get_contents()));
|
|
ob_end_clean();
|
|
foreach($lines as $line) if(strpos($line, 'ini') !== false) $iniInfo .= $line . "\n";
|
|
return $iniInfo;
|
|
}
|
|
|
|
/* 获得webRoot的地址。*/
|
|
public function getWebRoot()
|
|
{
|
|
return rtrim(pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME), '/') . '/';
|
|
}
|
|
}
|