Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, Feb 25, 5:57 AM

in-portal

Index: branches/5.2.x/core/install/step_templates/sys_requirements.tpl
===================================================================
--- branches/5.2.x/core/install/step_templates/sys_requirements.tpl (revision 15548)
+++ branches/5.2.x/core/install/step_templates/sys_requirements.tpl (revision 15549)
@@ -1,78 +1,78 @@
<?php
$heading_tpl = '
<tr class="subsectiontitle">
<td class="text" colspan="2" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000;">%s</td>
</tr>';
$error_tpl = '
<tr class="table-color2">
<td class="text">%s</td>
<td align="center" width="30">%s</td>
</tr>';
$check_titles = Array (
'php_version' => 'PHP version: 5.2.0+ (required)',
'url_rewriting' => 'URL Rewriting Support (optional)',
'java' => 'Java (optional)',
'sep1' => '<strong>PHP extensions:</strong>',
'memcache' => '- Memcache (optional)',
'curl' => '- Curl (required)',
'simplexml' => '- SimpleXML (required)',
'spl' => '- Standard PHP Library (required)',
'freetype' => '- Freetype (required)',
'gd_version' => '- GD 1.8+ (required)',
'jpeg' => '- JPEG (required)',
'mysql' => '- MySQL (required)',
'json' => '- JSON (required)',
'sep2' => '<strong>PHP settings:</strong>',
'memory_limit' => "- ini_set('memory_limit', ...) works (optional)",
'display_errors' => "- ini_set('display_errors', ...) works (optional)",
'error_reporting' => "- error_reporting(...) works (optional)",
'date.timezone' => "- ini_get('date.timezone') - timezone set (required)",
'variables_order' => "- ini_get('variables_order') - contains \"GPC\" string",
- 'output_buffering' => "- ini_get('output_buffering') > 0 - buffering works (required)",
+ 'output_buffering' => "- ini_get('output_buffering') > 0 - works (required)",
);
$output = sprintf($heading_tpl, '<strong>Server-side requirements</strong>');
$check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckSystemRequirements');
/*$required_checks = Array (
'php_version', 'simplexml', 'curl', 'freetype', 'gd_version',
'jpeg', 'mysql', 'date.timezone', 'output_buffering',
);
$required_checks = array_diff($required_checks, array_keys( array_filter($check_results) ));*/
foreach ($check_titles AS $key => $title) {
if ( substr($key, 0, 3) == 'sep' ) {
$check_result = '';
}
else {
$check_result = $check_results[$key] ? '[<span style="color:green;">PASSED</span>]' : '[<span class="error">FAILED</span>]';
}
$output .= sprintf($error_tpl, $title, $check_result);
}
$output .= sprintf($heading_tpl, '<strong>Client-side requirements</strong>', 'text');
$output .= sprintf($error_tpl, 'Cookies enabled', '[<span class="error" id="cookies_enabled_mark">FAILED</span>]');
$output .= sprintf($error_tpl, 'JavaScript enabled', '[<span class="error" id="js_enabled_mark">FAILED</span>]');
$output .= '<input type="hidden" name="js_enabled" id="js_enabled" value="0"/>';
$output .= '<input type="hidden" name="cookies_enabled" id="cookies_enabled" value="0"/>';
$output .= "<script type='text/javascript'>
\$('#js_enabled').val(1);
\$('#js_enabled_mark').removeClass('error').css('color', 'green').html('PASSED');
document.cookie = 'install_cookie_test=1';
var \$cookies_enabled = document.cookie.indexOf('install_cookie_test') != -1;
if ( \$cookies_enabled ) {
\$('#cookies_enabled').val(1);
\$('#cookies_enabled_mark').removeClass('error').css('color', 'green').html('PASSED');
}
</script>";
echo $output;
?>
Index: branches/5.2.x/core/install/prerequisites.php
===================================================================
--- branches/5.2.x/core/install/prerequisites.php (revision 15548)
+++ branches/5.2.x/core/install/prerequisites.php (revision 15549)
@@ -1,217 +1,219 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$prerequisite_class = 'InPortalPrerequisites';
/**
* Class, that holds all prerequisite scripts for "In-Portal" module
*
*/
class InPortalPrerequisites {
/**
* Install toolkit instance
*
* @var kInstallToolkit
*/
var $_toolkit = null;
/**
* Connection to database
*
* @var kDBConnection
* @access protected
*/
protected $Conn = null;
/**
* Version upgrade rules
*
* @var array
* @access private
*/
private $upgradeRules = Array (
'5.0.0' => Array ('from' => '5.0.0-B1', 'to' => '5.1.0-B1'),
'5.1.0' => Array ('from' => '5.1.0-B1', 'to' => '5.2.0-B1'),
'5.2.0' => Array ('from' => '5.2.0-B1', 'to' => '5.3.0-B1'),
);
/**
* Sets common instance of installator toolkit
*
* @param kInstallToolkit $instance
*/
function setToolkit(&$instance)
{
$this->_toolkit =& $instance;
}
/**
* Checks minimal version, that could be upgradeable
*
* @return kDBConnection
*/
function getConnection()
{
return $this->_toolkit->Conn;
}
/**
* Checks minimal version, that could be upgradeable
*
* @param Array $versions
* @param string $mode when called mode {install, upgrade, standalone)
* @return Array
*/
function CheckPrerequisites($versions, $mode)
{
$errors = Array ();
if ( $mode == 'upgrade' ) {
$sql = 'SELECT Version
FROM ' . TABLE_PREFIX . 'Modules
WHERE Name = "In-Portal"';
$inportal_version = $this->getConnection()->GetOne($sql);
if ( $inportal_version === false ) {
// only, when In-Portal was installed (below 4.3.x)
return $errors;
}
$min_version = '4.3.1'; // K4-based installator was created, that no longer maintained old upgrade scripts
if ( version_compare($inportal_version, $min_version, '<') ) {
$errors[] = 'Please upgrade "In-Portal" to version ' . $min_version . ' first';
}
// example: to upgrade to 5.1.0-B1 or more you at least need to have 5.0.0 installed
foreach ($this->upgradeRules as $min_version => $version_rules) {
if ( version_compare($versions[0], $version_rules['from'], '<') && version_compare($versions[1], $version_rules['to'], '>=') ) {
$errors[] = 'Please upgrade "In-Portal" to version ' . $min_version . ' first';
break;
}
}
}
return $errors;
}
/**
* Returns information about system requirements
*
* @return array
*/
function CheckSystemRequirements()
{
$ret = Array ();
$ret['php_version'] = version_compare(PHP_VERSION, '5.2.0', '>=');
$ret['url_rewriting'] = function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules());
$ret['memcache'] = class_exists('Memcache');
$ret['curl'] = function_exists('curl_init');
$ret['simplexml'] = function_exists('simplexml_load_string');
$ret['spl'] = function_exists('spl_autoload_register');
$ret['freetype'] = function_exists('imagettfbbox');
$ret['gd_version'] = false;
if ( function_exists('gd_info') ) {
$gd_info = gd_info();
$gd_version = preg_replace('/[^\d.]/', '', $gd_info['GD Version']);
$ret['gd_version'] = version_compare($gd_version, '1.8', '>=');
}
$ret['jpeg'] = function_exists('imagecreatefromjpeg');
$ret['mysql'] = function_exists('mysql_connect');
$ret['json'] = function_exists('json_encode');
$output = shell_exec('java -version 2>&1');
$ret['java'] = stripos($output, 'java version') !== false;
$ret['memory_limit'] = $this->isPhpSettingChangeable('memory_limit', '33M');
$ret['display_errors'] = $this->isPhpSettingChangeable('display_errors', '1');
$ret['error_reporting'] = $this->canChangeErrorReporting();
$ret['date.timezone'] = ini_get('date.timezone') != '';
$ret['variables_order'] = strpos(ini_get('variables_order'), 'GPC') !== false;
- $ret['output_buffering'] = ini_get('output_buffering') > 0;
+
+ $output_buffering = strtolower(ini_get('output_buffering'));
+ $ret['output_buffering'] = $output_buffering == 'on' || $output_buffering > 0;
return $ret;
}
/**
* Detects if error reporting can be changed at runtime
*
* @return bool
* @access protected
*/
protected function canChangeErrorReporting()
{
$old_value = error_reporting(E_PARSE);
$new_value = error_reporting();
if ( $new_value == E_PARSE ) {
error_reporting($old_value);
return true;
}
return false;
}
/**
* Detects if setting of php.ini can be changed
*
* @param string $setting_name
* @param string $new_value
* @return bool
*/
protected function isPhpSettingChangeable($setting_name, $new_value)
{
$old_value = ini_get($setting_name);
if ( ini_set($setting_name, $new_value) === false ) {
return false;
}
ini_set($setting_name, $old_value);
return true;
}
/**
* Returns information about DB requirements
*
* @return array
*/
function CheckDBRequirements()
{
// check PHP version 5.2+
$ret = Array();
$sql = 'SELECT VERSION()';
$conn = $this->getConnection();
$db_version = preg_replace('/[^\d.]/', '', $conn->GetOne($sql));
$ret['version'] = version_compare($db_version, '5.0', '>=');
$sql = 'SHOW VARIABLES LIKE "max_allowed_packet"';
$db_variables = $conn->Query($sql, 'Variable_name');
$ret['packet_size'] = $db_variables['max_allowed_packet']['Value'] >= 1048576;
return $ret;
}
}
\ No newline at end of file

Event Timeline