Skip to content

Commit

Permalink
Added exception for admin create_order request.
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoXtreme committed Jan 14, 2019
1 parent 798aed9 commit 84d6b7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
/nbproject/
20 changes: 13 additions & 7 deletions magento/framework/DB/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,21 @@ protected function isReadOnlyRequest( $sqlQuery )

$isExcept = false;
if ( php_sapi_name() != 'cli' && isset($_SERVER['REQUEST_URI']) ) {
$exceptions = ['customer', 'checkout'];
foreach ( $exceptions as $e ) {
//Exceptions where db request must be directed to master db only.
$exceptions = [
'customer',
'checkout',
'admin/sales/order_create'
];

foreach ( $exceptions as $e ) {

if ( strstr($_SERVER['REQUEST_URI'], $e) !== false) {
if ( strstr($_SERVER['REQUEST_URI'], $e) !== false) {

$isExcept = true;
}
$isExcept = true;
}

}
}
}

if( $this->isSlaveLocked === false &&
Expand Down Expand Up @@ -556,7 +562,7 @@ protected function _connect()
// As we use default value CURRENT_TIMESTAMP for TIMESTAMP type columns we need to set GMT timezone
$this->_connectionSlave->query("SET time_zone = '+00:00'");

if (isset($this->_config['initStatements'])) {
if (isset($this->_slaveConfig['initStatements'])) {
$this->query($this->_slaveConfig['initStatements']);
}

Expand Down

0 comments on commit 84d6b7c

Please sign in to comment.