TYPO3 CMS  TYPO3_6-2
SqlExpectedSchemaService.php
Go to the documentation of this file.
1 <?php
3 
18 
25 
30  protected $objectManager = NULL;
31 
37 
43  public function getExpectedDatabaseSchema() {
45  $schemaMigrationService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService');
46  // Raw concatenated ext_tables.sql and friends string
47  $expectedSchemaString = $this->getTablesDefinitionString();
48  // Remove comments
49  $cleanedExpectedSchemaString = implode(LF, $schemaMigrationService->getStatementArray($expectedSchemaString, TRUE, '^CREATE TABLE '));
50  $expectedSchema = $schemaMigrationService->getFieldDefinitions_fileContent($cleanedExpectedSchemaString);
51  return $expectedSchema;
52  }
53 
60  public function getTablesDefinitionString($withStatic = FALSE) {
61  $sqlString = array();
62 
63  // Find all ext_tables.sql of loaded extensions
64  $loadedExtensionInformation = $GLOBALS['TYPO3_LOADED_EXT'];
65  foreach ($loadedExtensionInformation as $extensionConfiguration) {
66  if ((is_array($extensionConfiguration) || $extensionConfiguration instanceof \ArrayAccess) && $extensionConfiguration['ext_tables.sql']) {
67  $sqlString[] = GeneralUtility::getUrl($extensionConfiguration['ext_tables.sql']);
68  }
69  if ($withStatic
70  && (is_array($extensionConfiguration) || $extensionConfiguration instanceof \ArrayAccess)
71  && $extensionConfiguration['ext_tables_static+adt.sql']
72  ) {
73  $sqlString[] = GeneralUtility::getUrl($extensionConfiguration['ext_tables_static+adt.sql']);
74  }
75  }
76 
77  $sqlString = $this->emitTablesDefinitionIsBeingBuiltSignal($sqlString);
78 
79  return implode(LF . LF . LF . LF, $sqlString);
80  }
81 
88  protected function emitTablesDefinitionIsBeingBuiltSignal(array $sqlString) {
89  $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array($sqlString));
90  // This is important to support old associated returns
91  $signalReturn = array_values($signalReturn);
92  $sqlString = $signalReturn[0];
93  if (!is_array($sqlString)) {
94  throw new Exception\UnexpectedSignalReturnValueTypeException(
95  sprintf(
96  'The signal %s of class %s returned a value of type %s, but array was expected.',
97  'tablesDefinitionIsBeingBuilt',
98  __CLASS__,
99  gettype($sqlString)
100  ),
101  1382351456
102  );
103  }
104  return $sqlString;
105  }
106 }
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]