Skip to content

Commit

Permalink
Merge pull request #14 from pimcore/11.1-from-7113486479
Browse files Browse the repository at this point in the history
Automated PR
  • Loading branch information
herbertroth committed Dec 6, 2023
2 parents db09d25 + 92770c3 commit 7706414
Show file tree
Hide file tree
Showing 27 changed files with 100 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace Pimcore\Bundle\CoreBundle\Command;

use Pimcore\Cache;
use Pimcore\Console\AbstractCommand;
use Pimcore\DataObject\ClassBuilder\PHPClassDumperInterface;
use Pimcore\DataObject\ClassBuilder\PHPFieldCollectionClassDumperInterface;
Expand Down Expand Up @@ -49,15 +50,13 @@ public function __construct(

protected function execute(InputInterface $input, OutputInterface $output): int
{
$cacheStatus = \Pimcore\Cache::isEnabled();
\Pimcore\Cache::disable();
$cacheStatus = Cache::isEnabled();
Cache::disable();
$objectClassesFolders = array_unique([PIMCORE_CLASS_DEFINITION_DIRECTORY, PIMCORE_CUSTOM_CONFIGURATION_CLASS_DEFINITION_DIRECTORY]);

foreach ($objectClassesFolders as $objectClassesFolder) {
$files = glob($objectClassesFolder.'/*.php');

$changes = [];

foreach ($files as $file) {
$class = include $file;

Expand All @@ -84,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($cacheStatus) {
\Pimcore\Cache::enable();
Cache::enable();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function process(ContainerBuilder $container): void
if (isset($markingStoreDefinition)) {
$workflowDefinition->replaceArgument(1, $markingStoreDefinition);
}
$workflowDefinition->setPublic(true);
$workflowDefinition->replaceArgument(3, $workflowName);
$workflowDefinition->replaceArgument(4, $workflowConfig['events_to_dispatch'] ?? null);

Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@
"require-dev": {
"codeception/codeception": "^5.0.3",
"codeception/module-symfony": "^3.1.0",
"codeception/phpunit-wrapper": "^9",
"ergebnis/phpstan-rules": "^2.0",
"phpstan/phpstan": "1.10.43",
"phpstan/phpstan": "1.10.46",
"phpstan/phpstan-symfony": "^1.3.5",
"phpunit/phpunit": "^9.3",
"gotenberg/gotenberg-php": "^1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ If you choose to install backend search (which is installed by default), you mus
:::

5. :heavy_check_mark: DONE - You can now visit your pimcore instance:
* The frontend: <http://localhost>
* The frontend: [localhost](http://localhost)
* The admin interface, using the credentials you have chosen above:
<http://localhost/admin>
[Admin interface](http://localhost/admin)


## Caching
Expand Down
2 changes: 1 addition & 1 deletion doc/02_MVC/04_Routing_and_URLs/02_Custom_Routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ to do so just embrace the part with curly brackets { } (see example below).

| Name | Pattern | Reverse | Controller | Variables | Defaults | Site IDs | Priority | Methods |
|----------|------------------------|------------------|-----------------------------------------------|-----------|--------------|----------|--------------|-------------|
| news category | /\\/news-category\\/([^_]+)_([0-9]+)(_category_)?([0-9]+)?/ | /news-category/%text_%id{_category_%categoryId} | App\Controller\NewsController::listingAction | text,id,text2,categoryId | | | 1 | |
| news category | /\\/news-category\\/([^_]+)_([0-9]+)(_category_)?([0-9]+)?/ | /news-category/%text_%id\{_category_%categoryId\} | App\Controller\NewsController::listingAction | text,id,text2,categoryId | | | 1 | |

![Grid with the new route](../../img/Routing_grid2.png)

Expand Down
2 changes: 1 addition & 1 deletion doc/03_Documents/01_Editables/02_Areablock/02_Bricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ as registered on the areabrick manager (see below).
| Location | Path |
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| global | `templates/areas/<brickId>/` |
| bundle | `<bundlePath>/Resources/views/areas/<brickId>/` for legacy (Symfony <= 4) bundle structure<br/>or<br/>`<bundlePath>/templates/areas/<brickId>/` for modern (Symfony >= 5) bundle structure |
| bundle | `<bundlePath>/Resources/views/areas/<brickId>/` for legacy (Symfony \<= 4) bundle structure<br/>or<br/>`<bundlePath>/templates/areas/<brickId>/` for modern (Symfony >= 5) bundle structure |

Depending on the template location, the following files will be used. You can always completely control locations by
implementing the methods for templates and icon yourself (see `AreabrickInterface`):
Expand Down
2 changes: 1 addition & 1 deletion doc/03_Documents/01_Editables/02_Areablock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ And you can see the effect, below:
| `manual` | bool | Forces the manual mode, which enables a complete free implementation for areablocks, for example using real `<table>` elements... example see below |
| `reload` | bool | Set to `true`, to force a reload in editmode after reordering items (default: `false`) |
| `limit` | int | Limit the amount of elements |
| `limits` | array | An array of area-ID's with count to limit the amount of certain elements e.g. {"iframe": 1, "teasers": 2} |
| `limits` | array | An array of area-ID's with count to limit the amount of certain elements e.g. \{"iframe": 1, "teasers": 2\} |
| `areablock_toolbar` | array | Array with option that allows you to configure the toolbar. Possible options are `width`, `buttonWidth` and `buttonMaxCharacters` |
| `controlsAlign` | string | The position of the control button bar. Options are: `top`, `right` and `left`. |
| `controlsTrigger` | string | Options are: `hover`(default) and `fixed` . |
Expand Down
4 changes: 2 additions & 2 deletions doc/03_Documents/01_Editables/40_WYSIWYG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ framework:
```
If you want to adapt this configuration please have a look at the [symfony documentation](https://symfony.com/doc/current/html_sanitizer.html). Add your custom configuration to you project, e.g. to `config/packages/html_sanitizer.yaml`

> Note: When using API to set WYSIWYG data, please pass encoded characters for html entities e.g. <,>, & etc.
> The data is encoded by the sanitizer before persisting into db and the same encoded data will be returned by the API.
> Note: When using API to set WYSIWYG data, please pass encoded characters for html entities e.g. `<`,`>`, `&` etc.
> The data is encoded by the sanitizer before persisting into db and the same encoded data will be returned by the API.
2 changes: 1 addition & 1 deletion doc/19_Development_Tools_and_Details/07_Logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pimcore:
| 2 | User-ID |
| Pimcore\Bundle\AdminBundle\Controller\Admin\Document\PageController::saveAction | Module\Controller::Action |
| pimcore_admin_document_page_save | Route name |
| {"task":"pub .... | Request Parameters (shortened & censored) |
| \{"task":"pub .... \} | Request Parameters (shortened & censored) |

## redirect.log
Sometimes it's necessary to debug redirects, for example when a redirect ends in an infinite loop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pimcore_admin:
```
> Please note:
> custom_admin_path_identifier should be at least 20 characters long
> and must not start with `/admin` if Pimcore version <= 6.0.5 !
> and must not start with `/admin` if Pimcore version \<= 6.0.5 !
Add custom entry for `PimcoreCoreBundle:PublicServices:customAdminEntryPoint` in your routing.yaml:
```yaml
Expand Down
2 changes: 1 addition & 1 deletion doc/20_Extending_Pimcore/17_Custom_Persistent_Models.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Pimcore provides 2 possible ways of working with custom entities namely Doctrine

## Option 1: Use Doctrine ORM
Pimcore comes already with the Doctrine bundle, so you can easily create your own entities.
Please check <https://symfony.com/doc/current/doctrine.html> for more details.
Please check [https://symfony.com/doc/current/doctrine.html](https://symfony.com/doc/current/doctrine.html) for more details.

## Option 2: Working with Pimcore Data Access Objects (Dao)

Expand Down
2 changes: 1 addition & 1 deletion doc/21_Deployment/01_Version_Control_Systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Since Pimcore creates lots of temporary files during runtime it's recommended to

If using Git for your project we recommend the following `.gitignore`:

* <https://github.com/pimcore/demo/blob/11.x/.gitignore>
* [https://github.com/pimcore/demo/blob/11.x/.gitignore](https://github.com/pimcore/demo/blob/11.x/.gitignore)
4 changes: 2 additions & 2 deletions doc/21_Deployment/03_Configuration_Environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ or (e.g. in *prod* environments) you can configure everything via real environme

In addition to Symfony configurations, Pimcore also supports environment specific configs for:

* <https://github.com/pimcore/demo/tree/11.x/config/pimcore>
* <https://github.com/pimcore/demo/tree/11.x/var/config>
* [https://github.com/pimcore/demo/tree/11.x/config/pimcore](https://github.com/pimcore/demo/tree/11.x/config/pimcore)
* [https://github.com/pimcore/demo/tree/11.x/var/config](https://github.com/pimcore/demo/tree/11.x/var/config)


## Configuration Storage Locations & Fallbacks
Expand Down
6 changes: 3 additions & 3 deletions doc/21_Deployment/05_Deployment_Tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ All Pimcore configurations are saved as YAML or PHP files on the file system. As
[multi environment feature](03_Configuration_Environments.md) different configuration files for different deployment stages
can be defined.

* <https://github.com/pimcore/demo/tree/11.x/config>
* <https://github.com/pimcore/demo/tree/11.x/config/pimcore>
* <https://github.com/pimcore/demo/tree/11.x/var/config>
* [https://github.com/pimcore/demo/tree/11.x/config](https://github.com/pimcore/demo/tree/11.x/config)
* [https://github.com/pimcore/demo/tree/11.x/config/pimcore](https://github.com/pimcore/demo/tree/11.x/config/pimcore)
* [https://github.com/pimcore/demo/tree/11.x/var/config](https://github.com/pimcore/demo/tree/11.x/var/config)


## Pimcore Class Definitions
Expand Down
2 changes: 1 addition & 1 deletion doc/23_Installation_and_Upgrade/01_System_Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For production, we highly recommend a *nix based system.
- Nginx


### PHP >=8.1 <8.3
### PHP >=8.1 \<8.3
Both **mod_php** and **FCGI (FPM)** are supported.

#### Required Settings and Modules & Extensions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Upgrading Pimcore from Version 6.x to Version 10

## System Requirement changes
- PHP >=8.0 <8.2
- PHP >=8.0 \<8.2
- Apache >= 2.4
- Composer >= 2.0

> As Pimcore 6.x works only with PHP < 8.0 and Pimcore 10 works only with PHP >=8.0 <8.2, a switch of PHP version is needed during the upgrade process.
> As Pimcore 6.x works only with PHP < 8.0 and Pimcore 10 works only with PHP >=8.0 \<8.2, a switch of PHP version is needed during the upgrade process.
## Database Requirement changes
- MariaDB >= 10.3
Expand Down Expand Up @@ -163,10 +163,10 @@ mv var/config/custom-logo.* var/admin/custom-logo.image

## SWITCH COMPOSER AND PHP VERSION, AND DO THE UPDATE!
- Ensure Composer is updated to version >= 2.0
- Switch PHP version to PHP >=8.0 <8.2
- Switch PHP version to PHP >=8.0 \<8.2
- Run composer update (`COMPOSER_MEMORY_LIMIT=-1 composer update`)

## CHANGES TO DO AFTER THE UPDATE! (TO DO WITH PHP >=8.0 <8.2)
## CHANGES TO DO AFTER THE UPDATE! (TO DO WITH PHP >=8.0 \<8.2)

### Verify migrations execution
By default, Composer update runs Pimcore migrations automatically, however it is better to check if all migrations are executed for smooth transition.
Expand Down
2 changes: 1 addition & 1 deletion doc/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ The tokens for password reset are now stored in the DB and are one time use only

- Enabled Content Security Policy by default.
- Implemented Symfony HTML sanitizer for WYSIWYG editors. Please make sure to sanitize your persisted data with help of this [script](https://gist.github.com/dvesh3/0e585a16dfbf546bc17a9eef1c5640b3).
Also, when using API to set WYSIWYG data, please pass encoded characters for html entities <,>, & etc.
Also, when using API to set WYSIWYG data, please pass encoded characters for html entities `<`,`>`, `&` etc.
The data is encoded by the sanitizer before persisting into db and the same encoded data will be returned by the API.


Expand Down
12 changes: 8 additions & 4 deletions lib/Event/Workflow/GlobalActionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

use Pimcore\Event\Traits\ArgumentsAwareTrait;
use Pimcore\Workflow\GlobalAction;
use Symfony\Component\Workflow\Workflow;
use Symfony\Component\Workflow\WorkflowInterface;
use Symfony\Contracts\EventDispatcher\Event;

class GlobalActionEvent extends Event
{
use ArgumentsAwareTrait;

protected Workflow $workflow;
protected WorkflowInterface $workflow;

protected mixed $subject = null;

Expand All @@ -35,15 +35,19 @@ class GlobalActionEvent extends Event
* DocumentEvent constructor.
*
*/
public function __construct(Workflow $workflow, mixed $subject, GlobalAction $globalAction, array $arguments = [])
public function __construct(
WorkflowInterface $workflow,
mixed $subject,
GlobalAction $globalAction,
array $arguments = [])
{
$this->workflow = $workflow;
$this->subject = $subject;
$this->globalAction = $globalAction;
$this->arguments = $arguments;
}

public function getWorkflow(): Workflow
public function getWorkflow(): WorkflowInterface
{
return $this->workflow;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class ClassDefinitionManager

/**
* Delete all classes from db
*
* @return list<array{string, string, string}>
*/
public function cleanUpDeletedClassDefinitions(): array
{
Expand Down Expand Up @@ -58,16 +60,16 @@ public function cleanUpDeletedClassDefinitions(): array

/**
* Updates all classes from PIMCORE_CLASS_DEFINITION_DIRECTORY
*
* @return list<array{string, string, string}>
*/
public function createOrUpdateClassDefinitions(): array
{
$objectClassesFolders = array_unique([PIMCORE_CLASS_DEFINITION_DIRECTORY, PIMCORE_CUSTOM_CONFIGURATION_CLASS_DEFINITION_DIRECTORY]);
$changes = [];

foreach ($objectClassesFolders as $objectClassesFolder) {
$files = glob($objectClassesFolder.'/*.php');

$changes = [];

foreach ($files as $file) {
$class = include $file;

Expand Down
2 changes: 1 addition & 1 deletion lib/Templating/Renderer/IncludeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function render(mixed $include, array $params = [], bool $editmode = fals
});

// TODO is this enough for cache or should we disable caching completely?
if (method_exists($include, 'getUseTargetGroup') && $include->getUseTargetGroup()) {
if (is_object($include) && method_exists($include, 'getUseTargetGroup') && $include->getUseTargetGroup()) {
$cacheParams['target_group'] = $include->getUseTargetGroup();
}

Expand Down
4 changes: 1 addition & 3 deletions lib/Tool/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ public static function verifyPassword(User $user, string $password): bool
return false;
}

$password = self::preparePlainTextPassword($user->getName(), $password);

if (!password_verify($password, $user->getPassword())) {
if (!password_verify(self::preparePlainTextPassword($user->getName(), $password), $user->getPassword())) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Workflow/GlobalAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Pimcore\Workflow\Notes\CustomHtmlServiceInterface;
use Pimcore\Workflow\Notes\NotesAwareInterface;
use Pimcore\Workflow\Notes\NotesAwareTrait;
use Symfony\Component\Workflow\Workflow;
use Symfony\Component\Workflow\WorkflowInterface;

class GlobalAction implements NotesAwareInterface
{
Expand Down Expand Up @@ -80,7 +80,7 @@ public function getGuard(): ?string
return $this->options['guard'] ?? null;
}

public function isGuardValid(Workflow $workflow, object $subject): bool
public function isGuardValid(WorkflowInterface $workflow, object $subject): bool
{
if (empty($this->getGuard())) {
return true;
Expand Down
28 changes: 19 additions & 9 deletions lib/Workflow/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use Symfony\Component\Workflow\Exception\LogicException;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\Registry;
use Symfony\Component\Workflow\Workflow;
use Symfony\Component\Workflow\WorkflowInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

class Manager
Expand Down Expand Up @@ -116,7 +116,7 @@ public function getPlaceConfig(string $workflowName, string $place): ?PlaceConfi
*
* @return PlaceConfig[];
*/
public function getOrderedPlaceConfigs(Workflow $workflow, Marking $marking = null): array
public function getOrderedPlaceConfigs(WorkflowInterface $workflow, Marking $marking = null): array
{
if (is_null($marking)) {
return $this->placeConfigs[$workflow->getName()] ?? [];
Expand Down Expand Up @@ -170,7 +170,7 @@ public function getWorkflowConfig(string $workflowName): WorkflowConfig

/**
*
* @return Workflow[]
* @return WorkflowInterface[]
*/
public function getAllWorkflowsForSubject(object $subject): array
{
Expand All @@ -189,7 +189,7 @@ public function getAllWorkflowsForSubject(object $subject): array
return $workflows;
}

public function getWorkflowIfExists(object $subject, string $workflowName): ?Workflow
public function getWorkflowIfExists(object $subject, string $workflowName): ?WorkflowInterface
{
try {
$workflow = $this->workflowRegistry->get($subject, $workflowName);
Expand All @@ -214,8 +214,13 @@ public function getWorkflowByName(string $workflowName): ?object
* @throws ValidationException
* @throws \Exception
*/
public function applyWithAdditionalData(Workflow $workflow, Asset|PageSnippet|Concrete $subject, string $transition, array $additionalData, bool $saveSubject = false): Marking
{
public function applyWithAdditionalData(
WorkflowInterface $workflow,
Asset|PageSnippet|Concrete $subject,
string $transition,
array $additionalData,
bool $saveSubject = false
): Marking {
$this->notesSubscriber->setAdditionalData($additionalData);

$marking = $workflow->apply($subject, $transition, $additionalData);
Expand All @@ -241,8 +246,13 @@ public function applyWithAdditionalData(Workflow $workflow, Asset|PageSnippet|Co
*
* @throws \Exception
*/
public function applyGlobalAction(Workflow $workflow, object $subject, string $globalAction, array $additionalData, bool $saveSubject = false): Marking
{
public function applyGlobalAction(
WorkflowInterface $workflow,
object $subject,
string $globalAction,
array $additionalData,
bool $saveSubject = false
): Marking {
$globalActionObj = $this->getGlobalAction($workflow->getName(), $globalAction);
if (!$globalActionObj) {
throw new LogicException(sprintf('global action %s not found', $globalAction));
Expand Down Expand Up @@ -345,7 +355,7 @@ public function ensureInitialPlace(string $workflowName, object $subject): bool
return false;
}

public function getInitialPlacesForWorkflow(Workflow $workflow): array
public function getInitialPlacesForWorkflow(WorkflowInterface $workflow): array
{
$definition = $workflow->getDefinition();

Expand Down
Loading

0 comments on commit 7706414

Please sign in to comment.