Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / pathologic / pathologic.install
1 <?php
2
3 /**
4  * @file
5  * .install file for Pathologic.
6  */
7
8 /**
9  * Re-enable Pathologic under Drupal 7, preserving settings from Drupal 6.
10  */
11 function pathologic_update_7000($sandbox) {
12   // Make sure {d6_upgrade_filter} exists. It won't exist for people upgrading
13   // from beta versions of the D7 version of Pathologic on native D7 sites (not
14   // upgraded from D6).
15   if (db_table_exists('d6_upgrade_filter')) {
16     // Get all Pathologic data from {d6_upgrade_filter}.
17     $rez = db_select('d6_upgrade_filter', 'dup')
18       ->fields('dup')
19       ->condition('module', 'pathologic')
20       ->execute();
21     while ($instance = $rez->fetchObject()) {
22       // Load the format
23       if ($format = filter_format_load($instance->format)) {
24         // Load filters.
25         $format->filters = [];
26         // Add the filters
27         foreach (filter_list_format($instance->format) as $filter_name => $filter) {
28           $format->filters[$filter_name] = (array)$filter;
29         }
30         // Add Pathologic
31         $format->filters['pathologic'] = [
32           'weight' => $instance->weight,
33           'status' => 1,
34           'settings' => [
35             'absolute' => variable_get('filter_pathologic_absolute_' . $instance->format, TRUE),
36             'local_paths' => variable_get('filter_pathologic_local_paths_' . $instance->format, ''),
37           ],
38         ];
39         // Save the format
40         filter_format_save($format);
41         // Unset old variables
42         variable_del('filter_pathologic_absolute_' . $instance->format);
43         variable_del('filter_pathologic_local_paths_' . $instance->format);
44       }
45     }
46     // Delete Pathologic data from {d6_upgrade_filter}…?
47     // No, maybe we don't want to actually do that…?
48   }
49 }
50
51 /**
52  * Convert obsolete "absolute" setting to modern "protocol_style" setting for
53  * each filter instance.
54  */
55 function pathologic_update_7200(&$sandbox) {
56   foreach (filter_formats() as $format) {
57     // @see http://drupal.org/node/1304930
58     if (empty($format->filters)) {
59       $format->filters = [];
60       // Add the filters
61       foreach (filter_list_format($format->format) as $filter_name => $filter) {
62         $format->filters[$filter_name] = (array)$filter;
63       }
64     }
65     if (isset($format->filters['pathologic'])) {
66       $format->filters['pathologic']['settings']['protocol_style'] = $format->filters['pathologic']['settings']['absolute'] ? 'full' : 'path';
67       unset($format->filters['pathologic']['settings']['absolute']);
68       filter_format_save($format);
69     }
70   }
71 }