Commit 94555003 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'develop' into '257-add-transfer-user-to-ldap-button-in-fe_user-list'

# Conflicts:
#   extensions/t3omy/ext_localconf.php
parents f36874bc 5571bc95
Pipeline #6266 passed with stages
in 7 minutes and 43 seconds
APIVersion: v1.5.1
APIVersion: v1.5.2
name: my.typo3.org
type: typo3
docroot: public
......@@ -24,11 +24,11 @@ hooks:
- exec: vendor/bin/typo3cms install:extensionsetupifpossible
# This config.yaml was created with ddev version v1.5.1
# webimage: drud/ddev-webserver:v1.5.1
# dbimage: drud/ddev-dbserver:v1.5.0-10.2
# dbaimage: drud/phpmyadmin:v1.5.0
# bgsyncimage: drud/ddev-bgsync:v1.5.0
# This config.yaml was created with ddev version v1.5.2
# webimage: drud/ddev-webserver:v1.5.2
# dbimage: drud/ddev-dbserver:v1.5.2-10.2
# dbaimage: drud/phpmyadmin:v1.5.2
# bgsyncimage: drud/ddev-bgsync:v1.5.2
# 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'.
......
File added
include: 'https://git-t3o.typo3.org/t3o/t3olayout/raw/master/Configuration/GitLab/t3o-builds.yml'
include:
- project: 't3o/t3olayout'
ref: master
file: '/Configuration/GitLab/t3o-builds.yml'
variables:
GIT_STRATEGY: "none"
GIT_SSL_NO_VERIFY: "true"
STAGE_PORT: 22200
STAGE_HOST: "my-stage-v9.typo3.org"
PRODUCTION_PORT: 22193
PRODUCTION_HOST: "my.typo3.org"
PRODUCTION_PORT: 22201
PRODUCTION_HOST: "my-v9.typo3.org"
DUMP_USER: "mystage"
DUMP_EXCLUDE_TABLES_LIST: "be_groups,be_sessions,be_users,cf_cache_hash,cf_cache_hash_tags,cf_cache_imagesizes,cf_cache_imagesizes_tags,cf_cache_news_category,cf_cache_news_category_tags,cf_cache_pages,cf_cache_pages_tags,cf_cache_pagesection,cf_cache_pagesection_tags,cf_cache_rootline,cf_cache_rootline_tags,cf_extbase_datamapfactory_datamap,cf_extbase_datamapfactory_datamap_tags,cf_extbase_object,cf_extbase_object_tags,cf_extbase_reflection,cf_extbase_reflection_tags,cf_tx_solr,cf_tx_solr_configuration,cf_tx_solr_configuration_tags,cf_tx_solr_tags,fe_groups,fe_sessions,fe_users,old_users,sys_domain,sys_log,tx_solr_cache,tx_solr_cache_tags,tx_t3oslack_domain_model_slackuser"
PHP_EXECUTABLE: "/opt/php/php70/bin/php"
PHP_EXECUTABLE: "/opt/php/php72/bin/php"
......@@ -2,8 +2,8 @@
namespace Deployer;
require_once '/composer/vendor/deployer/deployer/recipe/common.php';
require_once '/composer/vendor/deployer/recipes/rsync.php';
require_once '/tmp/vendor/deployer/deployer/recipe/common.php';
require_once '/tmp/vendor/deployer/recipes/recipe/rsync.php';
$sharedDirectories = [
'private/fileadmin',
......@@ -19,7 +19,7 @@ $sharedFiles = [
set('shared_files', $sharedFiles);
$writeableDirectories = [
'private/typo3temp',
'public/typo3temp'
];
set('writable_dirs', $writeableDirectories);
......@@ -27,6 +27,7 @@ $exclude = [
'.gitignore',
'.htaccess',
'.git',
'.ddev',
'Readme.rst',
'Readme.txt',
'Upgrading.rst',
......@@ -49,17 +50,17 @@ set('rsync', [
]);
set('rsync_src', './');
set('keep_releases', 10);
serverList('./.gitlab-ci/deployer/servers.yml');
inventory('./.gitlab-ci/deployer/servers.yml');
set('php', '/opt/php/php72/bin/php');
set('vendor_folder', 'vendor/bin/');
set('bin_folder', 'vendor/bin/');
task('typo3', function () {
run('cd {{release_path}} && {{php}} {{vendor_folder}}typo3cms install:generatepackagestates');
run('cd {{release_path}} && {{php}} {{vendor_folder}}typo3cms install:extensionsetupifpossible');
task('typo3', function() {
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:generatepackagestates');
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:extensionsetupifpossible');
});
task('cache', function () {
run('cd {{release_path}} && {{php}} {{vendor_folder}}cachetool opcache:reset');
run('cd {{release_path}} && {{php}} {{bin_folder}}cachetool opcache:reset');
});
task('deploy', [
......@@ -72,5 +73,5 @@ task('deploy', [
'typo3',
'deploy:symlink',
'cache',
'cleanup',
'cleanup'
]);
master:
stage: production
host: my.typo3.org
port: 22193
hostname: my-v9.typo3.org
port: 22201
user: my
writable_mode: chmod
forward_agent: true
deploy_path: ~/ci
develop:
stage: stage
host: my-stage-v9.typo3.org
hostname: my-stage-v9.typo3.org
port: 22200
user: mystage
writable_mode: chmod
......
This diff is collapsed.
<?php
namespace T3o\Karma\Controller;
use T3o\Karma\Domain\Repository\FrontendUserRepository;
use T3o\Karma\Domain\Repository\LedgerEntryRepository;
use T3o\Karma\Service\KarmaService;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* 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 AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* @var KarmaService
*/
protected $karmaService;
/**
* @var \T3o\Karma\Domain\Repository\FrontendUserRepository
*/
protected $frontendUserRepository;
/**
* @var LedgerEntryRepository
*/
protected $ledgerEntryRepository;
/**
* @param KarmaService $karmaService
*/
public function injectKarmaService(KarmaService $karmaService)
{
$this->karmaService = $karmaService;
}
/**
* @param \T3o\Karma\Domain\Repository\FrontendUserRepository $frontendUserRepository
*/
public function injectFrontendUserRepository(FrontendUserRepository $frontendUserRepository)
{
$this->frontendUserRepository = $frontendUserRepository;
}
/**
* @param LedgerEntryRepository $ledgerEntryRepository
*/
public function injectLedgerEntryRepository(LedgerEntryRepository $ledgerEntryRepository)
{
$this->ledgerEntryRepository = $ledgerEntryRepository;
}
/**
* @return array The source codes for karma
*/
public function getKarmaSourceCodes()
{
return array_keys($this->settings['sourceCodes']);
}
}
<?php
namespace T3o\Karma\Controller;
use T3o\Karma\Utility\UserProfileChangeKarmaIssuerUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* 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 ManagerController extends AbstractController
{
/**
* The test action
*/
public function testAction()
{
$frontendUser = $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']);
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var UserProfileChangeKarmaIssuerUtility $testUserProfileChangeKarmaIssuerSlot */
$testUserProfileChangeKarmaIssuerSlot = $objectManager->get(UserProfileChangeKarmaIssuerUtility::class);
$testUserProfileChangeKarmaIssuerSlot->newUserWasCreated($frontendUser);
}
}
<?php
namespace T3o\Karma\Controller;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* 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 UserDisplayController extends AbstractController
{
/**
* Lists karma ledger entries for the currently logged-in user
*/
public function listAction()
{
$entries = $this->ledgerEntryRepository->findByUser($GLOBALS['TSFE']->fe_user->user['uid']);
$this->view->assign('entries', $entries);
}
/*
* Shows a small karma earned widget for the currently logged-in user
*/
public function statusWidgetAction()
{
if ($GLOBALS['TSFE']->fe_user->user['uid']) {
$frontendUser = $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']);
$immutableValue = $this->karmaService->getImmutableKarmaForUser($frontendUser);
$mutableValue = $this->karmaService->getMutableKarmaForUser($frontendUser);
$sourceTotals = [];
foreach ($this->getKarmaSourceCodes() as $sourceCode) {
$sourceTotals[$sourceCode] = $this->karmaService->getImmutableKarmaSourceTotalForUser($sourceCode, $frontendUser);
}
$this->view->assign('immutableValue', $immutableValue);
$this->view->assign('mutableValue', $mutableValue);
$this->view->assign('hasKarma', ($immutableValue > 0 || $mutableValue > 0));
$this->view->assign('sourceTotals', $sourceTotals);
}
}
}
<?php
namespace T3o\Karma\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2018
* All rights reserved
*
* 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 FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
{
/**
* Cached immutable karma total
*
* @var int
*/
protected $karmaImmutableValueCache = 0;
/**
* Cached mutable karma total
*
* @var int
*/
protected $karmaMutableValueCache = 0;
/**
* Karma total cache generation timestamp
*
* @var int
*/
protected $karmaCacheTimestamp = 0;
/**
* JSON encoded associative array containing totals for the karma source
*
* @var string
*/
protected $karmaSourceTotalCache = '';
/**
* @var array|null
*/
private $karmaSourceTotalCacheDecoded;
/**
* Get the cached immutable karma total
*
* @return int
*/
public function getKarmaImmutableValueCache(): int
{
return $this->karmaImmutableValueCache;
}
/**
* Set cached immutable karma total
*
* @param int $karmaImmutableValueCache
*/
public function setKarmaImmutableValueCache(int $karmaImmutableValueCache)
{
$this->karmaImmutableValueCache = $karmaImmutableValueCache;
}
/**
* Get cached mutable karma total
*
* @return int
*/
public function getKarmaMutableValueCache(): int
{
return $this->karmaMutableValueCache;
}
/**
* Set cached mutable karma total
*
* @param int $karmaMutableValue
*/
public function setKarmaMutableValueCache(int $karmaMutableValue)
{
$this->karmaMutableValueCache = $karmaMutableValue;
}
/**
* Get karma total cache generation timestamp
*
* @return int
*/
public function getKarmaCacheTimestamp(): int
{
return $this->karmaCacheTimestamp;
}
/**
* Set karma total cache generation timestamp
*
* @param int $karmaCacheTimestamp
*/
public function setKarmaCacheTimestamp(int $karmaCacheTimestamp)
{
$this->karmaCacheTimestamp = $karmaCacheTimestamp;
}
/**
* Get the JSON string containing the karma source total cache array
*
* @return string
*/
public function getKarmaSourceTotalCache(): string
{
return $this->karmaSourceTotalCache;
}
/**
* Set the JSON string containing the karma source total cache array
*
* @param string $karmaSourceTotalCache
*/
public function setKarmaSourceTotalCache(string $karmaSourceTotalCache)
{
$this->karmaSourceTotalCache = $karmaSourceTotalCache;
}
/**
* @return array|null
*/
public function getKarmaSourceTotalCacheDecoded(): ?array
{
if ($this->karmaSourceTotalCacheDecoded === null) {
$this->karmaSourceTotalCacheDecoded = json_decode($this->getKarmaSourceTotalCache());
if (!is_array($this->karmaSourceTotalCacheDecoded)) {
$this->karmaSourceTotalCacheDecoded = [];
$this->setKarmaSourceTotalCache(json_encode($this->karmaSourceTotalCacheDecoded));
}
}
return $this->karmaSourceTotalCacheDecoded;
}
/**
* @param array|null $karmaSourceTotalCacheDecoded
*/
public function setKarmaSourceTotalCacheDecoded(array $karmaSouceTotalDecoded)
{
$this->karmaSourceTotalCacheDecoded = $karmaSouceTotalDecoded;
$this->setKarmaSourceTotalCache(json_encode($this->karmaSourceTotalCacheDecoded));
}
}
......@@ -2,8 +2,6 @@
namespace T3o\Karma\Domain\Model;
use In2code\Userprofile\Domain\Model\FrontendUser;
/***************************************************************
* Copyright notice
*
......@@ -28,6 +26,16 @@ use In2code\Userprofile\Domain\Model\FrontendUser;
***************************************************************/
class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var \DateTime
*/
protected $crdate;
/**
* @var \DateTime
*/
protected $tstamp;
/**
* The date when the entry expired, if set.
*
......@@ -54,26 +62,76 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $mutableValue;
/**
* The entry karmaSource
* The entry karma source code
*
* @var KarmaSource
* @var string
*/
protected $karmaSource;
/**
* @var string
*/
protected $issuer;
/**
* @var string
*/
protected $issuerAction;
/**
* Set to the related campaign if the entry is generated through a campaign
*
* @var Campaign
* @var \T3o\Karma\Domain\Model\Campaign
*/
protected $campaign;
/**
* The user the entry is valid for
*
* @var FrontendUser
* @var \T3o\Karma\Domain\Model\FrontendUser
*/
protected $user;
/**
* Get the creation date
*
* @return \DateTime
*/
public function getCrdate(): \DateTime
{
return $this->crdate;
}
/**
* Set the creation date
*
* @param \DateTime $crdate
*/
public function setCrdate(\DateTime $crdate)
{
$this->crdate = $crdate;
}
/**
* Get the last modified timestamp
*
* @return \DateTime
*/
public function getTstamp(): \DateTime
{
return $this->tstamp;
}
/**
* Set the last modified timestamp
*
* @param \DateTime $tstamp
*/
public function setTstamp(\DateTime $tstamp)
{
$this->tstamp = $tstamp;
}
/**
* Return the expired timestamp or zero if not yet expired
*
......@@ -149,7 +207,7 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Get the entry karma source
*
* @return KarmaSource
* @return string
*/
public function getKarmaSource()
{
......@@ -159,17 +217,57 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Set the entry karma source
*
* @param KarmaSource $karmaSource
* @param string $karmaSource
*/
public function setKarmaSource(KarmaSource $karmaSource)
public function setKarmaSource(string $karmaSource)
{
$this->karmaSource = $karmaSource;
}
/**
* Get the issuer code
*
* @return string
*/
public function getIssuer()
{
return $this->issuer;
}
/**
* Set the issuer code
*
* @param string $issuer
*/
public function setIssuer(string $issuer)
{
$this->issuer = $issuer;
}
/**
* Get the issuer action code
*
* @return string
*/
public function getIssuerAction()
{
return $this->issuerAction;
}
/**
* Set the issuer action code
*
* @param string $issuerAction
*/
public function setIssuerAction(string $issuerAction)
{
$this->issuerAction = $issuerAction;
}
/**
* Get the entry campaign that generated this entry, or null if no campaign
*
* @return Campaign
* @return \T3o\Karma\Domain\Model\Campaign
*/
public function getCampaign()
{
......@@ -179,7 +277,7 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Set the campaign that generated this entry
*
* @param Campaign $campaign
* @param \T3o\Karma\Domain\Model\Campaign $campaign
*/
public function setCampaign(Campaign $campaign)
{
......@@ -189,7 +287,7 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Get the user this entry is for
*
* @return FrontendUser
* @return \T3o\Karma\Domain\Model\FrontendUser
*/
public function getUser()
{
......@@ -199,7 +297,7 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Set the user the entry is for
*
* @param FrontendUser $user
* @param \T3o\Karma\Domain\Model\FrontendUser $user
*/
public function setUser(FrontendUser $user)
{
......
......@@ -2,6 +2,14 @@
namespace T3o\Karma\Domain\Repository;
use T3o\Karma\Domain\Model\LedgerEntry;
use T3o\Karma\Service\KarmaService;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
/***************************************************************
* Copyright notice
*
......@@ -27,4 +35,88 @@ namespace T3o\Karma\Domain\Repository;
class CampaignRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**