Skip to content

Commit

Permalink
Install: added check for simplXML functions (case php7)
Browse files Browse the repository at this point in the history
+ changes related to sql-error display
  • Loading branch information
abolabo committed May 10, 2016
1 parent cdd2a1c commit d1efcc3
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
7 changes: 7 additions & 0 deletions public_html/core/database/amysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,11 @@ public function getLastId() {
public function __destruct() {
$this->connection->close();
}

public function getDBError(){
return array(
'error_text' => mysqli_error($this->connection),
'errno' => mysqli_errno($this->connection)
);
}
}
7 changes: 7 additions & 0 deletions public_html/core/database/apdomysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,11 @@ public function getLastId(){
public function __destruct(){
$this->connection = null;
}

public function getTextDBError(){
return array(
'error_text' => '',
'errno' => ''
);
}
}
7 changes: 7 additions & 0 deletions public_html/core/database/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,11 @@ public function __destruct() {
mysql_close($this->connection);
}
}

public function getDBError(){
return array(
'error_text' => mysql_error($this->connection),
'errno' => mysql_errno($this->connection)
);
}
}
7 changes: 7 additions & 0 deletions public_html/core/database/postgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,11 @@ public function __destruct() {
pg_close($this->connection);
}
}

public function getDBError(){
return array(
'error_text' => ($this->error ? $this->error : pg_result_error($this->connection)),
'errno' => null
);
}
}
3 changes: 2 additions & 1 deletion public_html/core/lib/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function performSql($file){
$query = str_replace("`ac_", "`" . DB_PREFIX, $query);
$result = $this->_query($query);
if (!$result) {
$this->error = mysql_error();
$err = $this->driver->getDBError();
$this->error = $err['error_text'];
return null;
}
$query = '';
Expand Down
4 changes: 4 additions & 0 deletions public_html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
die( MIN_PHP_VERSION . '+ Required for AbanteCart to work properly! Please contact your system administrator or host service provider.');
}

if (!function_exists('simplexml_load_file')) {
exit("simpleXML functions are not available. Please contact your system administrator or host service provider.");
}

// Load Configuration
// Real path (operating system web root) to the directory where abantecart is installed
$root_path = dirname(__FILE__);
Expand Down
4 changes: 4 additions & 0 deletions public_html/install/controller/pages/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ private function validate() {
$this->error['warning'] = 'Warning: MySQL extension needs to be loaded for AbanteCart to work!';
}

if (!function_exists('simplexml_load_file')) {
$this->error['warning'] = 'Warning: SimpleXML functions needs to be available in PHP!';
}

if (!extension_loaded('gd')) {
$this->error['warning'] = 'Warning: GD extension needs to be loaded for AbanteCart to work!';
}
Expand Down

0 comments on commit d1efcc3

Please sign in to comment.