Changeset View
Changeset View
Standalone View
Standalone View
core/install.php
Show First 20 Lines • Show All 326 Lines • ▼ Show 20 Line(s) | |||||
$this->currentStep = $this->GetNextStep(); | $this->currentStep = $this->GetNextStep(); | ||||
break; | break; | ||||
case 'db_config': | case 'db_config': | ||||
case 'db_reconfig': | case 'db_reconfig': | ||||
$fields = Array ( | $fields = Array ( | ||||
'DBType', 'DBHost', 'DBName', 'DBUser', | 'DBType', 'DBHost', 'DBName', 'DBUser', | ||||
'DBUserPassword', 'DBCollation', 'TablePrefix' | 'DBUserPassword', 'DBCollation', 'TablePrefix', | ||||
'DBErrorBackoffMaxRetryAttempts', | |||||
'DBErrorBackoffLogicBaseTime', | |||||
'DBEnableLockRetryDebugging', | |||||
); | ); | ||||
// set fields | // set fields | ||||
foreach ($fields as $field_name) { | foreach ($fields as $field_name) { | ||||
$submit_value = $this->GetVar($field_name); | $submit_value = $this->GetVar($field_name); | ||||
if ($submit_value !== false) { | if ($submit_value !== false) { | ||||
$this->toolkit->systemConfig->set($field_name, 'Database', $submit_value); | $this->toolkit->systemConfig->set($field_name, 'Database', $submit_value); | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | |||||
$status = true; | $status = true; | ||||
switch ($this->currentStep) { | switch ($this->currentStep) { | ||||
case 'db_config': | case 'db_config': | ||||
case 'db_reconfig': | case 'db_reconfig': | ||||
// 1. check if required fields are filled | // 1. check if required fields are filled | ||||
$section_name = 'Database'; | $section_name = 'Database'; | ||||
$required_fields = Array ('DBType', 'DBHost', 'DBName', 'DBUser', 'DBCollation'); | $required_fields = Array ( | ||||
Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Arrays.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
'DBType', 'DBHost', 'DBName', 'DBUser', 'DBCollation', | |||||
'DBErrorBackoffMaxRetryAttempts', | |||||
'DBErrorBackoffLogicBaseTime', | |||||
'DBEnableLockRetryDebugging', | |||||
); | |||||
foreach ($required_fields as $required_field) { | foreach ($required_fields as $required_field) { | ||||
Expected 1 spaces before "foreach" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "foreach" closing bracket; 0 found | |||||
Expected 1 spaces after "foreach" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "foreach" opening bracket; 0 found | |||||
No blank line found before "foreach" control structure Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen: No blank line found before "foreach" control structure | |||||
if (!$this->toolkit->systemConfig->get($required_field, $section_name)) { | if ($this->toolkit->systemConfig->get($required_field, $section_name) === '') { | ||||
Expected 1 spaces after "if" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "if" opening bracket; 0 found | |||||
Expected 1 spaces before "if" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "if" closing bracket; 0 found | |||||
$status = false; | $status = false; | ||||
$this->errorMessage = 'Please fill all required fields'; | $this->errorMessage = 'Please fill all required fields'; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if ( !$status ) { | if ( !$status ) { | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 1195 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
return $ret; | return $ret; | ||||
} | } | ||||
/** | /** | ||||
* Installation error handler for sql errors | * Installation error handler for sql errors | ||||
* | * | ||||
* @param int $code | * @param integer $code Error code. | ||||
* @param string $msg | * @param string $msg Error message. | ||||
* @param string $sql | * @param string $sql SQL query. | ||||
* @return bool | * @param boolean|null $throw_exception Throw an exception. | ||||
* @access private | * | ||||
* @return boolean | |||||
* @throws RuntimeException When requested. | |||||
*/ | */ | ||||
function DBErrorHandler($code, $msg, $sql) | function DBErrorHandler($code, $msg, $sql, $throw_exception = null) | ||||
Visibility must be declared on method "DBErrorHandler" Lint: Squiz.Scope.MethodScope.Missing: Visibility must be declared on method "DBErrorHandler" | |||||
{ | { | ||||
$this->errorMessage = 'Query: <br />'.htmlspecialchars($sql, ENT_QUOTES, 'UTF-8').'<br />execution result is error:<br />['.$code.'] '.$msg; | $error_msg = 'Query: <br />' . htmlspecialchars($sql, ENT_QUOTES, 'UTF-8') . '<br />'; | ||||
$error_msg .= 'execution result is error:<br />[' . $code . '] ' . $msg; | |||||
if ( $throw_exception === true ) { | |||||
throw new RuntimeException($error_msg); | |||||
} | |||||
$this->errorMessage = $error_msg; | |||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Installation error handler | * Installation error handler | ||||
* | * | ||||
* @param int $errno | * @param int $errno | ||||
* @param string $errstr | * @param string $errstr | ||||
Show All 39 Lines |
PHP keywords must be lowercase; expected "array" but found "Array"