1<?php
2
3/*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16namespace TYPO3\CMS\Install\Updates;
17
18use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
19
20/**
21 * Installs and downloads EXT:taskcenter if requested
22 * @internal This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
23 */
24class TaskcenterExtractionUpdate extends AbstractDownloadExtensionUpdate
25{
26    /**
27     * @var \TYPO3\CMS\Install\Updates\ExtensionModel
28     */
29    protected $extension;
30
31    /**
32     * @var \TYPO3\CMS\Install\Updates\Confirmation
33     */
34    protected $confirmation;
35
36    public function __construct()
37    {
38        $this->extension = new ExtensionModel(
39            'taskcenter',
40            'Deprecated taskcenter extension',
41            '10.0.0',
42            'friendsoftypo3/taskcenter',
43            'Contains a framework to show and execute registered tasks.'
44        );
45
46        $this->confirmation = new Confirmation(
47            'Are you sure?',
48            'This extension has not been used very often and is only useful together with other extensions like sys_action. ' . $this->extension->getDescription(),
49            false
50        );
51    }
52
53    /**
54     * Return a confirmation message instance
55     *
56     * @return \TYPO3\CMS\Install\Updates\Confirmation
57     */
58    public function getConfirmation(): Confirmation
59    {
60        return $this->confirmation;
61    }
62
63    /**
64     * Return the identifier for this wizard
65     * This should be the same string as used in the ext_localconf class registration
66     *
67     * @return string
68     */
69    public function getIdentifier(): string
70    {
71        return 'taskcenterExtension';
72    }
73
74    /**
75     * Return the speaking name of this wizard
76     *
77     * @return string
78     */
79    public function getTitle(): string
80    {
81        return 'Install extension "taskcenter" from TER';
82    }
83
84    /**
85     * Return the description for this wizard
86     *
87     * @return string
88     */
89    public function getDescription(): string
90    {
91        return 'The extension "taskcenter" adds a view for Backend users to run configured tasks.'
92               . ' It is only useful if properly configured.';
93    }
94
95    /**
96     * Is an update necessary?
97     * Is used to determine whether a wizard needs to be run.
98     *
99     * @return bool
100     */
101    public function updateNecessary(): bool
102    {
103        return !ExtensionManagementUtility::isLoaded('taskcenter');
104    }
105
106    /**
107     * Returns an array of class names of Prerequisite classes
108     * This way a wizard can define dependencies like "database up-to-date" or
109     * "reference index updated"
110     *
111     * @return string[]
112     */
113    public function getPrerequisites(): array
114    {
115        return [
116            DatabaseUpdatedPrerequisite::class,
117        ];
118    }
119}
120