TYPO3 CMS  TYPO3_7-6
FileListIsStartModuleUpdate.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of the TYPO3 CMS project.
4  *
5  * It is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License, either version 2
7  * of the License, or any later version.
8  *
9  * For the full copyright and license information, please read the
10  * LICENSE.txt file that was distributed with this source code.
11  *
12  * The TYPO3 project - inspiring people to share!
13  */
14 
16 
21 {
25  protected $title = 'Update filelist user setting "startModule"';
26 
33  public function checkForUpdate(&$description)
34  {
35  if ($this->isWizardDone()) {
36  return false;
37  }
38 
39  if ($this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'be_users') === 0) {
40  return false;
41  }
42 
43  $description = 'The backend user setting startModule is changed for the extension filelist. Update all backend users that use ext:filelist as startModule.';
44 
45  return true;
46  }
47 
55  public function performUpdate(array &$databaseQueries, &$customMessages)
56  {
57  $db = $this->getDatabaseConnection();
58  $backendUsers = $db->exec_SELECTgetRows('uid,uc', 'be_users', '1=1');
59  if (!empty($backendUsers)) {
60  foreach ($backendUsers as $backendUser) {
61  if ($backendUser['uc'] !== null) {
62  $userConfig = unserialize($backendUser['uc']);
63  if ($userConfig['startModule'] === 'file_list') {
64  $userConfig['startModule'] = 'file_FilelistList';
65  $db->exec_UPDATEquery(
66  'be_users',
67  'uid=' . (int)$backendUser['uid'],
68  [
69  'uc' => serialize($userConfig),
70  ]
71  );
72  $databaseQueries[] = $db->debug_lastBuiltQuery;
73  }
74  }
75  }
76  }
77 
78  $this->markWizardAsDone();
79  return true;
80  }
81 }
performUpdate(array &$databaseQueries, &$customMessages)