2014-07-28 09:23:41 +03:00
|
|
|
<?php
|
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
class InstallStepCheckRequirements extends InstallStep
|
|
|
|
{
|
2014-07-28 09:23:41 +03:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
public function show()
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Проверяем требования
|
|
|
|
*/
|
2015-04-05 15:37:13 +03:00
|
|
|
$sAdditionalSolution = '';
|
2014-10-08 11:49:34 +03:00
|
|
|
$aRequirements = array();
|
|
|
|
if (!version_compare(PHP_VERSION, '5.3.2', '>=')) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'php_version',
|
|
|
|
'current' => PHP_VERSION
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!in_array(strtolower(@ini_get('safe_mode')), array('0', 'off', ''))) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'safe_mode',
|
|
|
|
'current' => InstallCore::getLang('yes')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!@preg_match('//u', '')) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'utf8',
|
|
|
|
'current' => InstallCore::getLang('no')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!@extension_loaded('mbstring')) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'mbstring',
|
|
|
|
'current' => InstallCore::getLang('no')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!in_array(strtolower(@ini_get('mbstring.func_overload')), array('0', '4', 'no overload'))) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'mbstring_func_overload',
|
|
|
|
'current' => InstallCore::getLang('yes')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!@extension_loaded('SimpleXML')) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'xml',
|
|
|
|
'current' => InstallCore::getLang('no')
|
|
|
|
);
|
|
|
|
}
|
2015-03-21 16:50:48 +02:00
|
|
|
if (@extension_loaded('xdebug')) {
|
|
|
|
$iLevel = (int)@ini_get('xdebug.max_nesting_level');
|
|
|
|
if ($iLevel < 1000) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'xdebug',
|
|
|
|
'current' => InstallCore::getLang('yes') . " ({$iLevel})"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2014-10-08 11:49:34 +03:00
|
|
|
/**
|
|
|
|
* Права на запись файлов
|
|
|
|
*/
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = false;
|
2014-10-08 11:49:34 +03:00
|
|
|
$sAppDir = dirname(INSTALL_DIR);
|
|
|
|
$sDir = dirname($sAppDir) . DIRECTORY_SEPARATOR . 'uploads';
|
|
|
|
if (!is_dir($sDir) or !is_writable($sDir)) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'dir_uploads',
|
2015-04-05 15:37:13 +03:00
|
|
|
'current' => InstallCore::getLang('is_not_writable')
|
2014-10-08 11:49:34 +03:00
|
|
|
);
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = true;
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
|
|
|
$sDir = $sAppDir . DIRECTORY_SEPARATOR . 'plugins';
|
|
|
|
if (!is_dir($sDir) or !is_writable($sDir)) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'dir_plugins',
|
2015-04-05 15:37:13 +03:00
|
|
|
'current' => InstallCore::getLang('is_not_writable')
|
2014-10-08 11:49:34 +03:00
|
|
|
);
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = true;
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
|
|
|
$sDir = $sAppDir . DIRECTORY_SEPARATOR . 'tmp';
|
|
|
|
if (!is_dir($sDir) or !is_writable($sDir)) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'dir_tmp',
|
2015-04-05 15:37:13 +03:00
|
|
|
'current' => InstallCore::getLang('is_not_writable')
|
2014-10-08 11:49:34 +03:00
|
|
|
);
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = true;
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
|
|
|
$sDir = $sAppDir . DIRECTORY_SEPARATOR . 'logs';
|
|
|
|
if (!is_dir($sDir) or !is_writable($sDir)) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'dir_logs',
|
2015-04-05 15:37:13 +03:00
|
|
|
'current' => InstallCore::getLang('is_not_writable')
|
2014-10-08 11:49:34 +03:00
|
|
|
);
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = true;
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
|
|
|
$sFile = $sAppDir . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.local.php';
|
|
|
|
if (!is_file($sFile) or !is_writable($sFile)) {
|
|
|
|
$aRequirements[] = array(
|
|
|
|
'name' => 'file_config_local',
|
2015-04-05 15:37:13 +03:00
|
|
|
'current' => InstallCore::getLang('is_not_writable')
|
2014-10-08 11:49:34 +03:00
|
|
|
);
|
2015-04-05 15:37:13 +03:00
|
|
|
$bWriteSolutions = true;
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
2014-07-28 09:23:41 +03:00
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
if (count($aRequirements)) {
|
|
|
|
InstallCore::setNextStepDisable();
|
|
|
|
}
|
2014-07-28 09:23:41 +03:00
|
|
|
|
2015-04-05 15:37:13 +03:00
|
|
|
if ($bWriteSolutions) {
|
|
|
|
$sBuildPath = $sAppDir . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'build.sh';
|
|
|
|
$sAdditionalSolution .= '<b>' . InstallCore::getLang('steps.checkRequirements.writable_solution') . '</b><br/>';
|
|
|
|
$sAdditionalSolution .= '<i>chmod 0755 ' . $sBuildPath . '</i><br/>';
|
|
|
|
$sAdditionalSolution .= '<i>' . $sBuildPath . '</i><br/>';
|
|
|
|
}
|
|
|
|
|
2014-10-08 11:49:34 +03:00
|
|
|
$this->assign('requirements', $aRequirements);
|
2015-04-05 15:37:13 +03:00
|
|
|
$this->assign('additionalSolution', $sAdditionalSolution);
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
2014-07-28 09:23:41 +03:00
|
|
|
|
|
|
|
}
|