url_alter.install in URL alter 6
Install and uninstall schema and functions for the url_alter module.
File
url_alter.installView source
<?php
/**
* @file
* Install and uninstall schema and functions for the url_alter module.
*/
/**
* Implementation of hook_install().
*/
function url_alter_install() {
// Set this module's weight really, really low so we have the first stab at
// implementing the custom_url_rewrite functions.
db_query("UPDATE {system} SET weight = -1000 WHERE type = 'module' AND name = 'url_alter'");
}
/**
* Implementation of hook_uninstall().
*/
function url_alter_uninstall() {
// Remove variables.
variable_del('url_alter_inbound');
variable_del('url_alter_outbound');
}
/**
* Implementation of hook_requirements().
*/
function url_alter_requirements($phase) {
$requirements = array();
$t = get_t();
drupal_load('module', 'url_alter');
foreach (array(
'custom_url_rewrite_inbound',
'custom_url_rewrite_outbound',
) as $function) {
$requirement = array(
'title' => $t('URL alter'),
);
if (defined('URL_ALTER_' . strtoupper($function))) {
$requirement['value'] = $t('Overriding @function() successfully.', array(
'@function' => $function,
));
}
elseif (!url_alter_is_disabled()) {
$requirement['value'] = $t('Cannot override @function().', array(
'@function' => $function,
));
$requirement['severity'] = REQUIREMENT_ERROR;
$info = url_alter_get_function_info($function);
$requirement['description'] = $t("URL alter cannot override the function @function() because it is already defined (!location). Please comment out or remove the existing function and copy the function's body code into the <a href=\"@url-alter\">URL alter module's settings</a>.", array(
'@function' => $function,
'!location' => $info->location ? $info->location : t("usually located in your site's settings.php file"),
'@url-alter' => url('admin/settings/url-alter'),
));
}
$requirements['url_alter_' . $function] = $requirement;
}
return $requirements;
}
function url_alter_check_status() {
$requirements = url_alter_requirements('runtime');
$severity = drupal_requirements_severity($requirements);
return $severity == REQUIREMENT_ERROR;
}
/**
* @defgroup updates-6.x-extra Extra system updates for 6.x
* @{
*/
/**
* Set an even lower module weight to make sure we are included first.
*/
function url_alter_update_6000() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = -1000 WHERE type = 'module' AND name = 'url_alter'");
return $ret;
}
/**
* @} End of "defgroup updates-6.x-extra"
* The next series of updates should start at 7000.
*/
Functions
Name | Description |
---|---|
url_alter_check_status | |
url_alter_install | Implementation of hook_install(). |
url_alter_requirements | Implementation of hook_requirements(). |
url_alter_uninstall | Implementation of hook_uninstall(). |
url_alter_update_6000 | Set an even lower module weight to make sure we are included first. |