Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/panels_mini/panels_mini.install | ||
---|---|---|
114 | 114 |
$deltas[] = $panel_mini->pid; |
115 | 115 |
} |
116 | 116 |
|
117 |
if ($deltas) { |
|
117 |
if (db_table_exists('block') && $deltas) {
|
|
118 | 118 |
// Delete all configured blocks. |
119 | 119 |
db_delete('block') |
120 | 120 |
->condition('module', 'panels_mini') |
... | ... | |
122 | 122 |
->execute(); |
123 | 123 |
} |
124 | 124 |
} |
125 |
|
|
126 |
/** |
|
127 |
* Implements hook_update_dependencies(). |
|
128 |
*/ |
|
129 |
function panels_mini_update_dependencies() { |
|
130 |
// Update 7301 requires panels storage support |
|
131 |
$dependencies['panels_mini'][7301] = array( |
|
132 |
'panels' => 7305, |
|
133 |
); |
|
134 |
|
|
135 |
return $dependencies; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Set the storage type and id on existing mini panels. |
|
140 |
*/ |
|
141 |
function panels_mini_update_7301() { |
|
142 |
if (!isset($sandbox['progress'])) { |
|
143 |
// Initialize batch update information. |
|
144 |
$sandbox['progress'] = (float)0; |
|
145 |
$sandbox['current_did'] = -1; |
|
146 |
$sandbox['max'] = db_query("SELECT COUNT(pd.did) |
|
147 |
FROM {panels_display} pd |
|
148 |
JOIN {panels_mini} pm ON pm.did = pd.did |
|
149 |
WHERE pd.storage_type = ''")->fetchField(); |
|
150 |
} |
|
151 |
|
|
152 |
// Set a limit of how many rows to process per batch. |
|
153 |
$limit = 1000; |
|
154 |
|
|
155 |
// Run the query |
|
156 |
$result = db_query_range("SELECT pd.did, pm.name |
|
157 |
FROM {panels_display} pd |
|
158 |
JOIN {panels_mini} pm ON pm.did = pd.did |
|
159 |
WHERE pd.storage_type = '' AND pd.did > :current_did", 0, $limit, array(':current_did' => $sandbox['current_did'])); |
|
160 |
|
|
161 |
foreach ($result as $row) { |
|
162 |
db_update('panels_display') |
|
163 |
->fields(array( |
|
164 |
'storage_type' => 'panels_mini', |
|
165 |
'storage_id' => $row->name, |
|
166 |
)) |
|
167 |
->condition('did', $row->did) |
|
168 |
->execute(); |
|
169 |
|
|
170 |
// Update our progress information. |
|
171 |
$sandbox['progress']++; |
|
172 |
$sandbox['current_did'] = $row->did; |
|
173 |
} |
|
174 |
|
|
175 |
// Set the "finished" status, to tell batch engine whether this function |
|
176 |
// needs to run again. |
|
177 |
$sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']); |
|
178 |
|
|
179 |
if ($sandbox['#finished']) { |
|
180 |
return t('Added the storage type for panels_mini to relevant panels displays'); |
|
181 |
} |
|
182 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules