|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @file |
| 5 | + * This file implements various debugging methods available from drush |
| 6 | + */ |
| 7 | + |
| 8 | +/** |
| 9 | + * Implements hook_drush_command(). |
| 10 | + */ |
| 11 | +function acadreos2web__esdh_drush_command() { |
| 12 | + $items = array(); |
| 13 | + $items['acadre-case-docs'] = array( |
| 14 | + 'description' => 'Look up a case in the CM system, and list the included dokuments', |
| 15 | + 'arguments' => array( |
| 16 | + 'caseid' => 'The id of the case. Either the year/serial (ie. 11/4949) notation og the database case id', |
| 17 | + ), |
| 18 | + 'aliases' => array('esdh-cm-docs'), |
| 19 | + ); |
| 20 | + $items['acadre-case'] = array( |
| 21 | + 'description' => 'Look up a case in the CM system, and list the included dokuments', |
| 22 | + 'arguments' => array( |
| 23 | + 'caseid' => 'The id of the case. Either the year/serial (ie. 11/4949) notation og the database case id', |
| 24 | + ), |
| 25 | + 'aliases' => array('esdh-cm-case'), |
| 26 | + ); |
| 27 | + $items['acadre-doc'] = array( |
| 28 | + 'description' => 'Look up a document in the CM system, and list the included dokuments', |
| 29 | + 'arguments' => array( |
| 30 | + 'docid' => 'The id of the document. Either the serial/year (ie. 4949/11) notation og the database case id', |
| 31 | + ), |
| 32 | + 'aliases' => array('esdh-cm-doc'), |
| 33 | + ); |
| 34 | + $items['acadre-case-docs-load'] = array( |
| 35 | + 'description' => 'Look up a case in the CM system, and load the included dokuments', |
| 36 | + 'arguments' => array( |
| 37 | + 'caseid' => 'The id of the case. Either the year/serial (ie. 11/4949) notation og the database case id', |
| 38 | + ), |
| 39 | + 'aliases' => array('esdh-cm-docs-load'), |
| 40 | + ); |
| 41 | + $items['acadre-cm-status'] = array( |
| 42 | + 'description' => 'Check the status of the required webservices for CM', |
| 43 | + 'arguments' => array(), |
| 44 | + 'aliases' => array('esdh-st'), |
| 45 | + ); |
| 46 | + $items['acadre-addenum-fix'] = array( |
| 47 | + 'description' => 'Reorders addenums', |
| 48 | + 'arguments' => array(), |
| 49 | + 'aliases' => array('esdh-af'), |
| 50 | + ); |
| 51 | + return $items; |
| 52 | +} |
| 53 | + |
| 54 | +/** |
| 55 | + * Implements drush_COMMAND(). |
| 56 | + */ |
| 57 | +function drush_os2web_acadre_esdh_acadre_doc($docid = NULL) { |
| 58 | + if (os2web_esdh_provider_has_api('cm')) { |
| 59 | + drush_log('API load', 'ok'); |
| 60 | + $data = os2web_esdh_provider_invoke('cm', 'get_document', $docid); |
| 61 | + if ($data === FALSE) { |
| 62 | + drush_log('Document lookup..', 'fail'); |
| 63 | + } |
| 64 | + else { |
| 65 | + drush_log('Document lookup..', 'ok'); |
| 66 | + error_log(print_r($data, 1)); |
| 67 | + } |
| 68 | + } |
| 69 | + else { |
| 70 | + drush_log('Api load', 'fail'); |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +/** |
| 75 | + * Implements drush_COMMAND(). |
| 76 | + */ |
| 77 | +function drush_os2web_acadre_esdh_acadre_case($caseid = NULL) { |
| 78 | + if (os2web_esdh_provider_has_api('cm')) { |
| 79 | + $data = os2web_esdh_provider_invoke('cm', 'get_case_data', $caseid); |
| 80 | + drush_log('API load', 'ok'); |
| 81 | + if ($data === FALSE) { |
| 82 | + drush_log('Case lookup..', 'fail'); |
| 83 | + } |
| 84 | + else { |
| 85 | + drush_log('Case lookup..', 'ok'); |
| 86 | + error_log(print_r($data, 1)); |
| 87 | + } |
| 88 | + } |
| 89 | + else { |
| 90 | + drush_log('Api load', 'fail'); |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | +/** |
| 95 | + * Implements drush_COMMAND(). |
| 96 | + */ |
| 97 | +function drush_os2web_acadre_esdh_acadre_case_docs($caseid = NULL) { |
| 98 | + if (os2web_esdh_provider_has_api('cm')) { |
| 99 | + drush_log('API load', 'ok'); |
| 100 | + $data = os2web_esdh_provider_invoke('cm', 'get_case_docs', $caseid); |
| 101 | + if ($data === FALSE) { |
| 102 | + drush_log('Case lookup..', 'fail'); |
| 103 | + } |
| 104 | + else { |
| 105 | + drush_log('Case lookup..', 'ok'); |
| 106 | + error_log(print_r($data, 1)); |
| 107 | + } |
| 108 | + } |
| 109 | + else { |
| 110 | + drush_log('Api load', 'fail'); |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +/** |
| 115 | + * Implements drush_COMMAND(). |
| 116 | + */ |
| 117 | +function drush_os2web_acadre_esdh_acadre_case_docs_load($caseid = NULL) { |
| 118 | + if (os2web_esdh_provider_has_api('cm')) { |
| 119 | + drush_log('API load', 'ok'); |
| 120 | + $data = os2web_esdh_provider_invoke('cm', 'get_case_docs', $caseid); |
| 121 | + if ($data === FALSE) { |
| 122 | + drush_log('Case lookup..', 'fail'); |
| 123 | + } |
| 124 | + else { |
| 125 | + drush_log('Case lookup..', 'ok'); |
| 126 | + $docs = array(); |
| 127 | + foreach ($data as $doc) { |
| 128 | + $docs[] = os2web_esdh_provider_invoke('cm', 'get_document', $doc); |
| 129 | + } |
| 130 | + error_log(print_r($docs, 1)); |
| 131 | + } |
| 132 | + } |
| 133 | + else { |
| 134 | + drush_log('Api load', 'fail'); |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +/** |
| 139 | + * Implements drush_COMMAND(). |
| 140 | + */ |
| 141 | +function drush_os2web_acadre_esdh_acadre_cm_status() { |
| 142 | + if (os2web_esdh_provider_has_api('cm')) { |
| 143 | + drush_log('API load', 'ok'); |
| 144 | + $avail = os2web_esdh_provider_invoke('cm', 'available'); |
| 145 | + drush_log('CM availability check..', $avail ? 'ok' : 'error'); |
| 146 | + $avail = os2web_esdh_provider_invoke('cm', 'available'); |
| 147 | + drush_log('CM availability check..', $avail ? 'ok' : 'error'); |
| 148 | + } |
| 149 | +} |
| 150 | + |
| 151 | +/** |
| 152 | + * Implements drush_COMMAND(). |
| 153 | + */ |
| 154 | +function drush_os2web_acadre_esdh_acadre_addenum_fix() { |
| 155 | + if (os2web_esdh_provider_has_api('mm')) { |
| 156 | + if (os2web_esdh_provider_supports('mm', 'post_import_process')) { |
| 157 | + os2web_esdh_provider_invoke('mm', 'post_import_process'); |
| 158 | + } |
| 159 | + } |
| 160 | +} |
0 commit comments