Exemplo n.º 1
0
 /**
  * Determine all create table statements which create the sys_file* tables
  *
  * @return array
  */
 protected function getRequiredUpdates()
 {
     $requiredUpdates = array();
     $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_t3lib . 'stddb/tables.sql');
     $FDfile = $this->installerSql->getFieldDefinitions_fileContent($fileContent);
     $FDdb = $this->installerSql->getFieldDefinitions_database(TYPO3_db);
     $diff = $this->installerSql->getDatabaseExtra($FDfile, $FDdb);
     $update_statements = $this->installerSql->getUpdateSuggestions($diff);
     foreach ((array) $update_statements['create_table'] as $string) {
         if (preg_match('/^CREATE TABLE sys_file($|_)?/', $string)) {
             $requiredUpdates[] = $string;
         }
     }
     return $requiredUpdates;
 }
Exemplo n.º 2
0
 /**
  * Update database / process db updates from ext_tables
  *
  * @param string $rawDefinitions The raw SQL statements from ext_tables.sql
  * @return void
  */
 public function updateDbWithExtTablesSql($rawDefinitions)
 {
     $fieldDefinitionsFromFile = $this->installToolSqlParser->getFieldDefinitions_fileContent($rawDefinitions);
     if (count($fieldDefinitionsFromFile)) {
         $fieldDefinitionsFromCurrentDatabase = $this->installToolSqlParser->getFieldDefinitions_database();
         $diff = $this->installToolSqlParser->getDatabaseExtra($fieldDefinitionsFromFile, $fieldDefinitionsFromCurrentDatabase);
         $updateStatements = $this->installToolSqlParser->getUpdateSuggestions($diff);
         foreach ((array) $updateStatements['add'] as $string) {
             $GLOBALS['TYPO3_DB']->admin_query($string);
         }
         foreach ((array) $updateStatements['change'] as $string) {
             $GLOBALS['TYPO3_DB']->admin_query($string);
         }
         foreach ((array) $updateStatements['create_table'] as $string) {
             $GLOBALS['TYPO3_DB']->admin_query($string);
         }
     }
 }