Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Ticket Merge Upgrade Patch
This patch modifies the upgrader for ticket merges to add a new table, thread_entry_merge that will store data for thread entries related to ticket merges. This modification improves the upgrade process.
- Loading branch information
Showing
with
130 additions
and 30 deletions.
- +1 −0 bootstrap.php
- +3 −2 include/class.export.php
- +39 −11 include/class.thread.php
- +5 −4 include/client/templates/thread-entries.tmpl.php
- +6 −4 include/staff/templates/thread-entries.tmpl.php
- +1 −1 include/staff/templates/thread-entry.tmpl.php
- +1 −1 include/upgrader/streams/core.sig
- +22 −0 include/upgrader/streams/core/87d4a323-4bd47d94.patch.sql
- +32 −0 include/upgrader/streams/core/87d4a323-4bd47d94.task.php
- +11 −7 include/upgrader/streams/core/8b923d61-9b5550da.patch.sql
- +9 −0 setup/inc/streams/core/install-mysql.sql
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1 +1 @@ | ||
4bd47d94b10bd8a6bab35c119dadf41f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,22 @@ | ||
/** | ||
* @signature 4bd47d94b10bd8a6bab35c119dadf41f | ||
* @version v1.14.0 | ||
* @title Ticket Merge Patch | ||
* | ||
* This patch adds a new table, thread_entry_merge, to helpdesks if they | ||
* have the field 'extra' in their thread_entry table | ||
* | ||
*/ | ||
-- Create a new table for merge data | ||
CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%thread_entry_merge` ( | ||
`id` int(11) unsigned NOT NULL auto_increment, | ||
`thread_entry_id` int(11) unsigned NOT NULL, | ||
`data` text, | ||
PRIMARY KEY (`id`), | ||
KEY `thread_entry_id` (`thread_entry_id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
||
-- Finished with patch | ||
UPDATE `%TABLE_PREFIX%config` | ||
SET `value` = '4bd47d94b10bd8a6bab35c119dadf41f', `updated` = NOW() | ||
WHERE `key` = 'schema_signature' AND `namespace` = 'core'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* Populates thread_entry_merge for helpdesks if they | ||
* have the field 'extra' in their thread_entry table | ||
*/ | ||
|
||
class PopulateThreadEntryMerge extends MigrationTask { | ||
var $description = "Populates thread_entry_merge"; | ||
|
||
function run($max_time) { | ||
$sql = sprintf('SHOW COLUMNS FROM %s LIKE %s;', THREAD_ENTRY_TABLE, '\'extra\''); | ||
$res = db_query($sql); | ||
if ($res && $res->num_rows > 0) { | ||
$extras = ThreadEntry::objects() | ||
->filter(array('extra__isnull' => false)) | ||
->values_flat('id', 'extra'); | ||
foreach ($extras as $row) { | ||
list($id, $extra) = $row; | ||
$mergeInfo = new ThreadEntryMergeInfo(array( | ||
'thread_entry_id' => $id, | ||
'data' => $extra, | ||
)); | ||
$mergeInfo->save(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return 'PopulateThreadEntryMerge'; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters