Changeset e107123 in github
- Timestamp:
- Oct 3, 2008 4:58:23 PM (5 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 97d6590
- Parents:
- 2b58528
- Location:
- installer
- Files:
-
- 1 added
- 4 edited
-
images/error.png (added)
-
index.php (modified) (1 diff)
-
rcube_install.php (modified) (4 diffs)
-
styles.css (modified) (3 diffs)
-
test.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
installer/index.php
r7d7f67d re107123 44 44 die("The requested configuration was not found. Please run the installer from the beginning."); 45 45 } 46 } 47 48 if (isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) { 49 $filename = $_GET['_mergeconfig'] . '.inc.php'; 50 51 header('Content-type: text/plain'); 52 header('Content-Disposition: attachment; filename="'.$filename.'"'); 53 54 $RCI->merge_config(); 55 echo $RCI->create_config($_GET['_mergeconfig'], true); 56 exit; 57 } 58 59 // go to 'test' step if we have a local configuration 60 if ($RCI->configured && empty($_REQUEST['_step'])) { 61 header("Location: ./?_step=3"); 62 exit; 46 63 } 47 64 -
installer/rcube_install.php
r7d7f67d re107123 32 32 var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; 33 33 var $config_props = array(); 34 35 var $obsolete_config = array('db_backend'); 36 var $replaced_config = array('skin_path' => 'skin', 'locale_string' => 'language'); 37 38 // these config options are optional or can be set to null 39 var $optional_config = array( 40 'log_driver', 'syslog_id', 'syslog_facility', 'imap_auth_type', 41 'smtp_helo_host', 'sendmail_delay', 'double_auth', 'language', 42 'mail_header_delimiter', 'create_default_folders', 43 'quota_zero_as_unlimited', 'spellcheck_uri', 'spellcheck_languages', 44 'http_received_header', 'session_domain', 'mime_magic', 'log_logins', 45 'enable_installer', 'skin_include_php'); 34 46 35 47 /** … … 117 129 * @return string The complete config file content 118 130 */ 119 function create_config($which )131 function create_config($which, $force = false) 120 132 { 121 133 $out = file_get_contents("../config/{$which}.inc.php.dist"); … … 167 179 168 180 // skip this property 169 if ( $value == $default)181 if (!$force && ($value == $default)) 170 182 continue; 171 183 … … 181 193 182 194 return trim($out); 195 } 196 197 198 /** 199 * Check the current configuration for missing properties 200 * and deprecated or obsolete settings 201 * 202 * @return array List with problems detected 203 */ 204 function check_config() 205 { 206 $this->config = array(); 207 $this->load_defaults(); 208 $defaults = $this->config; 209 210 $this->load_config(); 211 if (!$this->configured) 212 return null; 213 214 $out = $seen = array(); 215 $optional = array_flip($this->optional_config); 216 217 // ireate over the current configuration 218 foreach ($this->config as $prop => $value) { 219 if ($replacement = $this->replaced_config[$prop]) { 220 $out['replaced'][] = array('prop' => $prop, 'replacement' => $replacement); 221 $seen[$replacement] = true; 222 } 223 else if (!$seen[$prop] && in_array($prop, $this->obsolete_config)) { 224 $out['obsolete'][] = array('prop' => $prop); 225 $seen[$prop] = true; 226 } 227 } 228 229 // iterate over default config 230 foreach ($defaults as $prop => $value) { 231 if (!$seen[$prop] && !isset($this->config[$prop]) && !isset($optional[$prop])) 232 $out['missing'][] = array('prop' => $prop); 233 } 234 235 return $out; 236 } 237 238 239 /** 240 * Merge the current configuration with the defaults 241 * and copy replaced values to the new options. 242 */ 243 function merge_config() 244 { 245 $current = $this->config; 246 $this->config = array(); 247 $this->load_defaults(); 248 249 foreach ($this->replaced_config as $prop => $replacement) 250 if (isset($current[$prop])) { 251 if ($prop == 'skin_path') 252 $this->config[$replacement] = preg_replace('#skins/(\w+)/?$#', '\\1', $current[$prop]); 253 else 254 $this->config[$replacement] = $current[$prop]; 255 256 unset($current[$prop]); 257 } 258 259 foreach ($this->obsolete_config as $prop) { 260 unset($current[$prop]); 261 } 262 263 $this->config = array_merge($current, $this->config); 183 264 } 184 265 -
installer/styles.css
r27564f1 re107123 132 132 } 133 133 134 dt.propname {134 .propname { 135 135 font-family: monospace; 136 136 font-size: 9pt; … … 220 220 } 221 221 222 .warning { 222 .suggestion { 223 padding: 0.6em; 224 background-color: #ebebeb; 225 border: 1px solid #999; 226 } 227 228 p.warning, 229 div.warning { 223 230 padding: 1em; 224 231 background-color: #ef9398; … … 226 233 } 227 234 235 h3.warning { 236 color: #c00; 237 background: url('images/error.png') top left no-repeat; 238 padding-left: 24px; 239 } 240 228 241 .userconf { 229 242 color: #00c; -
installer/test.php
rbba657e re107123 26 26 else if (!$read_db) { 27 27 $RCI->fail('db.inc.php', 'Unable to read file. Did you create the config files?'); 28 } 29 30 if ($RCI->configured && ($messages = $RCI->check_config())) { 31 32 if (is_array($messages['missing'])) { 33 echo '<h3 class="warning">Missing config options</h3>'; 34 echo '<p class="hint">The following config options are not present in the current configuration.<br/>'; 35 echo 'Please check the default config files and add the missing properties to your local config files.</p>'; 36 37 echo '<ul class="configwarings">'; 38 foreach ($messages['missing'] as $msg) { 39 echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ': ' . $msg['name'] : '')); 40 } 41 echo '</ul>'; 42 } 43 44 if (is_array($messages['replaced'])) { 45 echo '<h3 class="warning">Replaced config options</h3>'; 46 echo '<p class="hint">The following config options have been replaced or renamed. '; 47 echo 'Please update them accordingly in your config files.</p>'; 48 49 echo '<ul class="configwarings">'; 50 foreach ($messages['replaced'] as $msg) { 51 echo html::tag('li', null, html::span('propname', $msg['prop']) . 52 ' was replaced by ' . html::span('propname', $msg['replacement'])); 53 } 54 echo '</ul>'; 55 } 56 57 if (is_array($messages['obsolete'])) { 58 echo '<h3>Obsolete config options</h3>'; 59 echo '<p class="hint">You still have some obsolete or inexistent properties set. This isn\'t a problem but should be noticed.</p>'; 60 61 echo '<ul class="configwarings">'; 62 foreach ($messages['obsolete'] as $msg) { 63 echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ': ' . $msg['name'] : '')); 64 } 65 echo '</ul>'; 66 } 67 68 echo '<p class="suggestion">OK, lazy people can download the updated config files here: '; 69 echo html::a(array('href' => './?_mergeconfig=main'), 'main.inc.php') . ' '; 70 echo html::a(array('href' => './?_mergeconfig=db'), 'db.inc.php'); 71 echo "</p>"; 28 72 } 29 73
Note: See TracChangeset
for help on using the changeset viewer.
