[TASK] Re-work/simplify copyright header in PHP files - Part 1
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / AbstractDatabaseSchemaUpdate.php
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
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
17 /**
18 * Contains the update class to create and alter tables, fields and keys to comply to the database schema
19 *
20 * @author Stephan GroƟberndt <stephan@grossberndt.de>
21 */
22 abstract class AbstractDatabaseSchemaUpdate extends AbstractUpdate {
23
24 /**
25 * @var string
26 */
27 protected $title;
28
29 /**
30 * @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService
31 */
32 protected $schemaMigrationService;
33
34 /**
35 * @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService
36 */
37 protected $expectedSchemaService;
38
39 /**
40 * Constructor function.
41 */
42 public function __construct() {
43 $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
44 $this->schemaMigrationService = $objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
45 $this->expectedSchemaService = $objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService');
46 }
47
48 /**
49 * Compare current and expected database schemas and return the database differences
50 *
51 * @return array database differences
52 */
53 protected function getDatabaseDifferences() {
54 $expectedSchema = $this->expectedSchemaService->getExpectedDatabaseSchema();
55 $currentSchema = $this->schemaMigrationService->getFieldDefinitions_database();
56
57 // Difference from expected to current
58 return $this->schemaMigrationService->getDatabaseExtra($expectedSchema, $currentSchema);
59 }
60
61 }