2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
42 * Reserved. Contributor(s): ______________________________________..
43 * *******************************************************************************/
44 logThis('[At systemCheck.php]');
46 $stop = false; // flag to prevent going to next step
48 ///////////////////////////////////////////////////////////////////////////////
50 logThis('Starting file permission check...');
51 $filesNotWritable = array();
52 $filesNWPerms = array();
54 // add directories here that should be skipped when doing file permissions checks (cache/upload is the nasty one)
56 $sugar_config['upload_dir'],
59 $files = uwFindAllFiles(getcwd(), array(), true, $skipDirs);
63 <a href='javascript:void(0); toggleNwFiles(\"filesNw\");'>{$mod_strings['LBL_UW_SHOW_NW_FILES']}</a>
64 <div id='filesNw' style='display:none;'>
65 <table cellpadding='3' cellspacing='0' border='0'>
67 <th align='left'>{$mod_strings['LBL_UW_FILE']}</th>
68 <th align='left'>{$mod_strings['LBL_UW_FILE_PERMS']}</th>
69 <th align='left'>{$mod_strings['LBL_UW_FILE_OWNER']}</th>
70 <th align='left'>{$mod_strings['LBL_UW_FILE_GROUP']}</th>
73 $isWindows = is_windows();
74 foreach($files as $file) {
76 if(!is_writable_windows($file)) {
77 logThis('WINDOWS: File ['.$file.'] not readable - saving for display');
78 // don't warn yet - we're going to use this to check against replacement files
79 $filesNotWritable[$i] = $file;
80 $filesNWPerms[$i] = substr(sprintf('%o',fileperms($file)), -4);
82 "<td><span class='error'>{$file}</span></td>".
83 "<td>{$filesNWPerms[$i]}</td>".
84 "<td>".$mod_strings['ERR_UW_CANNOT_DETERMINE_USER']."</td>".
85 "<td>".$mod_strings['ERR_UW_CANNOT_DETERMINE_GROUP']."</td>".
89 if(!is_writable($file)) {
90 logThis('File ['.$file.'] not writable - saving for display');
91 // don't warn yet - we're going to use this to check against replacement files
92 $filesNotWritable[$i] = $file;
93 $filesNWPerms[$i] = substr(sprintf('%o',fileperms($file)), -4);
94 $owner = posix_getpwuid(fileowner($file));
95 $group = posix_getgrgid(filegroup($file));
97 "<td><span class='error'>{$file}</span></td>".
98 "<td>{$filesNWPerms[$i]}</td>".
99 "<td>".$owner['name']."</td>".
100 "<td>".$group['name']."</td>".
107 $filesOut .= '</table></div>';
109 $errors['files']['filesNotWritable'] = (count($filesNotWritable) > 0) ? true : false;
110 if(count($filesNotWritable) < 1) {
111 $filesOut = "<b>{$mod_strings['LBL_UW_FILE_NO_ERRORS']}</b>";
114 logThis('Finished file permission check.');
116 ///////////////////////////////////////////////////////////////////////////////
118 ///////////////////////////////////////////////////////////////////////////////
120 logThis('Starting database permissions check...');
122 <a href='javascript:void(0); toggleNwFiles(\"dbPerms\");'>{$mod_strings['LBL_UW_SHOW_DB_PERMS']}</a>
123 <div id='dbPerms' style='display:none;'>
124 <table cellpadding='3' cellspacing='0' border='0'>
126 <th align='left'>{$mod_strings['LBL_UW_DB_PERMS']}</th>
129 $db =& DBManagerFactory::getInstance();
131 $outs['skip'] = false;
132 $outs['db'] = array();
133 $outs['dbOut'] = $dbOut;
134 $outs = testPermsCreate($db->dbType, $outs);
135 $outs = testPermsInsert($db->dbType, $outs, $outs['skip']);
136 $outs = testPermsUpdate($db->dbType, $outs, $outs['skip']);
137 $outs = testPermsSelect($db->dbType, $outs, $outs['skip']);
138 $outs = testPermsDelete($db->dbType, $outs, $outs['skip']);
139 $outs = testPermsAlterTableAdd($db->dbType, $outs, $outs['skip']);
140 $outs = testPermsAlterTableChange($db->dbType, $outs, $outs['skip']);
141 $outs = testPermsAlterTableDrop($db->dbType, $outs, $outs['skip']);
142 $outs = testPermsDropTable($db->dbType, $outs, $outs['skip']);
143 $outs['dbOut'] .= '</table>';
146 if(count($outs['db']) < 1) {
147 logThis('No permissions errors found!');
148 $outs['dbOut'] = "<b>".$mod_strings['LBL_UW_DB_NO_ERRORS']."</b>";
150 logThis('Finished database permissions check.');
151 $dbOut = $outs['dbOut'];
152 //// END DATABASE CHECKS
153 ///////////////////////////////////////////////////////////////////////////////
156 ///////////////////////////////////////////////////////////////////////////////
157 //// INSTALLER TYPE CHECKS
158 $result = checkSystemCompliance();
160 'phpVersion' => $mod_strings['LBL_UW_COMPLIANCE_PHP_VERSION'],
161 'mysqlVersion' => $mod_strings['LBL_UW_COMPLIANCE_MYSQL'],
162 'mssqlStatus' => $mod_strings['LBL_UW_COMPLIANCE_MSSQL_MAGIC_QUOTES'],
163 'xmlStatus' => $mod_strings['LBL_UW_COMPLIANCE_XML'],
164 'curlStatus' => $mod_strings['LBL_UW_COMPLIANCE_CURL'],
165 'imapStatus' => $mod_strings['LBL_UW_COMPLIANCE_IMAP'],
166 'mbstringStatus' => $mod_strings['LBL_UW_COMPLIANCE_MBSTRING'],
167 'safeModeStatus' => $mod_strings['LBL_UW_COMPLIANCE_SAFEMODE'],
168 'callTimeStatus' => $mod_strings['LBL_UW_COMPLIANCE_CALLTIME'],
169 'memory_msg' => $mod_strings['LBL_UW_COMPLIANCE_MEMORY'],
170 //commenting mbstring overload.
171 //'mbstring.func_overload' => $mod_strings['LBL_UW_COMPLIANCE_MBSTRING_FUNC_OVERLOAD'],
173 if($result['error_found'] == true) {
175 $phpIniLocation = get_cfg_var("cfg_file_path");
177 $sysCompliance = "<a href='javascript:void(0); toggleNwFiles(\"sysComp\");'>{$mod_strings['LBL_UW_SHOW_COMPLIANCE']}</a>";
178 $sysCompliance .= "<div id='sysComp' >";
179 $sysCompliance .= "<table cellpadding='0' cellspacing='0' border='0'>";
180 foreach($result as $k => $v) {
181 if($k == 'error_found')
183 $sysCompliance .= "<tr><td valign='top'>{$checks[$k]}</td>";
184 $sysCompliance .= "<td valign='top'>{$v}</td></tr>";
186 $sysCompliance .= "<tr><td valign='top'>{$mod_strings['LBL_UW_COMPLIANCE_PHP_INI']}</td>";
187 $sysCompliance .= "<td valign='top'><b>{$phpIniLocation}</b></td></tr>";
188 $sysCompliance .= "</table></div>";
190 $sysCompliance = "<b>{$mod_strings['LBL_UW_COMPLIANCE_ALL_OK']}</b>";
193 //// END INSTALLER CHECKS
194 ///////////////////////////////////////////////////////////////////////////////
196 //// stop on all errors
197 foreach($errors as $k => $type) {
198 if(is_array($type) && count($type) > 0) {
199 foreach($type as $k => $subtype) {
200 if($subtype == true) {
207 logThis('Found errors during system check - disabling forward movement.');
212 $GLOBALS['top_message'] = "{$mod_strings['LBL_UW_NEXT_TO_UPLOAD']}";
216 $showNext = ($stop) ? false : true;
218 $stepBack = $_REQUEST['step'] - 1;
219 $stepNext = $_REQUEST['step'] + 1;
221 $stepRecheck = $_REQUEST['step'];
223 $_SESSION['step'][$steps['files'][$_REQUEST['step']]] = ($stop) ? 'failed' : 'success';
226 ///////////////////////////////////////////////////////////////////////////////
239 <table cellpadding="3" cellspacing="4" border="0">
241 <td align="left" valign="top">
242 {$mod_strings['LBL_UW_FILE_ISSUES_PERMS']}:
254 <td align="left" valign="top">
255 {$mod_strings['LBL_UW_DB_ISSUES_PERMS']}:
267 <td align="left" valign="top">
268 {$mod_strings['LBL_UW_COMPLIANCE_TITLE2']}:
275 <div id="upgradeDiv" style="display:none">
276 <table border="0" cellspacing="0" cellpadding="0">
278 <p><img src='modules/UpgradeWizard/processing.gif'> <br></p>