diff --git a/.codeclimate.yml b/.codeclimate.yml index 29d31a8fb..b56fe5ba0 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -33,18 +33,18 @@ engines: enabled: true exclude_paths: -- "core/public/js/jquery/*" -- "data/*" -- "docs/*" -- "library/REST/*" -- "library/SwaggerUI/*" -- "log/*" -- "modules/oai/library/oai/*" -- "modules/statistics/public/js/googlemaps/*" -- "modules/statistics/public/js/jquery/*" -- "modules/visualize/public/js/jquery/*" -- "modules/visualize/public/js/webgl/*" -- "provisioning/*" -- "tmp/*" -- "utils/*" -- "vendor/*" + - 'core/public/js/jquery/*' + - 'data/*' + - 'docs/*' + - 'library/REST/*' + - 'library/SwaggerUI/*' + - 'log/*' + - 'modules/oai/library/oai/*' + - 'modules/statistics/public/js/googlemaps/*' + - 'modules/statistics/public/js/jquery/*' + - 'modules/visualize/public/js/jquery/*' + - 'modules/visualize/public/js/webgl/*' + - 'provisioning/*' + - 'tmp/*' + - 'utils/*' + - 'vendor/*' diff --git a/.eslintrc b/.eslintrc index 658e0a9c8..19d924d8a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -18,26 +18,31 @@ #============================================================================= --- +root: true + +env: + browser: true + jquery: true + +extends: 'eslint:recommended' + rules: indent: - 2 - 4 - quotes: - - 2 - - single + linebreak-style: - 2 - unix - semi: - - 2 - - always no-unused-vars: - 2 - argsIgnorePattern: ^_ -env: - browser: true - jquery: true + quotes: + - 2 + - single -extends: 'eslint:recommended' + semi: + - 2 + - always diff --git a/.styleci.yml b/.styleci.yml index 6e0edea44..c69858861 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -29,7 +29,6 @@ disabled: - phpdoc_types - phpdoc_var_without_name - finder: exclude: - data diff --git a/.travis.yml b/.travis.yml index 0019cf866..4cf4e8372 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ language: php sudo: false php: + - 5.3 - 5.4 - 5.5 - 5.6 @@ -42,6 +43,7 @@ cache: before_install: - travis_retry composer self-update -n - if [[ $TRAVIS_PULL_REQUEST = false ]]; then composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN; fi + - if [[ $TRAVIS_PHP_VERSION = 5.3 ]]; then sed -i '/uuid-console/d' composer.json; fi - if [[ $TRAVIS_PHP_VERSION = hhvm || $TRAVIS_PHP_VERSION = 7 ]]; then sed -i '/ext-xdebug/d' composer.json; fi install: diff --git a/README.md b/README.md index ddd364d41..9e7a4a69e 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,25 @@ interface with existing workflows. ## Installation ## -``` +```bash git clone https://github.com/midasplatform/Midas.git midas cd midas chmod a+w core/configs/ data/ log/ tmp/ curl -sS https://getcomposer.org/installer | php +``` + +For development (PHP version 5.4.0 or above): + +```bash php composer.phar install ``` +For production (PHP version 5.3.9 or above): + +```bash +php composer.phar install --no-dev --optimize-autoloader +``` + Full installation documentation is available at diff --git a/app.yaml b/app.yaml index 94f585ab4..f45f64259 100644 --- a/app.yaml +++ b/app.yaml @@ -26,30 +26,30 @@ api_version: 1 threadsafe: yes handlers: -- url: /(apple-touch-icon-.*\.png)$ - static_files: \1 - upload: apple-touch-icon-.*\.png$ - secure: always + - url: /(apple-touch-icon-.*\.png)$ + static_files: \1 + upload: apple-touch-icon-.*\.png$ + secure: always -- url: /favicon\.ico$ - static_files: favicon.ico - upload: favicon\.ico$ - secure: always + - url: /favicon\.ico$ + static_files: favicon.ico + upload: favicon\.ico$ + secure: always -- url: /(.*/(public|SwaggerUI)/.*\.(css|gif|ico|jpeg|jpg|js|map|png))$ - static_files: \1 - upload: .*\.(css|gif|ico|jpeg|jpg|js|map|png)$ - secure: always + - url: /(.*/(public|SwaggerUI)/.*\.(css|gif|ico|jpeg|jpg|js|map|png))$ + static_files: \1 + upload: .*\.(css|gif|ico|jpeg|jpg|js|map|png)$ + secure: always -# Must enable the task scheduler module. The cron job is defined in cron.yaml. -- url: /scheduler/run - script: index.php - login: admin - secure: always + # Must enable the task scheduler module. The cron job is defined in cron.yaml. + - url: /scheduler/run + script: index.php + login: admin + secure: always -- url: /.* - script: index.php - secure: always + - url: /.* + script: index.php + secure: always # Update with the bucket name and the project id. Also update php.ini with the bucket name. env_variables: @@ -59,10 +59,10 @@ env_variables: midas_temp_path: gs://your-cloudstorage-bucket/tmp skip_files: -- ^(.*/)?.*/(\.DS_Store|\.htaccess|\.gitignore|CMakeLists\.txt|.*\.java)$ -- ^(.*/)?.*/\.sass-cache/.* -- ^(.*/)?(\.codeclimate\.yml|\.coveralls\.yml|\.editorconfig|\.php_cs|\.php_cs\.cache|\.styleci\.yml|\.travis\.yml|AUTHORS|bower\.json|composer\.json|composer\.lock|composer\.phar|COPYRIGHT|CTestConfig\.cmake|LICENSE|mkdocs\.yml|phpunit\.xml\.dist|README\.md|requirements\.txt|Vagrantfile)$ -- ^(.*/)?core/configs/.*\.local\.ini$ -- ^(.*/)?(\.git|\.idea|\.vagrant|data|docs|env|log|provisioning|site|tests|tmp|utils)/.* -- ^(.*/)?(core|modules/.*)/(database/(pgsql|sqlite)|tests)/.* -- ^(.*/)?modules/(archive|batchmake|dicom.*|javauploaddownload|metadataextractor|pvw|remoteprocessing|solr|statistics|visualize)/.* + - ^(.*/)?.*/(\.DS_Store|\.htaccess|\.gitignore|CMakeLists\.txt|.*\.java)$ + - ^(.*/)?.*/\.sass-cache/.* + - ^(.*/)?(\.codeclimate\.yml|\.coveralls\.yml|\.editorconfig|\.php_cs|\.php_cs\.cache|\.styleci\.yml|\.travis\.yml|AUTHORS|bower\.json|composer\.json|composer\.lock|composer\.phar|COPYRIGHT|CTestConfig\.cmake|LICENSE|mkdocs\.yml|phpunit\.xml\.dist|README\.md|requirements\.txt|Vagrantfile)$ + - ^(.*/)?core/configs/.*\.local\.ini$ + - ^(.*/)?(\.git|\.idea|\.vagrant|data|docs|env|log|provisioning|site|tests|tmp|utils)/.* + - ^(.*/)?(core|modules/.*)/(database/(pgsql|sqlite)|tests)/.* + - ^(.*/)?modules/(archive|batchmake|dicom.*|javauploaddownload|metadataextractor|pvw|remoteprocessing|solr|statistics|visualize)/.* diff --git a/composer.json b/composer.json index 8db520a5e..b50d3c009 100644 --- a/composer.json +++ b/composer.json @@ -11,34 +11,34 @@ "source": "https://github.com/midasplatform/Midas" }, "require": { - "php": ">=5.3.23", + "php": ">=5.3.9", "ext-gd": "*", "ext-json": "*", - "erusev/parsedown-extra": "~0.7", + "erusev/parsedown-extra": "^0.7.0", "francodacosta/phmagick": "0.4.*@dev", - "google/apiclient": "~1.1", - "intervention/image": "~2.3", - "ircmaxell/random-lib": "~1.1", - "maennchen/zipstream-php": "~0.3", - "moontoast/math": "~1.1", - "ramsey/uuid": "~3.0", - "reprovinci/solr-php-client": "~1.0", - "sendgrid/sendgrid": "~3.2", - "zendframework/zendframework1": "~1.12" + "google/apiclient": "^1.1.5", + "intervention/image": "^2.2.2", + "ircmaxell/random-lib": "^1.1.0", + "maennchen/zipstream-php": "^0.3.0", + "moontoast/math": "^1.1.0", + "ramsey/uuid": ">=2.8.3 <4.0", + "reprovinci/solr-php-client": "^1.0.3", + "sendgrid/sendgrid": "^4.0.0", + "zendframework/zendframework1": "^1.12.16" }, "require-dev": { "ext-xdebug": "*", - "fabpot/php-cs-fixer": "~1.10", - "jokkedk/zfdebug": "~1.6", - "leafo/scssphp": "~0.3", + "fabpot/php-cs-fixer": "^1.10.2", + "jokkedk/zfdebug": "^1.6.2", + "leafo/scssphp": "^0.3.2", "phpcheckstyle/phpcheckstyle": "V0.14.1", - "phpunit/dbunit": "~1.4", - "phpunit/phpcov": "~2.0", - "phpunit/phpunit": "~4.8", - "ramsey/uuid-console": "~1.0", - "satooshi/php-coveralls": "~0.6", - "sensiolabs/security-checker": "~3.0", - "symfony/console": "~2.7" + "phpunit/dbunit": "^1.4.1", + "phpunit/phpcov": "^2.0.2", + "phpunit/phpunit": "^4.8.16", + "ramsey/uuid-console": "^1.0.0", + "satooshi/php-coveralls": "^0.6.1", + "sensiolabs/security-checker": "^3.0.1", + "symfony/console": "^2.7.5" }, "suggest": { "ext-fileinfo": "*", diff --git a/core/controllers/components/UuidComponent.php b/core/controllers/components/UuidComponent.php index 7098eaea7..3817933d3 100644 --- a/core/controllers/components/UuidComponent.php +++ b/core/controllers/components/UuidComponent.php @@ -28,7 +28,13 @@ class UuidComponent extends AppComponent */ public function generate() { - return str_replace('-', '', \Ramsey\Uuid\Uuid::uuid4()->toString()); + if (class_exists('\Ramsey\Uuid\Uuid')) { + $uuid = \Ramsey\Uuid\Uuid::uuid4(); + } else { + $uuid = \Rhumsaa\Uuid\Uuid::uuid4(); + } + + return str_replace('-', '', $uuid->toString()); } /** diff --git a/cron.yaml b/cron.yaml index 05ee94ce9..cda6e9e08 100644 --- a/cron.yaml +++ b/cron.yaml @@ -20,6 +20,6 @@ --- # Must enable the task scheduler module. cron: -- description: task scheduler job - url: /scheduler/run - schedule: every 12 minutes + - description: task scheduler job + url: /scheduler/run + schedule: every 12 minutes diff --git a/modules/javauploaddownload/controllers/UploadController.php b/modules/javauploaddownload/controllers/UploadController.php index 8afb44a05..5f925ca3e 100644 --- a/modules/javauploaddownload/controllers/UploadController.php +++ b/modules/javauploaddownload/controllers/UploadController.php @@ -225,7 +225,8 @@ public function gethttpuploadoffsetAction() $this->disableLayout(); $this->disableView(); $params = $this->getAllParams(); - $userId = explode('/', $params['uploadUniqueIdentifier'])[0]; + $userIds = explode('/', $params['uploadUniqueIdentifier']); + $userId = $userIds[0]; if ($userId != $this->userSession->Dao->getUserId()) { echo '[ERROR]User id does not match upload token user id';