Coder Social home page Coder Social logo

connectionsbundle's People

Contributors

ex13 avatar gimikus avatar grandltu avatar gyka avatar lauriis2 avatar lmikelionis avatar saimaz avatar tautelis avatar tautrimas avatar trylika avatar zylius avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connectionsbundle's Issues

Rename "Panther" name to "SyncStorage"

"Panther" name not good and need better name. It confuses with other names used in code like "Storage". So we decided to rename it with "SyncStorage".

No way to configure shop id for sync storage.

There is no way to configure shop id for command ongr:sync:provide magento
while ongr:sync:execute magento.product requires shop id.
So provide puts data into ongr_sync_storage but execute expects data in ongr_sync_storage_{shop_id} .

Design item skip pattern in Pipeline

Pipeline should be able to skip items. This can be achieved in mulitple ways:

  • Throwing exception.
  • Calling stopPropagation() and detecting it.

Should we throw a .skip event in that case?

Unclear shop id configuration.

Now used shop ids must be defined in parameters like this

parameters:
    shop_ids:
        - 0

But if configuration is not provided it default to shop ids and then ongr:sync:provide console command puts data in not suffixed table but SyncExecuteSourceEventListener never expect data in tables without suffix.

So the problem is that default configuration (no configuration) is invalid and it will not be clear what is wrong and i suggest either throwing errors if configuration is missing or changing default to something that works.

[Insight] Escape table name in JobsCleanupService

in Sync/DiffProvider/SyncJobs/JobsCleanupService.php, line 75

If provided by the user, the value of $this->tableName may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

     *
     * @return string
     */
    protected function generateCleanupQuery()
    {
        $query = 'DELETE FROM ' . $this->tableName . ' WHERE';

        if (empty($this->shops)) {
            return $query . ' `status` = ' . SyncJob::STATUS_DONE;
        }

Also, escaping functionality exists here: https://github.com/ongr-io/ConnectionsBundle/blob/63948a849c8befb4ddeeb4981da43438e456021a/Sync/StorageManager/MysqlStorageManager.php#L86-L89. Make sure to deduplicate.

Split config.yml

File services.yml should be split into functionally related service sets.

Benchmarks for console command

Some console commands have this code:

        $output->writeln('');
        $output->writeln(sprintf('<info>Job finished in %.2f s</info>', microtime(true) - $start));
        $output->writeln(sprintf('<info>Memory usage: %.2f MB</info>', memory_get_peak_usage() >> 20));

This should be abstracted away as a CommandBenchmark object that takes $output as an argument.

[Insight] Boolean should be compared strictly

There are several places, where non-strict comparison is being made with false, true or null. Change to strict equality check. See this report:


in Sync/DiffProvider/Binlog/BinlogDiffProvider.php, line 243

With booleans, only strict comparison (with === operator) should be used to lower bug risks and to improve performances.

    /**
     * {@inheritdoc}
     */
    public function next()
    {
        if ($this->valid() == true) {
            $this->setFromDate($this->current()->getTimestamp());
        }
        $this->getBinlogDecorator()->next();
    }

Posted from SensioLabsInsight

PHPunit config logging standard

Most of ONGR bundles use:

<logging>
<log type="coverage-text" target="php://stdout" showOnlySummary="true"/>
<!--<log type="coverage-html" target="Tests/app/build/coverage" title="Coverage" charset="UTF-8" yui="true" highlight="true"/>-->
</logging>

for logging settings.
I think this config should be updated accordingly.

Rename $pipeline->execute to start

Word "execute" is reserved for "execute" process as a whole for executing elements from SyncStorage.

"start" is a good name, because pipeline might have other methods for modifying, consuming and finalizing.

Folder Service/ is too abstract

Namespace Service is too abstract. Contents should be split into more functional namespaces like Util and UrlInvalidator.

[doc] Write data import overview page

Page should be written, that has image of the whole import process + sync. It should include description of each stage briefly with command examples (maybe use sphinx import functionality to deduplicate code).

Possibly, Magento can be used as an example. Magento page itself will have only usage instructions. This page will be more in depth.

Further discussions are needed.

Write proper README.md

Add short and clear description, possibly copied from Resources/doc.

Add warning of alpha stability.

Add link to further documentation as in ESB.

Duplicate service definitions

[Insight] Files should not be executable

Your project contains files with permissive permissions. In order to avoid opening a security breach, you should restrict execution rights on following files:

  • .gitignore
  • ONGRConnectionsBundle.php
  • Resources/config/services.yml
  • composer.json
chmod a-x '.gitignore' \
    'ONGRConnectionsBundle.php' \
    'Resources/config/services.yml' \
    'composer.json'

Posted from SensioLabsInsight

Research bundle folder organisation strategy

There is Event folder and Pipeline/Event. We should either mover everything to Event or distribute events to their own namespaces.

I would prefer second variant to avoid crowded folders.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.