Commit 3fd0d8bd authored by MikeyMJCO's avatar MikeyMJCO

Fix tests and 4.1.x deprecations

parent 3d6e7b3e
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -20,8 +20,7 @@ class AppKernel extends Kernel {
if (in_array($this->getEnvironment(), ['dev', 'test'], TRUE)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle();
}
if ('dev' === $this->getEnvironment()) {
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -25,7 +25,7 @@ server {
}
location ~ ^/app_dev\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
......@@ -61,15 +61,3 @@ server {
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = v2018.docs.civicrm.dev.mjco.uk) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name v2018.docs.civicrm.dev.mjco.uk;
listen 80;
return 404; # managed by Certbot
}
server {
server_name localhost;
listen *:8080;
root /var/www/web;
# For a development configuration, change "app" to "app_dev" everywhere
# below. Then you'll see the Symfony web debug toolbar when viewing pages.
# Requests for static book files
# - Book slug can't begin with underscore
# - Book slug can't be "admin"
# - Must begin with three distinct path pieces, separated by forward slashes
location ~ ^/(?!_)(?!admin/)[^/]+/[^/]+/[^/]+ {
# - Use a trailing slash for the $uri to treat paths like directories
# - Then, try to find directories that match our request.
# - If we can't find anything, we send the request to the app and let
# it deal with the rest.
try_files $uri/ $uri /app_dev.php$is_args$args;
}
# requests for Symfony app functionality
location / {
# - Don't use a trailing slash for $uri here. This line is straight from
# the Symfony recommended nginx settings
try_files $uri /app_dev.php$is_args$args;
}
location ~ ^/app_dev\.php(/|$) {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
#error_log /var/log/nginx/civicrm-docs-error.log;
#access_log /var/log/nginx/civicrm-docs-access.log;
}
......@@ -23,7 +23,7 @@ framework:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
#trusted_proxies: ~ # Deprecated v3.3
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
......@@ -66,3 +66,8 @@ swiftmailer:
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
# Sensio Framework Configuration
sensio_framework_extra:
router:
annotations: false
......@@ -17,10 +17,10 @@ monolog:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [!event]
channels: ["!event"]
console:
type: console
channels: [!event, !doctrine]
channels: ["!event", "!doctrine"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
# Learn more about services, parameters and containers at
# http://symfony.com/doc/current/book/service_container.html
parameters:
books_dir: %kernel.root_dir%/../books
books_dir: "%kernel.root_dir%/../books"
services:
_defaults:
autowire: true
autoconfigure: true
library:
class: AppBundle\Model\Library
arguments:
- %books_dir%
- "%books_dir%"
public: true
webhook.processor:
class: AppBundle\Utils\WebhookProcessor
......@@ -16,12 +20,15 @@ services:
-
- '@github.webhook_handler'
- '@gitlab.webbook_handler'
public: true
github.webhook_handler:
class: AppBundle\Utils\WebhookAdapters\GithubHandler
public: true
gitlab.webbook_handler:
class: AppBundle\Utils\WebhookAdapters\GitlabHandler
public: true
mkdocs:
class: AppBundle\Utils\MkDocs
......@@ -38,6 +45,7 @@ services:
- '@mkdocs'
- '@git'
- '@paths'
public: true
filesystem:
class: AppBundle\Utils\FileSystem
......@@ -45,8 +53,8 @@ services:
paths:
class: AppBundle\Utils\Paths
arguments:
- '%kernel.root_dir%'
- '%kernel.cache_dir%'
- "%kernel.root_dir%"
- "%kernel.cache_dir%"
git:
class: AppBundle\Utils\GitTools
......@@ -66,7 +74,7 @@ services:
streamhandler:
class: Monolog\Handler\StreamHandler
arguments:
- %kernel.logs_dir%/publish.log
- "%kernel.logs_dir%/publish.log"
app.exception_listener:
class: AppBundle\EventListener\ExceptionListener
......
#!/bin/bash
find web/static var -exec setfacl -m u:www-data:rwx {} \;
find web/static var -exec setfacl -m u:docs:rwx {} \;
find web/static var -exec setfacl -x u:co {} \;
find web/static var -exec setfacl -m u:mjco:rwx {} \;
#find web/static var -exec setfacl -x u:co {} \;
find web/static var -type d -exec setfacl -m d:u:www-data:rwx {} \;
find web/static var -type d -exec setfacl -m d:u:docs:rwx {} \;
find web/static var -type d -exec setfacl -x d:u:co {} \;
\ No newline at end of file
find web/static var -type d -exec setfacl -m d:u:mjco:rwx {} \;
#find web/static var -type d -exec setfacl -x d:u:co {} \;
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -6,17 +6,17 @@ langs:
en:
repo: 'https://github.com/civicrm/civicrm-user-guide'
versions:
5: # This is stored as $slug
name: 5 / Latest # If omitted, use $slug
"5": # This is stored as $slug
name: "5 / Latest" # If omitted, use $slug
path: latest # If omitted, use a URL-safe version of $slug
branch: master # If omitted, use $slug
redirects: # These are not displayed anywhere
- current
- stable
- 4.7
4.6:
branch: 4.6
name: 4.6 / Long Term Support
- "4.7"
"4.6":
branch: "4.6"
name: "4.6 / Long Term Support"
redirects:
- lts
ca:
......
File mode changed from 100644 to 100755
......@@ -18,39 +18,28 @@
},
"require": {
"php": "^7.0",
"symfony/symfony": "^3.0",
"symfony/symfony": "^4.1",
"doctrine/orm": "^2.5",
"twig/twig": "^1.33",
"twig/twig": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/swiftmailer-bundle": "^3.2",
"symfony/monolog-bundle": "^3.3",
"sensio/framework-extra-bundle": "^5.2",
"incenteev/composer-parameter-handler": "^2.0",
"symfony/web-server-bundle": "^3.3"
"phpunit/phpunit": "^7.4"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0",
"phpunit/phpunit": "^5.7"
"symfony/maker-bundle": "^1.7",
"symfony/phpunit-bridge": "^4.1",
"symfony/web-server-bundle": "^4.1"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
]
},
"extra": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,10 +10,11 @@
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
<env name="KERNEL_CLASS" value="AppKernel" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<testsuite name="CiviCRM Docs Publisher Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -7,7 +7,7 @@ use AppBundle\Utils\Publisher;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
use AppBundle\Model\Library;
......@@ -115,8 +115,7 @@ class PublishController extends Controller {
'commits' => $commits,
];
$body = $this->renderView('AppBundle:Emails:notify.html.twig', $renderParams);
$mail = \Swift_Message::newInstance()
->setSubject($subject)
$mail = (new \Swift_Message($subject))
->setFrom('no-reply@civicrm.org', "CiviCRM docs")
->setTo($recipients)
->setBody($body, 'text/html');
......
......@@ -3,7 +3,7 @@
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
class ReadController extends Controller {
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -4,7 +4,7 @@ namespace AppBundle\Model;
use AppBundle\Utils\LocaleTools;
class Language {
class Language implements \Countable {
/**
* @var string
......@@ -33,6 +33,14 @@ class Language {
*/
public $watchers = array();
/**
* Implement a count() method.
*/
public function count() {
if (is_array($this->versions)) {
return count($this->versions);
}
}
/**
* Initialize a language with values in it.
*
......@@ -71,7 +79,7 @@ class Language {
}
// If no versions were defined, then add one version (with default values)
if (count($this->versions) == 0) {
if (empty($this->versions)) {
$this->versions[] = new Version('latest', 'Latest', 'latest', 'master', ['stable', 'current']);
}
}
......@@ -173,7 +181,7 @@ class Language {
* @return bool
*/
public function isMultiVersion() {
return count($this->versions) > 1;
return $this->count() > 1;
}
/**
......@@ -182,7 +190,7 @@ class Language {
* @return integer
*/
public function countVersions() {
return count($this->versions);
return $this->count();
}
/**
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -2,7 +2,7 @@
namespace AppBundle\Model;
class LibraryTest extends \PHPUnit_Framework_TestCase {
class LibraryTest extends \PHPUnit\Framework\TestCase {
/**
* @param string $identifier
......
......@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils;
use AppBundle\Utils\LocaleTools;
class LocaleToolsTest extends \PHPUnit_Framework_TestCase {
class LocaleToolsTest extends \PHPUnit\Framework\TestCase {
/**
* @param string $languageCode
......
......@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils;
use AppBundle\Utils\StringTools;
class StringToolsTest extends \PHPUnit_Framework_TestCase
class StringToolsTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string $string
......
......@@ -7,7 +7,7 @@ use AppBundle\Utils\WebhookAdapters\GitlabHandler;
use AppBundle\Utils\WebhookProcessor;
use Symfony\Component\HttpFoundation\Request;
class WebhookProcessorTest extends \PHPUnit_Framework_TestCase {
class WebhookProcessorTest extends \PHPUnit\Framework\TestCase {
/**
* @param string $source
......
......@@ -389,7 +389,7 @@ class SymfonyRequirements extends RequirementCollection
{
/* mandatory requirements follow */
$installedPhpVersion = phpversion();
$installedPhpVersion = PHP_VERSION;
$requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRecommendation(
......@@ -448,15 +448,8 @@ class SymfonyRequirements extends RequirementCollection
}
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
}
}
$this->addRequirement(
isset($timezones[@date_default_timezone_get()]),
in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
......@@ -731,7 +724,7 @@ class SymfonyRequirements extends RequirementCollection
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$this->addRecommendation(
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be at least 5M in php.ini',
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -19,8 +19,6 @@ $apcLoader->register(true);
*/
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
......
......@@ -10,13 +10,13 @@ use Symfony\Component\Debug\Debug;
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '172.17.0.1']) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
#if (isset($_SERVER['HTTP_CLIENT_IP'])
# || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
# || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1', '172.17.0.1']) || php_sapi_name() === 'cli-server')
#) {
# header('HTTP/1.0 403 Forbidden');
# exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
#}
/**
* @var Composer\Autoload\ClassLoader $loader
......@@ -25,7 +25,6 @@ $loader = require __DIR__.'/../app/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
......
......@@ -2,4 +2,4 @@
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
User-agent: *
Disallow:
Disallow: *
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment