aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-09-11 18:48:36 +0200
committerGitHub <noreply@github.com>2016-09-11 18:48:36 +0200
commit59758d8fe5ad5ff554391515a78d84b0d47bdb76 (patch)
tree43054fdd7f15e11d681970dfb692b269fbf6b705
parentc078d18372e05b09b40c34f67b7cb81446f30c4f (diff)
parent88e88016b9a86d76940082b62c85c3756f461cb2 (diff)
downloadwallabag-59758d8fe5ad5ff554391515a78d84b0d47bdb76.tar.gz
wallabag-59758d8fe5ad5ff554391515a78d84b0d47bdb76.tar.zst
wallabag-59758d8fe5ad5ff554391515a78d84b0d47bdb76.zip
Merge pull request #2279 from wallabag/cleanup-travis
Check if asset is enable instead of opposite
-rw-r--r--.travis.yml18
-rwxr-xr-xbin/symfony_requirements13
-rwxr-xr-xinstall.sh19
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/ReadabilityImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagImport.php2
-rw-r--r--var/SymfonyRequirements.php74
7 files changed, 80 insertions, 50 deletions
diff --git a/.travis.yml b/.travis.yml
index c343d5ae..749b8ef7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,9 +30,9 @@ node_js:
30 - "5" 30 - "5"
31 31
32env: 32env:
33 - DB=mysql ASSETS=nobuild 33 - DB=mysql
34 - DB=pgsql ASSETS=nobuild 34 - DB=pgsql
35 - DB=sqlite ASSETS=nobuild 35 - DB=sqlite
36 36
37matrix: 37matrix:
38 fast_finish: true 38 fast_finish: true
@@ -57,7 +57,7 @@ matrix:
57 group: edge 57 group: edge
58 env: DB=sqlite 58 env: DB=sqlite
59 - php: 7.0 59 - php: 7.0
60 env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run DB=sqlite ASSETS=nobuild 60 env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run DB=sqlite
61 - php: 7.0 61 - php: 7.0
62 env: DB=sqlite ASSETS=build 62 env: DB=sqlite ASSETS=build
63 allow_failures: 63 allow_failures:
@@ -77,11 +77,11 @@ before_script:
77 - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi 77 - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
78 - if [[ $PHP = 5.5 ]]; then composer require "phpunit/phpunit:4.*" --no-update; fi; 78 - if [[ $PHP = 5.5 ]]; then composer require "phpunit/phpunit:4.*" --no-update; fi;
79 - composer self-update --no-progress 79 - composer self-update --no-progress
80 - if [[ "$DB" = "pgsql" ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; 80 - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi;
81 81
82install: 82install:
83 - if [[ $ASSETS != nobuild ]]; then source ~/.nvm/nvm.sh && nvm install 5.0; fi; 83 - if [[ $ASSETS = build ]]; then source ~/.nvm/nvm.sh && nvm install 5.0; fi;
84 - if [[ $ASSETS != nobuild ]]; then npm install -g npm@latest; fi; 84 - if [[ $ASSETS = build ]]; then npm install -g npm@latest; fi;
85 85
86before_install: 86before_install:
87 - if [[ $TRAVIS_REPO_SLUG = wallabag/wallabag ]]; then cp .composer-auth.json ~/.composer/auth.json; fi; 87 - if [[ $TRAVIS_REPO_SLUG = wallabag/wallabag ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
@@ -90,5 +90,5 @@ script:
90 - travis_wait bash install.sh 90 - travis_wait bash install.sh
91 - ant prepare-$DB 91 - ant prepare-$DB
92 - phpunit -v 92 - phpunit -v
93 - if [ "$CS_FIXER" = "run" ]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi; 93 - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi;
94 - if [ "$VALIDATE_TRANSLATION_FILE" = "run" ]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; 94 - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
diff --git a/bin/symfony_requirements b/bin/symfony_requirements
index 8825a964..a7bf65a1 100755
--- a/bin/symfony_requirements
+++ b/bin/symfony_requirements
@@ -22,7 +22,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.' ';
22 22
23$messages = array(); 23$messages = array();
24foreach ($symfonyRequirements->getRequirements() as $req) { 24foreach ($symfonyRequirements->getRequirements() as $req) {
25 /** @var $req Requirement */
26 if ($helpText = get_error_message($req, $lineSize)) { 25 if ($helpText = get_error_message($req, $lineSize)) {
27 echo_style('red', 'E'); 26 echo_style('red', 'E');
28 $messages['error'][] = $helpText; 27 $messages['error'][] = $helpText;
@@ -121,10 +120,14 @@ function echo_block($style, $title, $message)
121 120
122 echo PHP_EOL.PHP_EOL; 121 echo PHP_EOL.PHP_EOL;
123 122
124 echo_style($style, str_repeat(' ', $width).PHP_EOL); 123 echo_style($style, str_repeat(' ', $width));
125 echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); 124 echo PHP_EOL;
126 echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); 125 echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
127 echo_style($style, str_repeat(' ', $width).PHP_EOL); 126 echo PHP_EOL;
127 echo_style($style, $message);
128 echo PHP_EOL;
129 echo_style($style, str_repeat(' ', $width));
130 echo PHP_EOL;
128} 131}
129 132
130function has_color_support() 133function has_color_support()
diff --git a/install.sh b/install.sh
index 414f73f2..a486e8a5 100755
--- a/install.sh
+++ b/install.sh
@@ -1,15 +1,8 @@
1#! /usr/bin/env bash 1#! /usr/bin/env bash
2 2
3if [[ $ASSETS == 'nobuild' ]]; then 3if [[ $ASSETS == 'build' ]]; then
4 composer install --no-interaction --no-progress --prefer-dist -o
5else
6
7 echo "Installing PHP dependencies through Composer..." 4 echo "Installing PHP dependencies through Composer..."
8 if [[ $ASSETS == 'build' ]]; then 5 composer install --no-interaction --no-progress --prefer-dist -o
9 composer install --no-interaction --no-progress --prefer-dist -o
10 else
11 SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
12 fi
13 6
14 chmod ugo+x vendor/mouf/nodejs-installer/bin/local/npm 7 chmod ugo+x vendor/mouf/nodejs-installer/bin/local/npm
15 echo "Downloading javascript librairies through npm..." 8 echo "Downloading javascript librairies through npm..."
@@ -20,10 +13,6 @@ else
20 13
21 echo "Concat, minify and installing assets..." 14 echo "Concat, minify and installing assets..."
22 node_modules/grunt/bin/grunt 15 node_modules/grunt/bin/grunt
23 16else
24 if [[ $ASSETS != 'build' ]]; then 17 composer install --no-interaction --no-progress --prefer-dist -o
25 echo "Installing wallabag..."
26 php bin/console wallabag:install --env=prod
27 fi
28
29fi 18fi
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 798cfdae..a6f905b1 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -255,11 +255,11 @@ class PocketImport extends AbstractImport
255 // flush every 20 entries 255 // flush every 20 entries
256 if (($i % 20) === 0) { 256 if (($i % 20) === 0) {
257 $this->em->flush(); 257 $this->em->flush();
258 $this->em->clear($entry);
259 } 258 }
260 ++$i; 259 ++$i;
261 } 260 }
262 261
263 $this->em->flush(); 262 $this->em->flush();
263 $this->em->clear();
264 } 264 }
265} 265}
diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
index 37b160c5..c7cfe15d 100644
--- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
+++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
@@ -169,11 +169,11 @@ class ReadabilityImport extends AbstractImport
169 // flush every 20 entries 169 // flush every 20 entries
170 if (($i % 20) === 0) { 170 if (($i % 20) === 0) {
171 $this->em->flush(); 171 $this->em->flush();
172 $this->em->clear($entry);
173 } 172 }
174 ++$i; 173 ++$i;
175 } 174 }
176 175
177 $this->em->flush(); 176 $this->em->flush();
177 $this->em->clear();
178 } 178 }
179} 179}
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php
index a1cc085b..581ec178 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagImport.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php
@@ -172,12 +172,12 @@ abstract class WallabagImport extends AbstractImport
172 // flush every 20 entries 172 // flush every 20 entries
173 if (($i % 20) === 0) { 173 if (($i % 20) === 0) {
174 $this->em->flush(); 174 $this->em->flush();
175 $this->em->clear($entry);
176 } 175 }
177 ++$i; 176 ++$i;
178 } 177 }
179 178
180 $this->em->flush(); 179 $this->em->flush();
180 $this->em->clear();
181 } 181 }
182 182
183 /** 183 /**
diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php
index 0a5de546..f3e8ca8e 100644
--- a/var/SymfonyRequirements.php
+++ b/var/SymfonyRequirements.php
@@ -168,6 +168,9 @@ class PhpIniRequirement extends Requirement
168 */ 168 */
169class RequirementCollection implements IteratorAggregate 169class RequirementCollection implements IteratorAggregate
170{ 170{
171 /**
172 * @var Requirement[]
173 */
171 private $requirements = array(); 174 private $requirements = array();
172 175
173 /** 176 /**
@@ -265,7 +268,7 @@ class RequirementCollection implements IteratorAggregate
265 /** 268 /**
266 * Returns both requirements and recommendations. 269 * Returns both requirements and recommendations.
267 * 270 *
268 * @return array Array of Requirement instances 271 * @return Requirement[]
269 */ 272 */
270 public function all() 273 public function all()
271 { 274 {
@@ -275,7 +278,7 @@ class RequirementCollection implements IteratorAggregate
275 /** 278 /**
276 * Returns all mandatory requirements. 279 * Returns all mandatory requirements.
277 * 280 *
278 * @return array Array of Requirement instances 281 * @return Requirement[]
279 */ 282 */
280 public function getRequirements() 283 public function getRequirements()
281 { 284 {
@@ -292,7 +295,7 @@ class RequirementCollection implements IteratorAggregate
292 /** 295 /**
293 * Returns the mandatory requirements that were not met. 296 * Returns the mandatory requirements that were not met.
294 * 297 *
295 * @return array Array of Requirement instances 298 * @return Requirement[]
296 */ 299 */
297 public function getFailedRequirements() 300 public function getFailedRequirements()
298 { 301 {
@@ -309,7 +312,7 @@ class RequirementCollection implements IteratorAggregate
309 /** 312 /**
310 * Returns all optional recommendations. 313 * Returns all optional recommendations.
311 * 314 *
312 * @return array Array of Requirement instances 315 * @return Requirement[]
313 */ 316 */
314 public function getRecommendations() 317 public function getRecommendations()
315 { 318 {
@@ -326,7 +329,7 @@ class RequirementCollection implements IteratorAggregate
326 /** 329 /**
327 * Returns the recommendations that were not met. 330 * Returns the recommendations that were not met.
328 * 331 *
329 * @return array Array of Requirement instances 332 * @return Requirement[]
330 */ 333 */
331 public function getFailedRecommendations() 334 public function getFailedRecommendations()
332 { 335 {
@@ -376,7 +379,8 @@ class RequirementCollection implements IteratorAggregate
376 */ 379 */
377class SymfonyRequirements extends RequirementCollection 380class SymfonyRequirements extends RequirementCollection
378{ 381{
379 const REQUIRED_PHP_VERSION = '5.3.3'; 382 const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
383 const REQUIRED_PHP_VERSION = '5.5.9';
380 384
381 /** 385 /**
382 * Constructor that initializes the requirements. 386 * Constructor that initializes the requirements.
@@ -386,16 +390,26 @@ class SymfonyRequirements extends RequirementCollection
386 /* mandatory requirements follow */ 390 /* mandatory requirements follow */
387 391
388 $installedPhpVersion = phpversion(); 392 $installedPhpVersion = phpversion();
393 $requiredPhpVersion = $this->getPhpRequiredVersion();
389 394
390 $this->addRequirement( 395 $this->addRecommendation(
391 version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), 396 $requiredPhpVersion,
392 sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), 397 'Vendors should be installed in order to check all requirements.',
393 sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run. 398 'Run the <code>composer install</code> command.',
394 Before using Symfony, upgrade your PHP installation, preferably to the latest version.', 399 'Run the "composer install" command.'
395 $installedPhpVersion, self::REQUIRED_PHP_VERSION),
396 sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
397 ); 400 );
398 401
402 if (false !== $requiredPhpVersion) {
403 $this->addRequirement(
404 version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
405 sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
406 sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
407 Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
408 $installedPhpVersion, $requiredPhpVersion),
409 sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
410 );
411 }
412
399 $this->addRequirement( 413 $this->addRequirement(
400 version_compare($installedPhpVersion, '5.3.16', '!='), 414 version_compare($installedPhpVersion, '5.3.16', '!='),
401 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', 415 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@@ -433,7 +447,7 @@ class SymfonyRequirements extends RequirementCollection
433 ); 447 );
434 } 448 }
435 449
436 if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { 450 if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
437 $timezones = array(); 451 $timezones = array();
438 foreach (DateTimeZone::listAbbreviations() as $abbreviations) { 452 foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
439 foreach ($abbreviations as $abbreviation) { 453 foreach ($abbreviations as $abbreviation) {
@@ -689,7 +703,7 @@ class SymfonyRequirements extends RequirementCollection
689 $this->addRecommendation( 703 $this->addRecommendation(
690 \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), 704 \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
691 sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), 705 sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
692 'To avoid internationalization data incosistencies upgrade the symfony/intl component.' 706 'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
693 ); 707 );
694 } 708 }
695 } 709 }
@@ -725,9 +739,9 @@ class SymfonyRequirements extends RequirementCollection
725 739
726 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { 740 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
727 $this->addRecommendation( 741 $this->addRecommendation(
728 $this->getRealpathCacheSize() > 1000, 742 $this->getRealpathCacheSize() > 5 * 1024 * 1024,
729 'realpath_cache_size should be above 1024 in php.ini', 743 'realpath_cache_size should be above 5242880 in php.ini',
730 'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.' 744 'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5000k</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
731 ); 745 );
732 } 746 }
733 747
@@ -778,4 +792,28 @@ class SymfonyRequirements extends RequirementCollection
778 return (int) $size; 792 return (int) $size;
779 } 793 }
780 } 794 }
795
796 /**
797 * Defines PHP required version from Symfony version.
798 *
799 * @return string|false The PHP required version or false if it could not be guessed
800 */
801 protected function getPhpRequiredVersion()
802 {
803 if (!file_exists($path = __DIR__.'/../composer.lock')) {
804 return false;
805 }
806
807 $composerLock = json_decode(file_get_contents($path), true);
808 foreach ($composerLock['packages'] as $package) {
809 $name = $package['name'];
810 if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
811 continue;
812 }
813
814 return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
815 }
816
817 return false;
818 }
781} 819}