Migrates the emailflag status values in order table to the order status table.

@param array $stmts Associative array of tables names and lists of SQL statements to execute.
13659
protected function _process( array $stmts )
	{
		$this->_msg( 'Fixing order email status values', 0 );

		if( $this->_schema->tableExists( 'mshop_order_status' ) === true )
		{
			$this->_execute( $stmts['update'] );

			$mapping = array(
				0 => 'email-deleted',
				1 => 'email-pending',
				2 => 'email-progress',
				3 => 'email-dispatched',
				4 => 'email-delivered',
				5 => 'email-lost',
				6 => 'email-refused',
				7 => 'email-returned',
			);

			$cntRows = 0;
			foreach( $mapping as $value => $type )
			{
				$stmt = $this->_conn->create( $stmts['change'] );
				$stmt->bind( 1, $value, MW_DB_Statement_Abstract::PARAM_INT );
				$stmt->bind( 2, $type );

				$result = $stmt->execute();
				$cntRows += $result->affectedRows();
				$result->finish();
			}

			if( $cntRows > 0 ) {
				$this->_status( sprintf( 'migrated (%1$d)', $cntRows ) );
			} else {
				$this->_status( 'OK' );
			}
		}
		else
		{
			$this->_status( 'OK' );
		}

	}
1288227
public function setSmtpConfig($swiftSmtpTransport, $attributes)
    {
        foreach ($attributes as $key => $value) {
            $method = 'set'.ucfirst($key);
            $swiftSmtpTransport->{$method}($value);
        }
    }
850867
protected function _process( array $stmts )
	{
		$column = 'domain';
		$this->_msg( 'Changing "domain" columns', 0 ); $this->_status( '' );

		foreach( $stmts as $table=>$stmtList )
		{
			$this->_msg( sprintf( 'Checking table "%1$s": ', $table ), 1 );

			if( $this->_schema->tableExists( $table ) === true
				&& $this->_schema->columnExists( $table, $column ) === true
				&& $this->_schema->getColumnDetails( $table, $column )->getDataType() == "varchar"
				&& $this->_schema->getColumnDetails( $table, $column )->getMaxLength() != 32 )
			{
				$this->_executeList( $stmtList );
				$this->_status( 'migrated' );
			}
			else
			{
				$this->_status( 'OK' );
			}
		}
	}
1250356
protected function _process( array $stmts )
	{
		$this->_msg( 'Migrating "Complete" to "BasketLimits" plugin', 0 ); $this->_status( '' );

		if( $this->_schema->columnExists( 'mshop_plugin', 'config' ) === true
			&& $this->_schema->columnExists( 'mshop_plugin', 'provider' ) === true
		) {
			foreach( $stmts as $key => $list )
			{
				$this->_msg( sprintf( 'Migrating "%1$s"', $key ), 1 );

				if( $this->_getValue( $list['select'], 'cnt' ) > 0 )
				{
					$this->_execute( $list['update'] );
					$this->_status( 'migrated' );
				}
				else
				{
					$this->_status( 'OK' );
				}
			}
		}
	}
1099011
public static function onlyThrowsOrExits(array $stmts)
    {
        if (empty($stmts)) {
            return false;
        }

        for ($i = count($stmts) - 1; $i >= 0; --$i) {
            $stmt = $stmts[$i];

            if ($stmt instanceof PhpParser\Node\Stmt\Throw_
                || ($stmt instanceof PhpParser\Node\Stmt\Expression
                    && $stmt->expr instanceof PhpParser\Node\Expr\Exit_)
            ) {
                return true;
            }
        }

        return false;
    }
550997
protected function _process( array $stmts )
	{
		$this->_msg( 'Renaming service configuration', 0 );

		if( $this->_schema->tableExists( 'mshop_service' )
			&& $this->_schema->columnExists( 'mshop_service', 'config' ) === true
		) {
			$cntRows = 0;

			foreach( $stmts as $stmt )
			{
				$result = $this->_conn->create( $stmt )->execute();
				$cntRows += $result->affectedRows();
				$result->finish();
			}

			if( $cntRows > 0 ) {
				$this->_status( sprintf( 'done (%1$d)', $cntRows ) );
			} else {
				$this->_status( 'OK' );
			}
		}
		else
		{
			$this->_status( 'OK' );
		}
	}
1113293
protected function ensureClassOrTraitExists($name, $stmt)
    {
        if (!$this->classExists($name) && !$this->traitExists($name)) {
            throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
        }
    }
808859
private function doBind(Statement $stmt)
    {
        foreach ($this->boundValues as $key => $value) {
            $stmt->bindValue($key, $value, $this->boundValuesType[$key]);
        }
        foreach ($this->boundParameters as $key => &$value) {
            $stmt->bindParam($key, $value, $this->boundParametersType[$key]);
        }
    }
647050
public function setTemplates(array $templates) {

        if ($templates !== null && is_array($templates)) {
            $this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
        }

        $this->_setTemplatesWrapper($templates);
    }
408723
public function setImported($ids)
    {
        if (empty($ids)) {
            return;
        }
        $connection = $this->getConnection();
        $tableName = $this->getTable(Schema::EMAIL_ORDER_TABLE);
        $connection->update(
            $tableName,
            [
                'modified' => new \Zend_Db_Expr('null'),
                'email_imported' => '1',
                'updated_at' => gmdate('Y-m-d H:i:s')
            ],
            ["order_id IN (?)" => $ids]
        );
    }
575775
protected function _process( array $stmts )
	{
		$this->_msg( 'Removing locale constraints from supplier tables', 0 );
		$this->_status( '' );

		$schema = $this->_getSchema( 'db-supplier' );

		foreach( $stmts as $table => $list )
		{
			if( $schema->tableExists( $table ) === true )
			{
				foreach( $list as $constraint => $stmt )
				{
					$this->_msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 );

					if( $schema->constraintExists( $table, $constraint ) !== false )
					{
						$this->_execute( $stmt, 'db-supplier' );
						$this->_status( 'done' );
					} else {
						$this->_status( 'OK' );
					}
				}
			}
		}
	}
325272
protected function _process( array $stmts )
	{
		$table = "madmin_job";
		$this->_msg( sprintf( 'Converting "%1$s" to InnoDB".', $table ), 0 );

		$stmt = $this->_conn->create( $stmts['check'] );
		$stmt->bind( 1, $this->_schema->getDBName() );
		$stmt->bind( 2, $table );
		$result = $stmt->execute();
		$dbname = $result->fetch();
		$result->finish();

		if( $this->_schema->tableExists( $table ) === true
			&& $dbname['ENGINE'] === 'MyISAM' )
		{
			$this->_execute( $stmts['convert'] );
			$this->_status( 'converted' );
		}
		else
		{
			$this->_status( 'OK' );
		}
	}
1185986
protected function process( array $stmts )
	{
		$this->msg( 'Removing locale constraints from customer tables', 0 );
		$this->status( '' );

		$schema = $this->getSchema( 'db-customer' );

		foreach( $stmts as $table => $list )
		{
			if( $schema->tableExists( $table ) === true )
			{
				foreach( $list as $constraint => $stmt )
				{
					$this->msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 );

					if( $schema->constraintExists( $table, $constraint ) !== false )
					{
						$this->execute( $stmt, 'db-customer' );
						$this->status( 'done' );
					} else {
						$this->status( 'OK' );
					}
				}
			}
		}
	}
345836
public static function doesEverBreak(array $stmts)
    {
        if (empty($stmts)) {
            return false;
        }

        for ($i = count($stmts) - 1; $i >= 0; --$i) {
            $stmt = $stmts[$i];

            if ($stmt instanceof PhpParser\Node\Stmt\Break_) {
                return true;
            }

            if ($stmt instanceof PhpParser\Node\Stmt\If_) {
                if (self::doesEverBreak($stmt->stmts)) {
                    return true;
                }

                if ($stmt->else && self::doesEverBreak($stmt->else->stmts)) {
                    return true;
                }

                foreach ($stmt->elseifs as $elseif) {
                    if (self::doesEverBreak($elseif->stmts)) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
441596
protected function getResultsStrictTyped(\PDOStatement $stmt, int $fetchStyle = \PDO::FETCH_ASSOC)
    {
        /**
         * @var array|object|bool $results
         */
        $results = $stmt->fetchAll($fetchStyle);
        if (\is_array($results)) {
            return $results;
        } elseif (\is_object($results)) {
            return $results;
        }
        throw new \TypeError('Unexpected return type: ' . $this->getValueType($results));
    }
1362545
public function tr(array $attributes = []): void
    {
        $this->trArray[] = Tags::tr($this->tdArray, $attributes);
        $this->tdArray = [];
    }
328422
protected function bindParams($stm, $sqlParams)
    {
        if (empty($sqlParams)) {
            $sqlParams = [];
        }
        uksort(
            $sqlParams,
            function ($k1, $k2) {
                return strlen($k1) < strlen($k2);
            }
        );
        $paramNum = 0;
        foreach ($sqlParams as $paName => $paValue) {
            $type = gettype($paValue);
            if ($type === 'array') {
                foreach ($paValue as $i=>$value) {
                    $paramType = $this->typeToPDOParamType(gettype($value));
                    $paramName = ":pdoParam$paramNum";
                    $paramNum++;
                    // $stm->bindValue($paName . "_param$i", $value, $paramType);
                    $stm->bindValue($paramName, $value, $paramType);
                }
            } else {
                $paramType = $this->typeToPDOParamType($type);
                $stm->bindValue($paName, $paValue, $paramType);
            }
        }
    }