Troubleshooting: checks.class.php

File checks.class.php, 3.8 KB (added by jzarate, 14 months ago)

Installation checks without the apache_get_modules function

Line 
1<?php
2
3class Checks
4{
5  public static function getRequired()
6  {
7    sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
8   
9    return array(
10      array(version_compare(phpversion(), '5.2.4', '>='), 
11        __('PHP version is at least 5.2.4'),
12        __('Current PHP version is [1]', array('[1]' => phpversion()))
13      ),
14      array(!ini_get('zend.ze1_compatibility_mode'),
15        __('php.ini has zend.ze1_compatibility_mode set to off'),
16        __('Set zend.ze1_compatibility_mode to off in php.ini ([1])', array('[1]' => get_cfg_var('cfg_file_path')))
17      ),
18      array(class_exists('PDO'),
19        __('PDO is installed'),
20        __('Install PDO (mandatory for Propel and Doctrine)')
21      ),
22      array(class_exists('PDO') && count(PDO::getAvailableDrivers()),
23        __('PDO has some drivers installed: [1]', array('[1]' => implode(', ', PDO::getAvailableDrivers()))),
24        __('Install PDO drivers (mandatory for Propel and Doctrine)')
25      ),
26      array(class_exists('DomDocument'),
27        __('PHP-XML module is installed'),
28        __('Install the PHP-XML module (required by Propel)')
29      ),
30      array(function_exists('iconv'),
31        __('The iconv() function is available'),
32        __('Install iconv() function')
33      ),
34      array(function_exists('utf8_decode'),
35        __('The utf8_decode() function is available'),
36        __('Install utf8_decode() function')
37      )
38    );
39  }
40 
41  public static function getRecommended()
42  {
43    sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
44   
45    return array(
46      array(class_exists('XSLTProcessor'),
47        __('XSL module is installed'),
48        __('Install the XSL module (recommended for Propel)')
49      ),
50      array(function_exists('token_get_all'),
51        __('The token_get_all() function is available'),
52        __('Install token_get_all() function (highly recommended)')
53      ),
54      array(function_exists('mb_strlen'),
55        __('The mb_strlen() function is available'),
56        __('Install mb_strlen() function')
57      ),
58      array((function_exists('apc_store') && ini_get('apc.enabled'))
59        || (function_exists('eaccelerator_put') && ini_get('eaccelerator.enable'))
60        || function_exists('xcache_set'),
61        __('A PHP accelerator is installed'),
62        __('Install a PHP accelerator like APC (highly recommended)')
63      ),
64      array(!ini_get('safe_mode'),
65        __('php.ini has safe_mode set to off'),
66        __('Set safe_mode to off in php.ini')
67      ),
68      array(!ini_get('short_open_tag'),
69        __('php.ini has short_open_tag set to off'),
70        __('Set short_open_tag to off in php.ini')
71      ),
72      array(!ini_get('magic_quotes_gpc'),
73        __('php.ini has magic_quotes_gpc set to off'),
74        __('Set magic_quotes_gpc to off in php.ini')
75      ),
76      array(!ini_get('register_globals'),
77        __('php.ini has register_globals set to off'),
78        __('Set register_globals to off in php.ini')
79      ),
80      array(!ini_get('session.auto_start'),
81        __('php.ini has session.auto_start set to off'),
82        __('Set session.auto_start to off in php.ini')
83      )
84    );
85  }
86 
87  public static function getFilePerms()
88  {
89    sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
90   
91    return array(
92      array(is_writable(sfConfig::get('sf_upload_dir')),
93        __('The %1% directory exists and is writable', array('%1%'=>'uploads')),
94        __("Make sure the %1% directory is writable (%2%)", array('%1%'=>'uploads', '%2%'=>sfConfig::get('sf_upload_dir')))
95      ),
96      array(is_writable(sys_get_temp_dir()),
97        __('The %1% directory exists and is writable', array('%1%'=>'temp')),
98        __('Make sure the %1% directory is writable (%2%)',array('%1%'=>'temp', '%2%'=>sys_get_temp_dir()))
99      ),
100    );
101  }
102}