TYPO3 CMS  TYPO3_7-6
MediaceExtractionUpdate.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
27  protected $title = 'Installs extension "mediace" from TER if media elements are used.';
28 
32  protected $extensionKey = 'mediace';
33 
37  protected $extensionDetails = [
38  'mediace' => [
39  'title' => 'Media Content Element',
40  'description' => 'The media functionality from TYPO3 6.2 and earlier can be found here. This extension provides ContentObjects and Content Elements.',
41  'versionString' => '7.6.3',
42  ]
43  ];
44 
51  public function checkForUpdate(&$description)
52  {
53  $updateNeeded = true;
54 
55  if ($this->isWizardDone() || ExtensionManagementUtility::isLoaded('mediace')) {
56  $updateNeeded = false;
57  } else {
58  $amountOfMediaElements = $this->getDatabaseConnection()->exec_SELECTcountRows(
59  'uid',
60  'tt_content',
61  'CType IN (\'media\', \'multimedia\') AND deleted=0'
62  );
63 
64  if ($amountOfMediaElements === 0) {
65  $updateNeeded = false;
66  }
67  }
68 
69  $description = 'The extension "mediace" (Media Content Element) was extracted into the TYPO3 Extension Repository. ' .
70  'This update checks if media content elements are used and downloads the TYPO3 Extension from the TER.';
71 
72  return $updateNeeded;
73  }
74 
82  public function performUpdate(array &$databaseQueries, &$customMessages)
83  {
84  $updateSuccessful = $this->installExtension($this->extensionKey, $customMessages);
85  if ($updateSuccessful) {
86  $this->markWizardAsDone();
87  }
88  return true;
89  }
90 }
performUpdate(array &$databaseQueries, &$customMessages)