Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | * $Id$ |
17 | * | |
18 | */ | |
19 | ||
20 | /** | |
21 | * Helpers for managing SQL-backed queue items | |
22 | * | |
23 | * @see CRM_Queue_Queue_Sql | |
24 | */ | |
25 | class CRM_Queue_BAO_QueueItem extends CRM_Queue_DAO_QueueItem { | |
26 | ||
27 | /** | |
fe482240 | 28 | * Ensure that the required SQL table exists. |
6a488035 | 29 | * |
a6c01b45 CW |
30 | * @return bool |
31 | * TRUE if table now exists | |
6a488035 | 32 | */ |
4523a2f5 | 33 | public static function findCreateTable() { |
6a488035 TO |
34 | $checkTableSql = "show tables like 'civicrm_queue_item'"; |
35 | $foundName = CRM_Core_DAO::singleValueQuery($checkTableSql); | |
36 | if ($foundName == 'civicrm_queue_item') { | |
37 | return TRUE; | |
38 | } | |
39 | ||
40 | // civicrm/sql/civicrm_queue_item.mysql | |
41 | $fileName = dirname(__FILE__) . '/../../../sql/civicrm_queue_item.mysql'; | |
42 | ||
43 | $config = CRM_Core_Config::singleton(); | |
44 | CRM_Utils_File::sourceSQLFile($config->dsn, $fileName); | |
45 | ||
46 | // Make sure it succeeded | |
47 | $foundName = CRM_Core_DAO::singleValueQuery($checkTableSql); | |
48 | return ($foundName == 'civicrm_queue_item'); | |
49 | } | |
96025800 | 50 | |
6a488035 | 51 | } |