| 1 |
<?php
|
| 2 |
// $Id: paging.install,v 1.4 2009/01/17 21:23:15 Gurpartap Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_enable().
|
| 6 |
*/
|
| 7 |
function paging_enable() {
|
| 8 |
drupal_set_message(t('Paging has been installed enabled. [<a href="@url">Goto configuration</a>]', array('@url' => url('admin/settings/paging'))));
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function paging_uninstall() {
|
| 15 |
// Delete all variables starting with "paging" in their name.
|
| 16 |
db_query("DELETE FROM {variable} WHERE name LIKE 'paging%'");
|
| 17 |
db_query("DELETE FROM {filters} WHERE module = 'paging'");
|
| 18 |
}
|
| 19 |
|
| 20 |
/**
|
| 21 |
* Implementation of hook_update_N().
|
| 22 |
*/
|
| 23 |
function paging_update_1() {
|
| 24 |
$ret = array();
|
| 25 |
if (module_exists('search')) {
|
| 26 |
module_invoke('node', 'search', 'reset');
|
| 27 |
module_invoke('node', 'update_index');
|
| 28 |
node_update_shutdown();
|
| 29 |
$status = module_invoke('node', 'search', 'status');
|
| 30 |
$percentage = ((int)min(100, 100 * ($status['total'] - $status['remaining']) / max(1, $status['total']))) . '%';
|
| 31 |
$ret[] = array('success' => TRUE, 'query' => t('!percentage of the site has been indexed.', array('!percentage' => $percentage)));
|
| 32 |
}
|
| 33 |
return $ret;
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Implementation of hook_update_N().
|
| 38 |
*/
|
| 39 |
function paging_update_2() {
|
| 40 |
if (db_result(db_query("
|
| 41 |
SELECT 1 FROM {system}
|
| 42 |
WHERE type = 'module' AND name = 'paging_gsitemap' AND (status = 1 OR schema_version >= 0)
|
| 43 |
"))) {
|
| 44 |
drupal_install_modules(array('paging_xmlsitemap'));
|
| 45 |
}
|
| 46 |
return array();
|
| 47 |
}
|