Skip to content

Commit

Permalink
PATCH: faster id lists
Browse files Browse the repository at this point in the history
  • Loading branch information
thiemen committed Sep 8, 2019
0 parents commit d26b98b
Show file tree
Hide file tree
Showing 17 changed files with 563 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .editorconfig
@@ -0,0 +1,28 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = spaces
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,js,json,css,scss}]
indent_size = 2
indent_style = space

# Don't perform any clean-up on thirdparty files

[thirdparty/**]
trim_trailing_whitespace = false
insert_final_newline = false

[admin/thirdparty/**]
trim_trailing_whitespace = false
insert_final_newline = false
7 changes: 7 additions & 0 deletions .gitattributes
@@ -0,0 +1,7 @@
tests/ export-ignore
docs/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
.scrutinizer.yml export-ignore
_module_data
11 changes: 11 additions & 0 deletions .gitignore
@@ -0,0 +1,11 @@
.sass-cache
.DS_Store
npm-debug.log
/.buildpath
/.project
/.settings
css/GridField_print.css
admin/thirdparty/chosen/node_modules
node_modules/
coverage/
/**/*.js.map
3 changes: 3 additions & 0 deletions .htaccess
@@ -0,0 +1,3 @@
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
Deny from all
</FilesMatch>
6 changes: 6 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,6 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
56 changes: 56 additions & 0 deletions .travis.yml
@@ -0,0 +1,56 @@
language: php

dist: trusty

sudo: false

cache:
directories:
- $HOME/.composer/cache/files

# configure notifications (email, IRC, campfire etc)
notifications:
email: ssuerrors@gmail.com


addons:
apt:
packages:
- tidy

#before_install:
#- pip install --user codecov

env:
global:
- CORE_RELEASE=3.6.1
- COMPOSER_ROOT_VERSION=3.6.1
- DISPLAY=":99"
- XVFBARGS=":99 -ac -screen 0 1024x768x16"
- SS_BASE_URL="http://localhost:8080/"
- SS_ENVIRONMENT_TYPE="dev"

matrix:
fast_finish: true
include:
- php: 7.1
env:
- DB=MYSQL





before_script:
- pecl channel-update pecl.php.net
- phpenv rehash
- phpenv config-rm xdebug.ini || true
- composer self-update || true
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss

script:
# Execute tests with no coverage. This is the fastest option
- php framework/cli-script.php dev/build flush=all
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,13 @@
# Contributing to faster-id-lists

Please read the
[generic write up for contributing](https://docs.silverstripe.org/en/4.0/contributing/)
on silverstripe.org for some general information. In practice,
we would be stoked with any feedback / help you can provide.

## Copyright

By supplying code to this module in any form you agree to assign
copyright of that code to Sunny Side Up Limited, on the condition
that Sunny Side Up Limited releases that code under a form of open
source license.
35 changes: 35 additions & 0 deletions LICENSE
@@ -0,0 +1,35 @@
THIS LICENCE DOES NOT COVER ANY THIRD-PARTY CODE ADDED TO THIS MODULE.

THIRD-PARTY CODE IS COVERED BY ITS OWN LICENSE.

Copyright (c) 2009 - 2059 Citizens of Earth.

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of Sunny Side Up nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

* do not use for unsustainable, pornographic, earth-damaging, greedy,
degrading, racist, inappropriate, stupid or mean purposes.

THIS SOFTWARE IS PROVIDED BY Sunny Side Up Ltd. "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Sunny Side Up Ltd. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78 changes: 78 additions & 0 deletions README.md
@@ -0,0 +1,78 @@
# Silverstripe faster-id-lists module
[![Build Status](https://travis-ci.org/sunnysideup/silverstripe-faster-id-lists.svg?branch=master)](https://travis-ci.org/sunnysideup/silverstripe-faster-id-lists)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunnysideup/silverstripe-faster-id-lists/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunnysideup/silverstripe-faster-id-lists/?branch=master)
[![codecov.io](https://codecov.io/github/sunnysideup/silverstripe-faster-id-lists/coverage.svg?branch=master)](https://codecov.io/github/sunnysideup/silverstripe-faster-id-lists?branch=master)

[![Latest Stable Version](https://poser.pugx.org/sunnysideup/faster-id-lists/version)](https://packagist.org/packages/sunnysideup/faster-id-lists)
[![License](https://poser.pugx.org/sunnysideup/faster-id-lists/license)](https://packagist.org/packages/sunnysideup/faster-id-lists)
[![Monthly Downloads](https://poser.pugx.org/sunnysideup/faster-id-lists/d/monthly)](https://packagist.org/packages/sunnysideup/faster-id-lists)


## Documentation



* [Developer Docs](docs/en/INDEX.md)
* [User Guide](docs/en/userguide.md)
* [API Docs](http://docs.ssmods.com/sunnysideup/faster-id-lists/classes.xhtml)


## Requirements



See [composer.json](composer.json) for details


### Suggested Modules



See [composer.json](composer.json) for details


## Installation


```
composer require sunnysideup/faster-id-lists
```

### Configuration



In the `_config` folder you will find the `faster-id-lists.yml.example`
file that shows options for the configuration of this module.

We recommend that you:

1. copy these `faster-id-lists.yml.example` files into your
`app/_config` folder (where available - otherwise search for `private static $` in the module to see what can be configured)
2. remove the .example extension,
3. delete the lines you do not care about, and
4. adjust the configurations that you would like to use.


## Contributing



We welcome any contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

## Paid assistance



You can pay us to create an improved / adapted version of this module for your own projects. Please contact us if you like to find out more: [www.sunnysideup.co.nz](http://www.sunnysideup.co.nz). For exmaple, we can write tests for this module.

## Author



Sunny Side Up Ltd.


## Care to see more modules?

To find other modules, please visit [ssmods.com](http://ssmods.com/).
1 change: 1 addition & 0 deletions _config.php
@@ -0,0 +1 @@
<?php
6 changes: 6 additions & 0 deletions _config/faster-id-lists.yml.example
@@ -0,0 +1,6 @@
---
Name: FasterIDLists
---

Sunnysideup\FasterIdLists\FasterIDLists:
acceptable_max_number_of_select_statements: 500
32 changes: 32 additions & 0 deletions composer.json
@@ -0,0 +1,32 @@
{
"name": "sunnysideup/faster-id-lists",
"type": "silverstripe-vendormodule",
"description": "Make your silverstripe ORM faster by turning long list of ID select statements into smart ones",
"keywords": [
"Silverstripe-CMS",
"CMS",
"Silverstripe",
"ORM",
"filter",
"where",
"DataList",
"IDs",
"Performance"
],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Nicolaas Francken",
"email": "modules@sunnysideup.co.nz",
"role": "lead developer"
}
],
"require": {
"silverstripe/framework": "~4@stable",
},
"autoload": {
"psr-4": {
"Sunnysideup\\SearchSimpleSmart\\": "src/"
}
}
}
Empty file added docs/_manifest_exclude
Empty file.
21 changes: 21 additions & 0 deletions docs/en/INDEX.md
@@ -0,0 +1,21 @@
Use this code like this:

```
//use statements here ..
$idList = [1,2,3,4,5,6,11,12,13,17]l
Injector::inst()->create(
FasterIDLists::class,
MyClass:class
$idLists
)->filteredDatalist();
//or
//use statements here ..
$idList = [1,2,3,4,5,6,11,12,13,17]l
Injector::inst()->create(
FasterIDLists::class,
MyClass:class
$idLists
)->shortenIdList();
3 changes: 3 additions & 0 deletions docs/en/userguide.md
@@ -0,0 +1,3 @@
# User guide

- To be completed
10 changes: 10 additions & 0 deletions ecs.yml
@@ -0,0 +1,10 @@

imports:
- { resource: 'vendor/symplify/easy-coding-standard/config/set/psr2.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/common.yaml' }

parameters:
skip:
SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff.UnusedProperty: ~
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.Found: ~

0 comments on commit d26b98b

Please sign in to comment.