7 * @license http://www.gnu.org/licenses/agpl.html AGPL3
8 * @copyright Copyright (c) 2016-2017 Metaways Infosystems GmbH (http://www.metaways.de)
9 * @author Philipp Schüle <p.schuele@metaways.de>
11 class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
16 * @see 0012162: create new MailFiler application
18 public function update_0()
20 $this->_addIsDeletedToTreeNodes();
22 $release9 = new Tinebase_Setup_Update_Release9($this->_backend);
23 $release9->update_9();
24 $this->setApplicationVersion('Tinebase', '10.1');
30 * @see 0012300: add container owner column
32 public function update_1()
34 $release9 = new Tinebase_Setup_Update_Release9($this->_backend);
36 $release9->update_4();
37 } catch (Zend_Db_Exception $zde) {
38 Tinebase_Exception::log($zde);
40 $this->setApplicationVersion('Tinebase', '10.2');
46 * change length of groups.description column from varchar(255) to text
48 public function update_2()
50 $release9 = new Tinebase_Setup_Update_Release9($this->_backend);
51 $release9->update_5();
52 $this->setApplicationVersion('Tinebase', '10.3');
60 public function update_3()
62 $release9 = new Tinebase_Setup_Update_Release9($this->_backend);
63 $release9->update_10();
64 $this->setApplicationVersion('Tinebase', '10.4');
68 * needs to be done again to make sure we have the column!
70 * @see 0012300: add container owner column
72 public function update_4()
74 $release9 = new Tinebase_Setup_Update_Release9($this->_backend);
76 $release9->update_4();
77 } catch (Zend_Db_Exception $zde) {
78 Tinebase_Exception::log($zde);
80 $this->setApplicationVersion('Tinebase', '10.5');
86 * add account sync scheduler job
88 public function update_5()
90 $scheduler = Tinebase_Core::getScheduler();
91 Tinebase_Scheduler_Task::addAccountSyncTask($scheduler);
93 $this->setApplicationVersion('Tinebase', '10.6');
99 * update timemachine_modlog table
101 public function update_6()
103 if (!$this->_backend->columnExists('instance_id', 'timemachine_modlog')) {
105 $this->_backend->renameTable('timemachine_modlog', 'timemachine_modlog_bkp');
106 $db = Tinebase_Core::getDb();
107 if ($db instanceof Zend_Db_Adapter_Pdo_Pgsql) {
108 $db->exec('ALTER INDEX "' . SQL_TABLE_PREFIX . 'timemachine_modlog_pkey" RENAME TO ' . SQL_TABLE_PREFIX . 'timemachine_modlog_pkey_bkp');
109 $db->exec('ALTER INDEX "' . SQL_TABLE_PREFIX . 'timemachine_modlog_seq" RENAME TO ' . SQL_TABLE_PREFIX . 'timemachine_modlog_seq_bkp');
110 $db->exec('ALTER INDEX "' . SQL_TABLE_PREFIX . 'timemachine_modlog_unique-fields_key" RENAME TO "' . SQL_TABLE_PREFIX . 'timemachine_modlog_unique-fields_key_bkp"');
113 $this->_backend->createTable(new Setup_Backend_Schema_Table_Xml('<table>
114 <name>timemachine_modlog</name>
121 <notnull>true</notnull>
124 <name>instance_id</name>
127 <notnull>false</notnull>
130 <name>instance_seq</name>
132 <notnull>true</notnull>
133 <autoincrement>true</autoincrement>
136 <name>change_type</name>
139 <notnull>false</notnull>
142 <name>application_id</name>
145 <notnull>true</notnull>
148 <name>record_id</name>
151 <notnull>false</notnull>
154 <name>record_type</name>
157 <notnull>false</notnull>
160 <name>record_backend</name>
163 <notnull>false</notnull>
166 <name>modification_time</name>
167 <type>datetime</type>
168 <notnull>true</notnull>
171 <name>modification_account</name>
174 <notnull>true</notnull>
177 <name>modified_attribute</name>
180 <notnull>false</notnull>
183 <name>old_value</name>
187 <name>new_value</name>
199 <notnull>true</notnull>
203 <primary>true</primary>
209 <name>instance_id</name>
211 <name>instance_id</name>
215 <name>instance_seq</name>
216 <unique>true</unique>
218 <name>instance_seq</name>
228 <name>unique-fields</name>
229 <unique>true</unique>
231 <name>application_id</name>
234 <name>record_id</name>
237 <name>record_type</name>
240 <name>modification_time</name>
243 <name>modification_account</name>
246 <name>modified_attribute</name>
257 $appIds[] = Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId();
258 if (Tinebase_Application::getInstance()->isInstalled('Calendar')) {
259 $appIds[] = Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId();
262 $select = $db->select()->from(SQL_TABLE_PREFIX . 'timemachine_modlog_bkp')->order('modification_time ASC')
263 ->where($db->quoteInto($db->quoteIdentifier('application_id') . ' IN (?)', $appIds))
264 ->where($db->quoteInto($db->quoteIdentifier('record_type') . ' IN (?)', array('Addressbook_Model_Contact', 'Calendar_Model_Resource')))
265 ->where($db->quoteInto($db->quoteIdentifier('modified_attribute') . ' IN (?)', array('email', 'email_home')));
267 $stmt = $db->query($select);
268 $resultArray = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
270 if (count($resultArray) > 0) {
271 foreach($resultArray as $row) {
272 $row['client'] = 'update script';
273 $db->insert(SQL_TABLE_PREFIX . 'timemachine_modlog', $row);
277 $this->setTableVersion('timemachine_modlog', '5');
280 $this->setApplicationVersion('Tinebase', '10.7');
286 * update roles and application table
288 public function update_7()
290 if (!$this->_backend->columnExists('is_deleted', 'roles')) {
291 $query = $this->_backend->addAddCol(null, 'roles',
292 new Setup_Backend_Schema_Field_Xml('<field>
293 <name>is_deleted</name>
295 <default>false</default>
296 </field>'), 'last_modified_time'
298 $query = $this->_backend->addAddCol($query, 'roles',
299 new Setup_Backend_Schema_Field_Xml('<field>
300 <name>deleted_by</name>
303 </field>'), 'is_deleted'
305 $query = $this->_backend->addAddCol($query, 'roles',
306 new Setup_Backend_Schema_Field_Xml('<field>
307 <name>deleted_time</name>
308 <type>datetime</type>
309 </field>'), 'deleted_by'
311 $query = $this->_backend->addAddCol($query, 'roles',
312 new Setup_Backend_Schema_Field_Xml('<field>
315 <notnull>true</notnull>
317 </field>'), 'deleted_time'
319 $this->_backend->execQueryVoid($query);
320 $this->setTableVersion('roles', '2');
323 if (!$this->_backend->columnExists('state', 'applications')) {
325 $this->_backend->addCol('applications',
326 new Setup_Backend_Schema_Field_Xml('<field>
329 <length>65535</length>
330 <notnull>false</notnull>
334 $this->setTableVersion('applications', '4');
337 $this->setApplicationVersion('Tinebase', '10.8');
343 * add client row to timemachine_modlog
345 * @see 0012830: add client user agent to modlog
347 public function update_8()
349 if (! $this->_backend->columnExists('client', 'timemachine_modlog')) {
350 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
354 <notnull>true</notnull>
356 $this->_backend->addCol('timemachine_modlog', $declaration);
358 $this->setTableVersion('timemachine_modlog', '5');
361 $this->setApplicationVersion('Tinebase', '10.9');
367 * adding path filter feature switch & structure update
369 public function update_9()
371 $this->_addIsDeletedToTreeNodes();
373 $this->dropTable('path');
375 $declaration = new Setup_Backend_Schema_Table_Xml('<table>
379 <required>mysql >= 5.6.4</required>
386 <notnull>true</notnull>
391 <length>65535</length>
392 <notnull>true</notnull>
395 <name>shadow_path</name>
397 <length>65535</length>
398 <notnull>true</notnull>
401 <name>creation_time</name>
402 <type>datetime</type>
406 <primary>true</primary>
413 <fulltext>true</fulltext>
419 <name>shadow_path</name>
420 <fulltext>true</fulltext>
422 <name>shadow_path</name>
428 $this->createTable('path', $declaration, 'Tinebase', 2);
431 $setupUser = Setup_Update_Abstract::getSetupFromConfigOrCreateOnTheFly();
433 Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
434 Tinebase_Controller::getInstance()->rebuildPaths();
436 if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
437 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
438 . ' Could not find valid setupuser. Skipping rebuildPaths: you might need to run this manually.');
441 } catch (Exception $e) {
442 Tinebase_Exception::log($e);
443 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
444 . ' Skipping rebuildPaths: you might need to run this manually.');
447 $this->setApplicationVersion('Tinebase', '10.10');
453 * create external_fulltext table
455 public function update_10()
457 $this->_backend->createTable(new Setup_Backend_Schema_Table_Xml('<table>
458 <name>external_fulltext</name>
465 <notnull>true</notnull>
468 <name>text_data</name>
470 <length>2147483647</length>
471 <notnull>true</notnull>
475 <primary>true</primary>
481 <name>text_data</name>
482 <fulltext>true</fulltext>
484 <name>text_data</name>
488 </table>'), 'Tinebase', 'external_fulltext');
490 $this->setApplicationVersion('Tinebase', '10.11');
496 * add revision_size to tree_fileobjects
498 public function update_11()
501 if (!$this->_backend->columnExists('total_size', 'tree_fileobjects')) {
502 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
503 <name>revision_size</name>
505 <notnull>true</notnull>
509 $query = $this->_backend->addAddCol('', 'tree_fileobjects', $declaration);
511 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
512 <name>indexed_hash</name>
517 $query = $this->_backend->addAddCol($query, 'tree_fileobjects', $declaration);
519 $this->_backend->execQueryVoid($query);
521 $this->setTableVersion('tree_fileobjects', '4');
524 $this->setApplicationVersion('Tinebase', '10.12');
530 public function update_12()
532 if (! $this->_backend->columnExists('acl_node', 'tree_nodes')) {
533 $declaration = new Setup_Backend_Schema_Field_Xml(
535 <name>acl_node</name>
540 $query = $this->_backend->addAddCol('', 'tree_nodes', $declaration);
541 $declaration = new Setup_Backend_Schema_Field_Xml(
543 <name>revisionProps</name>
545 <length>65535</length>
547 $query = $this->_backend->addAddCol($query, 'tree_nodes', $declaration);
548 $this->_backend->execQueryVoid($query);
550 $this->setTableVersion('tree_nodes', 2);
552 $declaration = new Setup_Backend_Schema_Table_Xml('<table>
553 <name>tree_node_acl</name>
560 <notnull>true</notnull>
563 <name>record_id</name>
566 <notnull>true</notnull>
569 <name>account_type</name>
572 <default>user</default>
573 <notnull>true</notnull>
576 <name>account_id</name>
579 <notnull>true</notnull>
582 <name>account_grant</name>
585 <notnull>true</notnull>
589 <name>record_id-account-type-account_id-account_grant</name>
590 <primary>true</primary>
595 <name>record_id</name>
598 <name>account_type</name>
601 <name>account_id</name>
604 <name>account_grant</name>
608 <name>id-account_type-account_id</name>
610 <name>record_id</name>
613 <name>account_type</name>
616 <name>account_id</name>
620 <name>tree_node_acl::record_id--tree_nodes::id</name>
622 <name>record_id</name>
624 <foreign>true</foreign>
626 <table>tree_nodes</table>
628 <ondelete>cascade</ondelete>
633 $this->createTable('tree_node_acl', $declaration);
636 $this->setApplicationVersion('Tinebase', '10.13');
642 * add file revision cleanup task to scheduler
644 public function update_13()
646 $scheduler = Tinebase_Core::getScheduler();
647 Tinebase_Scheduler_Task::addFileRevisionCleanupTask($scheduler);
649 $this->setApplicationVersion('Tinebase', '10.14');
655 * update record_observer
657 public function update_14()
659 $this->dropTable('record_observer', 'Tinebase');
661 $this->createTable('record_observer', new Setup_Backend_Schema_Table_Xml('<table>
662 <name>record_observer</name>
668 <autoincrement>true</autoincrement>
671 <name>observable_model</name>
674 <notnull>true</notnull>
677 <name>observable_identifier</name>
680 <notnull>true</notnull>
683 <name>observer_model</name>
686 <notnull>true</notnull>
689 <name>observer_identifier</name>
692 <notnull>true</notnull>
695 <name>observed_event</name>
698 <notnull>true</notnull>
701 <name>created_by</name>
706 <name>creation_time</name>
707 <type>datetime</type>
708 <notnull>true</notnull>
712 <primary>true</primary>
718 <name>observable-observer-event</name>
719 <unique>true</unique>
721 <name>observable_model</name>
724 <name>observable_identifier</name>
727 <name>observer_model</name>
730 <name>observer_identifier</name>
733 <name>observed_event</name>
737 <name>observer</name>
739 <name>observer_model</name>
742 <name>observer_identifier</name>
746 </table>'), 'Tinebase', 3);
748 $this->setApplicationVersion('Tinebase', '10.15');
754 * add container xprops column
756 public function update_15()
758 if (! $this->_backend->columnExists('xprops', 'container')) {
759 $declaration = new Setup_Backend_Schema_Field_Xml(
763 <notnull>false</notnull>
764 <default>NULL</default>
767 $this->_backend->addCol('container', $declaration);
768 $this->setTableVersion('container', 12);
771 $this->setApplicationVersion('Tinebase', '10.16');
775 * update node acl: find all nodes that have containers, copy acl to node and remove container
777 * TODO allow to call from cli?
779 public function update_16()
781 $this->_addIsDeletedToTreeNodes();
783 // this is needed for filesystem operations
784 $this->_addRevisionPreviewCountCol();
786 $applications = Tinebase_Application::getInstance()->getApplications();
787 $setupUser = Setup_Update_Abstract::getSetupFromConfigOrCreateOnTheFly();
789 Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
791 foreach ($applications as $application) {
792 if ($setupUser && ! $setupUser->hasRight($application, Tinebase_Acl_Rights::RUN)) {
793 if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) {
794 Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__
795 . ' Skipping ' . $application->name . ' because setupuser has no RUN right');
800 $this->_migrateAclForApplication($application, Tinebase_FileSystem::FOLDER_TYPE_PERSONAL);
801 $this->_migrateAclForApplication($application, Tinebase_FileSystem::FOLDER_TYPE_SHARED);
804 $this->setApplicationVersion('Tinebase', '10.17');
808 * @param $application
811 protected function _migrateAclForApplication($application, $type)
813 $path = Tinebase_FileSystem::getInstance()->getApplicationBasePath(
818 $parentNode = Tinebase_FileSystem::getInstance()->stat($path);
819 } catch (Tinebase_Exception_NotFound $tenf) {
823 $childNodes = Tinebase_FileSystem::getInstance()->getTreeNodeChildren($parentNode);
825 if (count($childNodes) === 0) {
826 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
827 . " No container nodes found for application " . $application->name);
831 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
832 . ' ' . count($childNodes) . " nodes found for application " . $application->name);
834 if ($type === Tinebase_FileSystem::FOLDER_TYPE_PERSONAL) {
835 foreach ($childNodes as $accountNode) {
836 $personalNodes = Tinebase_FileSystem::getInstance()->getTreeNodeChildren($accountNode);
837 $this->_moveAclFromContainersToNodes($personalNodes);
841 $this->_moveAclFromContainersToNodes($childNodes);
846 * @param Tinebase_Record_RecordSet $nodes
850 protected function _moveAclFromContainersToNodes(Tinebase_Record_RecordSet $nodes)
852 foreach ($nodes as $node) {
854 $container = Tinebase_Container::getInstance()->getContainerById($node->name);
855 } catch (Tinebase_Exception_NotFound $tenf) {
858 } catch (Tinebase_Exception_InvalidArgument $teia) {
862 //print_r($container->toArray());
863 if ($container->model === 'HumanResources_Model_Employee') {
864 // fix broken HR template container to prevent problems when removing data
865 $container->model = 'Tinebase_Model_Tree_Node';
866 Tinebase_Container::getInstance()->update($container);
869 // set container acl in node
870 $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($container, /* ignore acl */ true);
871 Tinebase_FileSystem::getInstance()->setGrantsForNode($node, $grants);
873 // set container name in node
874 $node->name = $container->name;
875 // check if node exists and if yes: attach uid
876 $parentNode = Tinebase_FileSystem::getInstance()->get($node->parent_id);
877 $parentPath = Tinebase_FileSystem::getInstance()->getPathOfNode($parentNode, true);
878 if (Tinebase_FileSystem::getInstance()->fileExists($parentPath . '/' . $node->name)) {
879 $node->name .= ' ' . Tinebase_Record_Abstract::generateUID(8);
882 $node->acl_node = $node->getId();
883 Tinebase_FileSystem::getInstance()->update($node);
884 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
885 . ' Updated node acl for ' . $node->name .' (container id: ' . $container->getId() . ')');
887 // remove old acl container
888 Tinebase_Container::getInstance()->deleteContainer($container, /* ignore acl */ true);
889 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
890 . ' Removed old container ' . $container->name);
897 * Add fulltext index for description field
899 public function update_17()
901 $declaration = new Setup_Backend_Schema_Index_Xml('
903 <name>description</name>
904 <fulltext>true</fulltext>
906 <name>description</name>
911 $this->_backend->addIndex('tree_fileobjects', $declaration);
913 $this->setTableVersion('tree_fileobjects', '5');
914 $this->setApplicationVersion('Tinebase', '10.18');
920 * Add fulltext search index for tags description
922 public function update_18()
924 $declaration = new Setup_Backend_Schema_Index_Xml('
926 <name>description</name>
927 <fulltext>true</fulltext>
929 <name>description</name>
935 $this->_backend->dropIndex('tags', 'description');
936 } catch (Exception $e) {
937 // Ignore, if there is no index, we can just go on and create one.
940 $this->_backend->addIndex('tags', $declaration);
942 $this->setTableVersion('tags', 8);
943 $this->setApplicationVersion('Tinebase', '10.19');
949 * Make tags description a longtext field
951 public function update_19()
953 $declaration = new Setup_Backend_Schema_Field_Xml('
955 <name>description</name>
957 <length>2147483647</length>
959 <default>NULL</default>
963 $this->_backend->alterCol('tags', $declaration);
965 $this->setTableVersion('tags', 9);
966 $this->setApplicationVersion('Tinebase', '10.20');
972 * add new file system tasks to scheduler
974 public function update_20()
976 $scheduler = Tinebase_Core::getScheduler();
977 Tinebase_Scheduler_Task::addFileSystemSizeRecalculation($scheduler);
978 Tinebase_Scheduler_Task::addFileSystemCheckIndexTask($scheduler);
980 $this->setApplicationVersion('Tinebase', '10.21');
986 * add favorite column to importexport_definition
988 public function update_21()
990 if (! $this->_backend->columnExists('favorite', 'importexport_definition')) {
991 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
992 <name>icon_class</name>
996 $this->_backend->addCol('importexport_definition', $declaration);
998 $declaration = new Setup_Backend_Schema_Field_Xml('
1000 <name>favorite</name>
1001 <type>boolean</type>
1003 $this->_backend->addCol('importexport_definition', $declaration);
1005 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1007 <type>integer</type>
1008 <notnull>true</notnull>
1009 <default>0</default>
1011 $this->_backend->addCol('importexport_definition', $declaration);
1013 $this->setTableVersion('importexport_definition', 9);
1016 $this->setApplicationVersion('Tinebase', '10.22');
1022 * add preview_count column to tree_filerevisions
1024 public function update_22()
1026 $this->_addRevisionPreviewCountCol();
1027 $this->setApplicationVersion('Tinebase', '10.23');
1030 protected function _addRevisionPreviewCountCol()
1032 if (! $this->_backend->columnExists('preview_count', 'tree_filerevisions')) {
1033 $declaration = new Setup_Backend_Schema_Field_Xml(
1035 <name>preview_count</name>
1036 <type>integer</type>
1038 <notnull>true</notnull>
1039 <default>0</default>
1041 $this->_backend->addCol('tree_filerevisions', $declaration);
1042 $this->setTableVersion('tree_filerevisions', 2);
1049 * 0013032: add GRANT_DOWNLOAD
1050 * 0013034: add GRANT_PUBLISH
1052 public function update_23()
1054 $this->_addNotificationProps();
1055 $this->_addIsDeletedToTreeNodes();
1057 // get all folder nodes with own acl
1058 $searchFilter = new Tinebase_Model_Tree_Node_Filter(array(
1061 'operator' => 'equals',
1062 'value' => Tinebase_Model_Tree_FileObject::TYPE_FOLDER
1064 ), Tinebase_Model_Filter_FilterGroup::CONDITION_AND, array('ignoreAcl' => true));
1065 $folders = Tinebase_FileSystem::getInstance()->searchNodes($searchFilter);
1067 foreach ($folders as $folder) {
1068 if ($folder->acl_node === $folder->getId()) {
1069 $grants = Tinebase_FileSystem::getInstance()->getGrantsOfContainer($folder, /* ignoreAcl */ true);
1070 foreach ($grants as $grant) {
1071 // add download & publish for admins and only download for the rest
1072 if ($grant->{Tinebase_Model_Grants::GRANT_ADMIN}) {
1073 $grant->{Tinebase_Model_Grants::GRANT_DOWNLOAD} = true;
1074 $grant->{Tinebase_Model_Grants::GRANT_PUBLISH} = true;
1076 $grant->{Tinebase_Model_Grants::GRANT_DOWNLOAD} = true;
1079 Tinebase_FileSystem::getInstance()->setGrantsForNode($folder, $grants);
1084 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
1085 . ' Added DOWNLOAD & PUBLISH grants to ' . $updateCount . ' folder nodes');
1087 $this->setApplicationVersion('Tinebase', '10.24');
1093 * add notification props
1095 public function update_24()
1097 $this->_addNotificationProps();
1098 $this->setApplicationVersion('Tinebase', '10.25');
1101 protected function _addNotificationProps()
1103 if (! $this->_backend->columnExists('notificationProps', 'tree_nodes')) {
1104 $declaration = new Setup_Backend_Schema_Field_Xml(
1106 <name>notificationProps</name>
1108 <length>65535</length>
1111 $this->_backend->addCol('tree_nodes', $declaration);
1112 $this->setTableVersion('tree_nodes', 3);
1119 * add scope column to importexport_definition
1121 public function update_25()
1123 if (! $this->_backend->columnExists('scope', 'importexport_definition')) {
1124 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1127 <length>255</length>
1129 $this->_backend->addCol('importexport_definition', $declaration);
1131 $this->setTableVersion('importexport_definition', 10);
1134 $this->setApplicationVersion('Tinebase', '10.26');
1140 * change role_accounts id to uuid
1142 public function update_26()
1144 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1149 $this->_backend->alterCol('role_accounts', $declaration);
1151 $this->setTableVersion('role_accounts', 4);
1152 $this->setApplicationVersion('Tinebase', '10.27');
1158 * add scope column to importexport_definition
1160 public function update_27()
1162 if (! $this->_backend->columnExists('format', 'importexport_definition')) {
1163 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1166 <length>255</length>
1168 $this->_backend->addCol('importexport_definition', $declaration);
1170 $this->setTableVersion('importexport_definition', 11);
1173 $this->setApplicationVersion('Tinebase', '10.28');
1179 * add scope column to importexport_definition
1181 public function update_28()
1183 $this->_addIsDeletedToTreeNodes();
1185 foreach (Tinebase_Application::getInstance()->getApplications() as $application) {
1186 Setup_Controller::getInstance()->createImportExportDefinitions($application);
1189 $this->setApplicationVersion('Tinebase', '10.29');
1195 * add scope column to importexport_definition
1197 public function update_29()
1199 $this->_backend->dropIndex('record_observer', 'observable-observer-event');
1201 $this->_backend->alterCol('record_observer', new Setup_Backend_Schema_Field_Xml('<field>
1202 <name>observable_identifier</name>
1205 <notnull>false</notnull>
1208 $this->_backend->addIndex('record_observer', new Setup_Backend_Schema_Index_Xml('<index>
1209 <name>observable-observer-event</name>
1210 <unique>true</unique>
1212 <name>observable_model</name>
1215 <name>observed_event</name>
1218 <name>observable_identifier</name>
1221 <name>observer_model</name>
1224 <name>observer_identifier</name>
1228 $this->setTableVersion('record_observer', 5);
1230 $this->setApplicationVersion('Tinebase', '10.30');
1236 * add is_deleted column to tree nodes
1238 public function update_30()
1240 $this->_addIsDeletedToTreeNodes();
1242 $this->setApplicationVersion('Tinebase', '10.31');
1245 protected function _addIsDeletedToTreeNodes()
1247 if (! $this->_backend->columnExists('is_deleted', 'tree_nodes')) {
1248 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1249 <name>is_deleted</name>
1250 <type>boolean</type>
1251 <default>false</default>
1252 <notnull>true</notnull>
1254 $this->_backend->addCol('tree_nodes', $declaration);
1256 $this->setTableVersion('tree_nodes', 4);
1259 if (! $this->_backend->columnExists('pin_protected', 'tree_nodes')) {
1260 $this->_backend->addCol('tree_nodes', new Setup_Backend_Schema_Field_Xml('<field>
1261 <name>pin_protected</name>
1262 <type>boolean</type>
1263 <default>false</default>
1264 <notnull>true</notnull>
1272 * change container id from int to uuid
1274 public function update_31()
1276 //ATTENTION foreign constraints
1279 $this->_backend->dropForeignKey('container_acl', 'container_acl::container_id--container::id');
1280 } catch (Exception $e) {}
1282 $this->_backend->dropForeignKey('container_content', 'container_content::container_id--container::id');
1283 } catch (Exception $e) {}
1285 if ($this->_backend->tableExists('addressbook')) {
1287 $this->_backend->dropForeignKey('addressbook', 'addressbook::container_id--container::id');
1288 } catch (Exception $e) {}
1290 if ($this->_backend->tableExists('cal_events')) {
1292 $this->_backend->dropForeignKey('cal_events', 'cal_events::container_id--container::id');
1293 } catch (Exception $e) {}
1295 if ($this->_backend->tableExists('cal_resources')) {
1297 $this->_backend->dropForeignKey('cal_resources', 'cal_resources::container_id--container::id');
1298 } catch (Exception $e) {}
1300 if ($this->_backend->tableExists('cal_attendee')) {
1302 $this->_backend->dropForeignKey('cal_attendee', 'cal_attendee::displaycontainer_id--container::id');
1303 } catch (Exception $e) {}
1305 if ($this->_backend->tableExists('metacrm_lead')) {
1307 $this->_backend->dropForeignKey('metacrm_lead', 'metacrm_lead::container_id--container::id');
1308 } catch (Exception $e) {}
1310 if ($this->_backend->tableExists('sales_contracts')) {
1312 $this->_backend->dropForeignKey('sales_contracts', 'sales_contracts::container_id--container::id');
1313 } catch (Exception $e) {}
1315 if ($this->_backend->tableExists('sales_contracts')) {
1317 $this->_backend->dropForeignKey('sales_contracts', 'tine20_erp_contracts::container_id--container::id');
1318 } catch (Exception $e) {}
1320 if ($this->_backend->tableExists('timetracker_timeaccount')) {
1322 $this->_backend->dropForeignKey('timetracker_timeaccount', 'timeaccount::container_id--container::id');
1323 } catch (Exception $e) {}
1326 if (version_compare($this->getApplicationVersion('Tinebase'), '10.32') < 0 ) {
1327 if ($this->getTableVersion('container') < 13) {
1328 $this->_backend->alterCol('container', new Setup_Backend_Schema_Field_Xml('<field>
1332 <notnull>true</notnull>
1334 $this->setTableVersion('container', 13);
1337 if ($this->getTableVersion('container_acl') < 4) {
1338 $this->_backend->alterCol('container_acl', new Setup_Backend_Schema_Field_Xml('<field>
1339 <name>container_id</name>
1342 <notnull>true</notnull>
1344 $this->setTableVersion('container_acl', 4);
1347 if ($this->getTableVersion('container_content') < 3) {
1348 $this->_backend->alterCol('container_content', new Setup_Backend_Schema_Field_Xml('<field>
1349 <name>container_id</name>
1352 <notnull>true</notnull>
1354 $this->setTableVersion('container_content', 3);
1358 if (version_compare($this->getApplicationVersion('Addressbook'), '10.6') < 0 ) {
1359 if ($this->getTableVersion('addressbook') < 25) {
1360 $this->_backend->alterCol('addressbook', new Setup_Backend_Schema_Field_Xml('<field>
1361 <name>container_id</name>
1364 <notnull>false</notnull>
1366 $this->setTableVersion('addressbook', 25);
1369 if ($this->getTableVersion('addressbook_lists') < 6) {
1370 $this->_backend->alterCol('addressbook_lists', new Setup_Backend_Schema_Field_Xml('<field>
1371 <name>container_id</name>
1374 <notnull>false</notnull>
1376 $this->setTableVersion('addressbook_lists', 25);
1379 $this->setApplicationVersion('Addressbook', '10.6');
1382 if (Tinebase_Application::getInstance()->isInstalled('Calendar') &&
1383 version_compare($this->getApplicationVersion('Calendar'), '10.8') < 0 ) {
1384 if ($this->getTableVersion('cal_events') < 14) {
1385 $this->_backend->alterCol('cal_events', new Setup_Backend_Schema_Field_Xml('<field>
1386 <name>container_id</name>
1389 <notnull>false</notnull>
1391 $this->setTableVersion('cal_events', 14);
1394 if ($this->getTableVersion('cal_attendee') < 6) {
1395 $this->_backend->alterCol('cal_attendee', new Setup_Backend_Schema_Field_Xml('<field>
1396 <name>displaycontainer_id</name>
1399 <notnull>false</notnull>
1401 $this->setTableVersion('cal_attendee', 6);
1404 if ($this->getTableVersion('cal_resources') < 6) {
1405 $this->_backend->alterCol('cal_resources', new Setup_Backend_Schema_Field_Xml('<field>
1406 <name>container_id</name>
1409 <notnull>false</notnull>
1411 $this->setTableVersion('cal_resources', 6);
1414 $this->setApplicationVersion('Calendar', '10.8');
1417 if (Tinebase_Application::getInstance()->isInstalled('Crm') &&
1418 version_compare($this->getApplicationVersion('Crm'), '10.2') < 0 ) {
1419 if ($this->getTableVersion('metacrm_lead') < 10) {
1420 $this->_backend->alterCol('metacrm_lead', new Setup_Backend_Schema_Field_Xml('<field>
1421 <name>container_id</name>
1424 <notnull>false</notnull>
1426 $this->setTableVersion('metacrm_lead', 10);
1428 $this->setApplicationVersion('Crm', '10.2');
1431 if (Tinebase_Application::getInstance()->isInstalled('Events') &&
1432 version_compare($this->getApplicationVersion('Events'), '10.2') < 0 ) {
1433 if ($this->getTableVersion('events_event') < 3) {
1434 $this->_backend->alterCol('events_event', new Setup_Backend_Schema_Field_Xml('<field>
1435 <name>container_id</name>
1438 <notnull>false</notnull>
1440 $this->setTableVersion('events_event', 3);
1442 $this->setApplicationVersion('Events', '10.2');
1445 if (Tinebase_Application::getInstance()->isInstalled('Projects') &&
1446 version_compare($this->getApplicationVersion('Projects'), '10.2') < 0 ) {
1447 if ($this->getTableVersion('projects_project') < 4) {
1448 $this->_backend->alterCol('projects_project', new Setup_Backend_Schema_Field_Xml('<field>
1449 <name>container_id</name>
1452 <notnull>false</notnull>
1454 $this->setTableVersion('projects_project', 4);
1456 $this->setApplicationVersion('Projects', '10.2');
1459 if (Tinebase_Application::getInstance()->isInstalled('Sales') &&
1460 version_compare($this->getApplicationVersion('Sales'), '10.9') < 0 ) {
1461 if ($this->getTableVersion('sales_contracts') < 10) {
1462 $this->_backend->alterCol('sales_contracts', new Setup_Backend_Schema_Field_Xml('<field>
1463 <name>container_id</name>
1466 <notnull>true</notnull>
1468 $this->setTableVersion('sales_contracts', 10);
1470 $this->setApplicationVersion('Sales', '10.9');
1473 if (Tinebase_Application::getInstance()->isInstalled('SimpleFAQ') &&
1474 version_compare($this->getApplicationVersion('SimpleFAQ'), '10.1') < 0 ) {
1475 if ($this->getTableVersion('simple_faq') < 3) {
1476 $this->_backend->alterCol('simple_faq', new Setup_Backend_Schema_Field_Xml('<field>
1477 <name>container_id</name>
1480 <notnull>false</notnull>
1482 $this->setTableVersion('simple_faq', 3);
1484 $this->setApplicationVersion('SimpleFAQ', '10.1');
1487 if (Tinebase_Application::getInstance()->isInstalled('Tasks') &&
1488 version_compare($this->getApplicationVersion('Tasks'), '10.2') < 0 ) {
1489 if ($this->getTableVersion('tasks') < 10) {
1490 $this->_backend->alterCol('tasks', new Setup_Backend_Schema_Field_Xml('<field>
1491 <name>container_id</name>
1494 <notnull>false</notnull>
1496 $this->setTableVersion('tasks', 10);
1498 $this->setApplicationVersion('Tasks', '10.2');
1501 if (Tinebase_Application::getInstance()->isInstalled('Timetracker') &&
1502 version_compare($this->getApplicationVersion('Timetracker'), '10.3') < 0 ) {
1503 if ($this->getTableVersion('timetracker_timeaccount') < 12) {
1504 $this->_backend->alterCol('timetracker_timeaccount', new Setup_Backend_Schema_Field_Xml('<field>
1505 <name>container_id</name>
1508 <notnull>false</notnull>
1510 $this->setTableVersion('timetracker_timeaccount', 12);
1512 $this->setApplicationVersion('Timetracker', '10.3');
1515 $this->_backend->addForeignKey('container_content', new Setup_Backend_Schema_Index_Xml('<index>
1516 <name>container_content::container_id--container::id</name>
1518 <name>container_id</name>
1520 <foreign>true</foreign>
1522 <table>container</table>
1524 <ondelete>cascade</ondelete>
1528 $this->_backend->addForeignKey('container_acl', new Setup_Backend_Schema_Index_Xml('<index>
1529 <name>container_acl::container_id--container::id</name>
1531 <name>container_id</name>
1533 <foreign>true</foreign>
1535 <table>container</table>
1537 <ondelete>cascade</ondelete>
1538 <!-- add onupdate? -->
1542 if ($this->_backend->tableExists('timeaccount')) {
1543 $this->_backend->addForeignKey('timeaccount', new Setup_Backend_Schema_Index_Xml('<index>
1544 <name>timeaccount::container_id--container::id</name>
1546 <name>container_id</name>
1548 <foreign>true</foreign>
1550 <table>container</table>
1556 if ($this->_backend->tableExists('sales_contracts')) {
1557 $this->_backend->addForeignKey('sales_contracts', new Setup_Backend_Schema_Index_Xml('<index>
1558 <name>sales_contracts::container_id--container::id</name>
1560 <name>container_id</name>
1562 <foreign>true</foreign>
1564 <table>container</table>
1570 if ($this->_backend->tableExists('metacrm_lead')) {
1571 $this->_backend->addForeignKey('metacrm_lead', new Setup_Backend_Schema_Index_Xml('<index>
1572 <name>metacrm_lead::container_id--container::id</name>
1574 <name>container_id</name>
1576 <foreign>true</foreign>
1578 <table>container</table>
1584 if ($this->_backend->tableExists('cal_resources')) {
1585 $this->_backend->addForeignKey('cal_resources', new Setup_Backend_Schema_Index_Xml('<index>
1586 <name>cal_resources::container_id--container::id</name>
1588 <name>container_id</name>
1590 <foreign>true</foreign>
1592 <table>container</table>
1598 if ($this->_backend->tableExists('cal_events')) {
1599 $this->_backend->addForeignKey('cal_events', new Setup_Backend_Schema_Index_Xml('<index>
1600 <name>cal_events::container_id--container::id</name>
1602 <name>container_id</name>
1604 <foreign>true</foreign>
1606 <table>container</table>
1612 if ($this->_backend->tableExists('cal_attendee')) {
1613 $this->_backend->addForeignKey('cal_attendee', new Setup_Backend_Schema_Index_Xml('<index>
1614 <name>cal_attendee::displaycontainer_id--container::id</name>
1616 <name>displaycontainer_id</name>
1618 <foreign>true</foreign>
1620 <table>container</table>
1626 if ($this->_backend->tableExists('addressbook')) {
1627 $this->_backend->addForeignKey('addressbook', new Setup_Backend_Schema_Index_Xml('<index>
1628 <name>addressbook::container_id--container::id</name>
1630 <name>container_id</name>
1632 <foreign>true</foreign>
1634 <table>container</table>
1640 $this->setApplicationVersion('Tinebase', '10.32');
1646 * change role id from int to uuid
1648 public function update_32()
1651 $this->_backend->dropForeignKey('role_rights', 'role_rights::role_id--roles::id');
1652 } catch (Exception $e) {}
1654 $this->_backend->dropForeignKey('role_accounts', 'role_accounts::role_id--roles::id');
1655 } catch (Exception $e) {}
1657 if ($this->getTableVersion('roles') < 3) {
1658 $this->_backend->alterCol('roles', new Setup_Backend_Schema_Field_Xml('<field>
1662 <notnull>true</notnull>
1664 $this->setTableVersion('roles', 3);
1667 if ($this->getTableVersion('role_rights') < 3) {
1668 $this->_backend->alterCol('role_rights', new Setup_Backend_Schema_Field_Xml('<field>
1672 <notnull>true</notnull>
1675 $this->_backend->alterCol('role_rights', new Setup_Backend_Schema_Field_Xml('<field>
1676 <name>role_id</name>
1679 <notnull>true</notnull>
1681 $this->setTableVersion('role_rights', 3);
1684 if ($this->getTableVersion('role_accounts') < 5) {
1685 $this->_backend->alterCol('role_accounts', new Setup_Backend_Schema_Field_Xml('<field>
1686 <name>role_id</name>
1689 <notnull>true</notnull>
1691 $this->setTableVersion('role_accounts', 5);
1694 if ($this->_backend->tableExists('role_rights')) {
1695 $this->_backend->addForeignKey('role_rights', new Setup_Backend_Schema_Index_Xml('<index>
1696 <name>role_rights::role_id--roles::id</name>
1698 <name>role_id</name>
1700 <foreign>true</foreign>
1702 <table>roles</table>
1704 <ondelete>cascade</ondelete>
1709 if ($this->_backend->tableExists('role_accounts')) {
1710 $this->_backend->addForeignKey('role_accounts', new Setup_Backend_Schema_Index_Xml('<index>
1711 <name>role_accounts::role_id--roles::id</name>
1713 <name>role_id</name>
1715 <foreign>true</foreign>
1717 <table>roles</table>
1719 <ondelete>cascade</ondelete>
1724 $this->setApplicationVersion('Tinebase', '10.33');
1730 * add pin column to accounts
1732 public function update_33()
1734 if (! $this->_backend->columnExists('pin', 'accounts')) {
1735 $declaration = new Setup_Backend_Schema_Field_Xml('<field>
1738 <length>100</length>
1739 <notnull>false</notnull>
1741 $this->_backend->addCol('accounts', $declaration);
1743 $this->setTableVersion('accounts', 12);
1746 $this->setApplicationVersion('Tinebase', '10.34');
1752 * add configuration column to accounts
1754 public function update_34()
1756 if (! $this->_backend->columnExists('configuration', 'accounts')) {
1757 $this->_backend->addCol('accounts', new Setup_Backend_Schema_Field_Xml('<field>
1758 <name>configuration</name>
1760 <length>65535</length>
1762 $this->setTableVersion('accounts', 13);
1764 $this->setApplicationVersion('Tinebase', '10.35');
1770 * add quota column to tree_nodes
1772 public function update_35()
1774 if (! $this->_backend->columnExists('quota', 'tree_nodes')) {
1775 $this->_backend->addCol('tree_nodes', new Setup_Backend_Schema_Field_Xml('<field>
1777 <type>integer</type>
1779 <notnull>false</notnull>
1781 $this->setTableVersion('tree_nodes', 5);
1784 if ($this->getTableVersion('tree_fileobjects') < 6) {
1785 $this->_backend->alterCol('tree_fileobjects', new Setup_Backend_Schema_Field_Xml('<field>
1786 <name>revision_size</name>
1787 <type>integer</type>
1789 <notnull>true</notnull>
1790 <default>0</default>
1792 $this->setTableVersion('tree_fileobjects', 6);
1795 $this->setApplicationVersion('Tinebase', '10.36');
1801 * fix tree_node_acl and container_acl tables re primary / unique keys
1803 public function update_36()
1805 $result = $this->_db->select()->from(SQL_TABLE_PREFIX . 'container_acl')->query(Zend_Db::FETCH_ASSOC);
1806 $quotedId = $this->_db->quoteIdentifier('id');
1807 $quotedContainerId = $this->_db->quoteIdentifier('container_id');
1808 $quotedAccountType = $this->_db->quoteIdentifier('account_type');
1809 $quotedAccountId = $this->_db->quoteIdentifier('account_id');
1810 $quotedAccountGrant = $this->_db->quoteIdentifier('account_grant');
1811 foreach ($result->fetchAll() as $row) {
1812 $this->_db->update(SQL_TABLE_PREFIX . 'container_acl',
1813 array('id' => Tinebase_Record_Abstract::generateUID()),
1814 $quotedId . ' = ' . $this->_db->quote($row['id']) . ' AND ' .
1815 $quotedContainerId . ' = ' . $this->_db->quote($row['container_id']) . ' AND ' .
1816 $quotedAccountType . ' = ' . $this->_db->quote($row['account_type']) . ' AND ' .
1817 $quotedAccountId . ' = ' . $this->_db->quote($row['account_id']) . ' AND ' .
1818 $quotedAccountGrant . ' = ' . $this->_db->quote($row['account_grant'])
1822 $result = $this->_db->select()->from(SQL_TABLE_PREFIX . 'tree_node_acl')->query(Zend_Db::FETCH_ASSOC);
1823 $quotedRecordId = $this->_db->quoteIdentifier('record_id');
1824 foreach ($result->fetchAll() as $row) {
1825 $this->_db->update(SQL_TABLE_PREFIX . 'tree_node_acl',
1826 array('id' => Tinebase_Record_Abstract::generateUID()),
1827 $quotedId . ' = ' . $this->_db->quote($row['id']) . ' AND ' .
1828 $quotedRecordId . ' = ' . $this->_db->quote($row['record_id']) . ' AND ' .
1829 $quotedAccountType . ' = ' . $this->_db->quote($row['account_type']) . ' AND ' .
1830 $quotedAccountId . ' = ' . $this->_db->quote($row['account_id']) . ' AND ' .
1831 $quotedAccountGrant . ' = ' . $this->_db->quote($row['account_grant'])
1835 /** @var Tinebase_Backend_Sql_Command_Interface $command */
1836 $command = Tinebase_Backend_Sql_Command::factory($this->_db);
1837 $quotedC = $this->_db->quoteIdentifier('c');
1838 $stmt = $this->_db->select()->from(SQL_TABLE_PREFIX . 'container_acl', array($command->getAggregate('id'),
1839 new Zend_Db_Expr('count(*) AS ' . $quotedC)))
1840 ->group(array('container_id', 'account_type', 'account_id', 'account_grant'));
1841 if ($this->_db instanceof Zend_Db_Adapter_Pdo_Pgsql) {
1842 $stmt->having('count(*) > 1');
1844 $stmt->having('c > 1');
1846 $result = $stmt->query(Zend_Db::FETCH_NUM);
1847 foreach ($result->fetchAll() as $row) {
1848 $ids = explode(',', ltrim(rtrim($row[0], '}'), '{'));
1850 $this->_db->delete(SQL_TABLE_PREFIX . 'container_acl', $this->_db->quoteInto($quotedId . ' in (?)', $ids));
1853 $stmt = $this->_db->select()->from(SQL_TABLE_PREFIX . 'tree_node_acl', array($command->getAggregate('id'),
1854 new Zend_Db_Expr('count(*) AS '. $quotedC)))
1855 ->group(array('record_id', 'account_type', 'account_id', 'account_grant'));
1856 if ($this->_db instanceof Zend_Db_Adapter_Pdo_Pgsql) {
1857 $stmt->having('count(*) > 1');
1859 $stmt->having('c > 1');
1861 $result = $stmt->query(Zend_Db::FETCH_NUM);
1862 foreach ($result->fetchAll() as $row) {
1863 $ids = explode(',', ltrim(rtrim($row[0], '}'), '{'));
1865 $this->_db->delete(SQL_TABLE_PREFIX . 'tree_node_acl', $this->_db->quoteInto($quotedId . ' in (?)', $ids));
1868 if ($this->getTableVersion('container_acl') < 5) {
1869 $this->_backend->dropPrimaryKey('container_acl');
1870 $this->_backend->addIndex('container_acl', new Setup_Backend_Schema_Index_Xml('<index>
1872 <primary>true</primary>
1878 $this->_backend->addIndex('container_acl', new Setup_Backend_Schema_Index_Xml('<index>
1879 <name>container_id-account_type-account_id-acount_grant</name>
1880 <unique>true</unique>
1882 <name>container_id</name>
1885 <name>account_type</name>
1888 <name>account_id</name>
1891 <name>account_grant</name>
1896 $this->_backend->dropIndex('container_acl', 'id-account_type-account_id');
1897 } catch(Exception $e) {}
1898 $this->setTableVersion('container_acl', 5);
1901 if ($this->getTableVersion('tree_node_acl') < 2) {
1902 $this->_backend->dropPrimaryKey('tree_node_acl');
1903 $this->_backend->addIndex('tree_node_acl', new Setup_Backend_Schema_Index_Xml('<index>
1905 <primary>true</primary>
1911 $this->_backend->addIndex('tree_node_acl', new Setup_Backend_Schema_Index_Xml('<index>
1912 <name>record_id-account-type-account_id-account_grant</name>
1913 <unique>true</unique>
1915 <name>record_id</name>
1918 <name>account_type</name>
1921 <name>account_id</name>
1924 <name>account_grant</name>
1929 $this->_backend->dropIndex('tree_node_acl', 'id-account_type-account_id');
1930 } catch(Exception $e) {}
1931 $this->setTableVersion('tree_node_acl', 2);
1933 $this->setApplicationVersion('Tinebase', '10.37');
1939 * set shared folders acl not if not set
1941 public function update_37()
1943 $this->_addIsDeletedToTreeNodes();
1944 $fileSystem = Tinebase_FileSystem::getInstance();
1945 $inheritPropertyMethod = $this->_getProtectedMethod($fileSystem, '_recursiveInheritPropertyUpdate');
1946 if (Tinebase_Application::getInstance()->isInstalled('Filemanager')) {
1948 $node = $fileSystem->stat('/Filemanager/folders/shared');
1949 if (null === $node->acl_node) {
1950 $fileSystem->setGrantsForNode($node, Tinebase_Model_Grants::getDefaultGrants(array(
1951 Tinebase_Model_Grants::GRANT_DOWNLOAD => true
1953 Tinebase_Model_Grants::GRANT_PUBLISH => true
1955 $inheritPropertyMethod->invoke($fileSystem, $node, 'acl_node', $node->acl_node, null);
1957 } catch(Tinebase_Exception_NotFound $tenf) {}
1959 if (Tinebase_Application::getInstance()->isInstalled('MailFiler')) {
1961 $node = $fileSystem->stat('/MailFiler/folders/shared');
1962 if (null === $node->acl_node) {
1963 $fileSystem->setGrantsForNode($node, Tinebase_Model_Grants::getDefaultGrants(array(
1964 Tinebase_Model_Grants::GRANT_DOWNLOAD => true
1966 Tinebase_Model_Grants::GRANT_PUBLISH => true
1968 $inheritPropertyMethod->invoke($fileSystem, $node, 'acl_node', $node->acl_node, null);
1970 } catch(Tinebase_Exception_NotFound $tenf) {}
1973 $this->setApplicationVersion('Tinebase', '10.38');
1977 * GetProtectedMethod constructor.
1980 * @return ReflectionMethod
1982 protected function _getProtectedMethod($object, $method)
1984 $class = new ReflectionClass($object);
1985 $method = $class->getMethod($method);
1986 $method->setAccessible(true);
1994 * tree_nodes add pin_protected
1996 public function update_38()
1998 if ($this->getTableVersion('tree_nodes') < 6) {
1999 $this->_addIsDeletedToTreeNodes();
2000 $this->setTableVersion('tree_nodes', 6);
2002 $this->setApplicationVersion('Tinebase', '10.39');
2008 * tree_nodes make name column case sensitive
2010 public function update_39()
2012 if ($this->getTableVersion('tree_nodes') < 7) {
2013 if (Tinebase_Core::getDb() instanceof Zend_Db_Adapter_Pdo_Mysql) {
2014 $this->_backend->alterCol('tree_nodes', new Setup_Backend_Schema_Field_Xml('<field>
2017 <length>255</length>
2018 <notnull>true</notnull>
2019 <collation>utf8_bin</collation>
2022 $this->setTableVersion('tree_nodes', 7);
2024 $this->setApplicationVersion('Tinebase', '10.40');
2030 * pgsql - fix bigint issue
2032 public function update_40()
2034 $applications = Tinebase_Application::getInstance()->getApplications();
2035 /** @var Tinebase_Model_Application $application */
2036 foreach ($applications as $application) {
2037 $setupXml = Setup_Controller::getInstance()->getSetupXml($application->name);
2038 foreach ($setupXml->tables->table as $key => $table) {
2039 /** @var SimpleXMLElement $field */
2040 foreach ($table->declaration->field as $field) {
2041 if ($field->type == 'integer' && !empty($field->length) && $field->length > 19) {
2042 $this->_backend->alterCol($table->name, new Setup_Backend_Schema_Field_Xml(
2050 $this->setApplicationVersion('Tinebase', '10.41');