Commit 7d391ea7 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch 'develop' into '63-activate-realurl'

# Conflicts:
#   html/typo3conf/ext/t3omy/Configuration/TypoScript/main.txt
parents 15e53261 f7199de2
Pipeline #5436 passed with stages
in 3 minutes and 44 seconds
APIVersion: v0.19.0
APIVersion: v1.2.0
name: my.typo3.org
type: typo3
docroot: html
php_version: "7.0"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
provider: default
hooks:
post-start:
- exec: sudo apt-get update
- exec: sudo apt-get install php7.0-ldap -y
- exec: cp typo3conf/AdditionalConfiguration.ddev.php typo3conf/AdditionalConfiguration.php
- exec: composer install -d /var/www/html
- exec: npm --prefix typo3conf/ext/t3olayout/Build install
- exec: npm --prefix typo3conf/ext/t3olayout/Build run-script build
- exec: ../bin/typo3cms install:generatepackagestates
- exec: ../bin/typo3cms install:extensionsetupifpossible
- exec: ../vendor/bin/typo3cms install:generatepackagestates
- exec: ../vendor/bin/typo3cms install:extensionsetupifpossible
# This config.yaml was created with ddev version v1.2.0
# webimage: drud/ddev-webserver:v1.2.0
# dbimage: drud/ddev-dbserver:v1.2.0
# dbaimage: drud/phpmyadmin:v1.2.0
# However we do not recommend explicitly wiring these images into the
# config.yaml as they may break future versions of ddev.
# You can update this config.yaml using 'ddev config'.
# Key features of ddev's config.yaml:
# name: <projectname> # Name of the project, automatically provides
# http://projectname.ddev.local and https://projectname.ddev.local
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "7.1" # PHP version to use, "5.6", "7.0", "7.1", "7.2"
# You can explicitly specify the webimage, dbimage, dbaimage lines but this
# is not recommended, as the images are often closely tied to ddev's' behavior,
# so this can break upgrades.
# webimage: <docker_image> # nginx/php docker image.
# dbimage: <docker_image> # mariadb docker image.
# dbaimage: <docker_image>
# router_http_port: <port> # Port to be used for http (defaults to port 80)
# router_https_port: <port> # Port for https (defaults to 443)
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
# webserver_type: nginx-fpm # Can be set to apache-fpm or apache-cgi as well
# additional_hostnames:
# - somename
# - someothername
# would provide http and https URLs for "somename.ddev.local"
# and "someothername.ddev.local".
# additional_fqdns:
# - example.com
# - sub1.example.com
# would provide http and https URLs for "example.com" and "sub1.example.com"
# Please take care with this because it can cause great confusion.
# upload_dir: custom/upload/dir
# would set the destination path for ddev import-files to custom/upload/dir.
# provider: default # Currently either "default" or "pantheon"
#
# Many ddev commands can be extended to run tasks after the ddev command is
# executed.
# See https://ddev.readthedocs.io/en/latest/users/extending-commands/ for more
# information on the commands that can be extended and the tasks you can define
# for them. Example:
#hooks:
# post-start:
# - exec: composer install -d /var/www/html
\ No newline at end of file
version: '3'
version: '3.6'
services:
web:
environment:
- TYPO3_CONTEXT=Development
\ No newline at end of file
- TYPO3_CONTEXT=Development
version: '3'
version: '3.6'
#ddev-generated
services:
db:
......@@ -6,9 +6,17 @@ services:
image: $DDEV_DBIMAGE
stop_grace_period: 60s
volumes:
- "${DDEV_IMPORTDIR}:/db"
- "${DDEV_DATADIR}:/var/lib/mysql"
- ".:/mnt/ddev_config"
- type: "volume"
source: mariadb-database
target: "/var/lib/mysql"
volume:
nocopy: true
- type: "bind"
source: "${DDEV_IMPORTDIR}"
target: "/db"
- type: "bind"
source: "."
target: "/mnt/ddev_config"
restart: "no"
user: "$DDEV_UID:$DDEV_GID"
ports:
......@@ -22,13 +30,13 @@ services:
environment:
- COLUMNS=$COLUMNS
- LINES=$LINES
command: "$DDEV_MARIADB_LOCAL_COMMAND"
web:
container_name: ddev-${DDEV_SITENAME}-web
image: $DDEV_WEBIMAGE
volumes:
- "../:/var/www/html:cached"
- ".:/mnt/ddev_config"
- ".:/mnt/ddev_config:ro"
restart: "no"
user: "$DDEV_UID:$DDEV_GID"
depends_on:
......@@ -44,6 +52,7 @@ services:
- DDEV_URL=$DDEV_URL
- DOCROOT=$DDEV_DOCROOT
- DDEV_PHP_VERSION=$DDEV_PHP_VERSION
- DDEV_WEBSERVER_TYPE=$DDEV_WEBSERVER_TYPE
- DDEV_PROJECT_TYPE=$DDEV_PROJECT_TYPE
- DDEV_ROUTER_HTTP_PORT=$DDEV_ROUTER_HTTP_PORT
- DDEV_ROUTER_HTTPS_PORT=$DDEV_ROUTER_HTTPS_PORT
......@@ -91,3 +100,7 @@ networks:
default:
external:
name: ddev_default
volumes:
mariadb-database:
name: "${DDEV_SITENAME}-mariadb"
......@@ -6,6 +6,7 @@ html/typo3
html/fileadmin/
html/typo3conf/ext/*
!html/typo3conf/ext/t3omy/
!html/typo3conf/ext/t3o_slack/
html/typo3conf/AdditionalConfiguration.php
html/typo3conf/deprecation_*
html/typo3conf/ENABLE_INSTALL_TOOL
......@@ -15,3 +16,6 @@ html/typo3temp/
html/uploads/
/auth.json
/html/typo3conf/realurl_autoconf.php
.php_cs.cache
.ddev/db_snapshots
.data
......@@ -7,10 +7,21 @@ before_script:
stages:
- dump
- test
- build
- layout
- deploy
test:php:
stage: test
image: ekreative/php-cs-fixer:2
variables:
GIT_STRATEGY: "clone"
script:
- php-cs-fixer fix --dry-run --config=.gitlab-ci/build/.php_cs --diff
except:
- assets
build:
stage: build
image: php:7.0-alpine
......@@ -36,7 +47,7 @@ build:
layout:
stage: layout
image: node:7
image: node:8
before_script:
- cd html/typo3conf/ext/t3olayout/Build
script:
......
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This file represents the configuration for Code Sniffing PSR-2-related
* automatic checks of coding guidelines
* Install @fabpot's great php-cs-fixer tool via
*
* $ composer global require friendsofphp/php-cs-fixer
*
* And then simply run
*
* $ php-cs-fixer fix --config ../Build/.php_cs
*
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
*
* For more information read:
* https://www.php-fig.org/psr/psr-2/
* https://cs.sensiolabs.org
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Define in which folders to search and which folders to exclude
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('typo3temp')
->in(__DIR__ . '/../../');
// Return a Code Sniffing configuration using
// all sniffers needed for PSR-2
// and additionally:
// - Remove leading slashes in use clauses.
// - PHP single-line arrays should not have trailing comma.
// - Single-line whitespace before closing semicolon are prohibited.
// - Remove unused use statements in the PHP source code
// - Ensure Concatenation to have at least one whitespace around
// - Remove trailing whitespace at the end of blank lines.
return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'concat_space' => ['spacing' => 'one'],
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'single_quote' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'no_blank_lines_after_phpdoc' => true,
'array_syntax' => ['syntax' => 'short'],
'whitespace_after_comma_in_array' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'no_alias_functions' => true,
'lowercase_cast' => true,
'no_leading_namespace_whitespace' => true,
'native_function_casing' => true,
'no_short_bool_cast' => true,
'no_unneeded_control_parentheses' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_trim' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'cast_spaces' => ['space' => 'none'],
'declare_equal_normalize' => ['space' => 'single'],
'dir_constant' => true,
])->setFinder($finder);
......@@ -5,7 +5,6 @@ namespace Deployer;
require_once '/composer/vendor/deployer/deployer/recipe/common.php';
require_once '/composer/vendor/deployer/recipes/rsync.php';
$sharedDirectories = [
'html/fileadmin',
'html/uploads',
......@@ -54,14 +53,15 @@ set('rsync_src', './');
set('keep_releases', 10);
serverList('./.gitlab-ci/deployer/servers.yml');
set('php', '/opt/php/php70/bin/php');
set('typo3_console', 'vendor/bin/typo3cms');
task('typo3', function () {
run('cd {{release_path}} && {{php}} bin/typo3cms install:generatepackagestates');
run('cd {{release_path}} && {{php}} bin/typo3cms install:extensionsetupifpossible');
run('cd {{release_path}} && {{php}} {{typo3_console}} install:generatepackagestates');
run('cd {{release_path}} && {{php}} {{typo3_console}} install:extensionsetupifpossible');
});
task('cache', function () {
run('cd {{release_path}} && {{php}} bin/cachetool opcache:reset');
run('cd {{release_path}} && {{php}} vendor/bin/cachetool opcache:reset');
});
task('deploy', [
......
......@@ -8,18 +8,10 @@
}
],
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org"
},
{
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/t3olayout.git"
},
{
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/t3o_slack.git"
},
{
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/t3o_ldap.git"
......@@ -28,39 +20,40 @@
"type": "vcs",
"url": "https://git-t3o.typo3.org/t3o/gitlab_api.git"
}
],
"support": {
"email": "maintenance@typo3.org",
"issues": "https://git-t3o.typo3.org/t3o/my/issues"
},
"require": {
"typo3/cms": "^8.7",
"helhum/typo3-console": "^5.0",
"dmitryd/typo3-realurl": "^2.1",
"t3o/t3o_slack": " ^1.1",
"t3o/t3olayout": "^3.0",
"t3o/t3o_ldap": "^1.0",
"typo3-ter/femanager": "^4.0",
"in2code/femanager": "^4.0",
"in2code/userprofile": "^0.2",
"sjbr/static-info-tables": "^6.5",
"t3o/gitlab_api": "^1.0",
"gordalina/cachetool": "^3.2"
},
"config": {
"bin-dir": "bin"
"platform": {
"php": "7.0.30"
}
},
"extra": {
"typo3/cms": {
"web-dir": "html",
"cms-package-dir": "{$vendor-dir}/typo3/cms"
},
"helhum/typo3-console": {
"install-binary": true,
"install-extension-dummy": false
}
},
"autoload": {
"psr-4": {
"T3o\\T3olayout\\": "html/typo3conf/ext/t3olayout/Classes",
"T3o\\T3omy\\": "html/typo3conf/ext/t3omy/Classes",
"T3o\\Userprofile\\": "html/typo3conf/ext/userprofile/Classes"
"T3o\\Userprofile\\": "html/typo3conf/ext/userprofile/Classes",
"T3o\\T3oSlack\\": "html/typo3conf/ext/t3o_slack/Classes"
}
}
}
This diff is collapsed.
#ddev-generated: Automatically generated ddev .gitignore.
/AdditionalConfiguration.php
/ddev_drush_settings.php
......@@ -2,7 +2,6 @@
/** #ddev-generated: Automatically generated TYPO3 AdditionalConfiguration.php file.
ddev manages this file and may delete or overwrite the file unless this comment is removed.
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'], [
......@@ -23,4 +22,4 @@ $GLOBALS['TYPO3_CONF_VARS']['MAIL'] = [
];
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '$P$CZqeoYBTHC0kXKny4tpTvBSzzV5wVY0'; /* joh316 */
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'normal';
\ No newline at end of file
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'normal';
......@@ -4,7 +4,7 @@ return [
'debug' => true,
'explicitADmode' => 'explicitAllow',
'installToolPassword' => '$pbkdf2-sha256$25000$oRS5QrY6LY0VQWgAxx5hcQ$mM7JqvMgnEfY1FtIW6Ngcj7mJqUNto4kBNJmRv0gUFk',
'loginSecurityLevel' => 'rsa',
'loginSecurityLevel' => 'normal',
],
'DB' => [
'Connections' => [
......@@ -53,7 +53,7 @@ return [
],
'FE' => [
'debug' => true,
'loginSecurityLevel' => 'rsa',
'loginSecurityLevel' => 'normal',
],
'GFX' => [
'jpg_quality' => '80',
......
#
# Global Git ignore file
# inspired by the TYPO3 Project
#
# ignoring temporary/backup files (left by e.g. vim)
# ignoring common IDE's config directories/files
# ignoring thumbnail db files
#
# for local exclude patterns please edit .git/info/exclude
#
*~
*.bak
*.idea
*.project
Thumbs.db
desktop.ini
<?php
namespace T3o\T3oSlack\Command;
use T3o\T3oSlack\Domain\Model\SlackUser;
use T3o\T3oSlack\Domain\Service\SlackApi;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
/***************************************************************
* Copyright notice
*
* (c) 2017
* All rights reserved
*
* @author Stefan Busemann <stefan@in2code.de>
* @package TYPO3
* @subpackage t3o_slack
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class SlackImportCommandController extends CommandController
{
/**
* @var \T3o\T3oSlack\Domain\Repository\SlackUserRepository
* @inject
*/
protected $slackUserRepository;
/**
* @var array
*/
protected $settings;
/**
* @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
* @inject
*/
protected $configurationManager;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
* @inject
*/
protected $persistenceManager;
/**
* Import all Slack Users
*
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
public function importCommand()
{
$this->getTSConfiguration();
$slackApi = GeneralUtility::makeInstance(SlackApi::class);
$cursor = '';
$limiter = 0;
$counter = 0;
do {
$response = $slackApi->getUsers($cursor);
if (!$response['ok']) {
throw new \RuntimeException('Slack API error . Reason: ' . $response['error']);
}
foreach ($response['members'] as $member) {
if ($member['is_bot'] === false) {
$existingSlackUser = $this->slackUserRepository->findOneBySlackId($member['id']);
if ($existingSlackUser) {
$slackUser = $existingSlackUser;
} else {
$slackUser = GeneralUtility::makeInstance(SlackUser::class);
}
$slackUser->setEmail($member['profile']['email']);
$slackUser->setRealName($member['real_name']);
$slackUser->setSlackId($member['id']);
$slackUser->setSlackUserName($member['name']);
$counter++;
if ($existingSlackUser) {
$this->slackUserRepository->update($slackUser);
} else {
$this->slackUserRepository->add($slackUser);
}
}
}
if ($response['response_metadata']['next_cursor']) {
$cursor = $response['response_metadata']['next_cursor'];
} else {
$cursor = '';
}
$this->persistenceManager->persistAll();
$limiter++;
if ($limiter > 999) {
// break loop, if we have more then 999 loops
throw new \RuntimeException('Slack import stopped, due to many loops.');
}
} while ($cursor);
$GLOBALS['BE_USER']->simplelog(
'Import of Slack User sucessful - imported ' . $counter . ' users',
't3o_slack'
);
}
protected function getTSConfiguration()
{
// load complete ts
$this->settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
// remove dots from configuration
$typoscriptService = GeneralUtility::makeInstance(TypoScriptService::class);
$this->settings = $typoscriptService->convertTypoScriptArrayToPlainArray($this->settings);
$this->settings = $this->settings['plugin']['tx_t3oslack'];
}
}
<?php
namespace T3o\T3oSlack\Controller;
use In2code\Femanager\Domain\Model\User;
use In2code\Femanager\Domain\Repository\UserRepository;
use In2code\Femanager\Domain\Service\SendMailService;
use In2code\Femanager\Utility\HashUtility;
use In2code\Femanager\Utility\StringUtility;
use T3o\T3oSlack\Domain\Model\SlackUser;
use T3o\T3oSlack\Domain\Service\SlackApi;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
class SlackUserController extends ActionController
{
/**
* @var \T3o\T3oSlack\Domain\Repository\SlackUserRepository
* @inject
*/
public $slackUserRepository;
/**
* @var \T3o\T3oSlack\Domain\Repository\SlackFrontendUserRepository
* @inject
*/
public $slackFrontendUserRepository;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
* @inject
*/
protected $persistenceManager;
/**
* action new
*
* @param \T3o\T3oSlack\Domain\Model\SlackUser $newSlackUser