Index: ../xmlsitemap/xmlsitemap.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap.info --- ../xmlsitemap/xmlsitemap.info 9 Nov 2007 17:56:04 -0000 1.1 +++ ../xmlsitemap/xmlsitemap.info 9 Mar 2008 16:51:10 -0000 @@ -2,4 +2,5 @@ name = XML Sitemap description = Creates an XML site map in accordance with the sitemaps.org specification. package = XML Sitemap - +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.install,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap.install --- ../xmlsitemap/xmlsitemap.install 11 Dec 2007 22:57:45 -0000 1.4 +++ ../xmlsitemap/xmlsitemap.install 9 Mar 2008 16:51:10 -0000 @@ -2,33 +2,74 @@ // $Id: xmlsitemap.install,v 1.4 2007/12/11 22:57:45 darrenoh Exp $ /** + * Implementation of hook_schema(). + */ +function xmlsitemap_schema() { + $schema['xmlsitemap_additional'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'path' => array( + 'description' => t('The path of this node.'), + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('path'), + ); + + return $schema; +} + +/** * Implementation of hook_install(). */ function xmlsitemap_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_additional} ( - path varchar(128) NOT NULL default '', - pid int, - last_changed int(11), - previously_changed int(11), - priority float, - PRIMARY KEY (path) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_additional} ( - path varchar(128) NOT NULL default '', - pid integer, - last_changed integer, - previously_changed integer, - priority real, - PRIMARY KEY (path) - );"); - break; - } + // Create my tables. db_query("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'"); + drupal_install_schema('xmlsitemap'); +} + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_uninstall() { + // Drop my tables. + $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'"); + while ($variable = db_fetch_object($settings)) { + variable_del($variable->name); + } + drupal_uninstall_schema('xmlsitemap'); } /** @@ -66,15 +107,3 @@ function xmlsitemap_disable() { rmdir($path); } } - -/** - * Implementation of hook_uninstall(). - */ -function xmlsitemap_uninstall() { - db_query("DROP TABLE {xmlsitemap_additional}"); - $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'"); - while ($variable = db_fetch_object($settings)) { - variable_del($variable->name); - } -} - Index: ../xmlsitemap/xmlsitemap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap.module,v retrieving revision 1.16 diff -u -p -r1.16 xmlsitemap.module --- ../xmlsitemap/xmlsitemap.module 18 Dec 2007 22:54:51 -0000 1.16 +++ ../xmlsitemap/xmlsitemap.module 9 Mar 2008 16:51:10 -0000 @@ -8,79 +8,70 @@ /** * Implementation of hook_help(). */ -function xmlsitemap_help($section) { - switch ($section) { +function xmlsitemap_help($path, $arg) { + switch ($path) { case 'admin/settings/xmlsitemap': case 'admin/settings/xmlsitemap/settings': return t('Configure the site map. Your site map is at !url.', array('!url' => ''. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE) .'')); case 'admin/settings/xmlsitemap/engines': - return t('Configure behavior for search engines.'); + return 'Configure behavior for search engines.'; case 'admin/settings/xmlsitemap/additional': - return t('Set up additional links for your site map.'); + return 'Set up additional links for your site map.'; } } /** * Implementation of hook_menu(). */ -function xmlsitemap_menu($may_cache) { +function xmlsitemap_menu() { $items = array(); - $access_config = user_access('administer site configuration'); - $access_content = user_access('access content'); - if ($may_cache) { - $items[] = array( - 'path' => 'admin/settings/xmlsitemap', - 'title' => t('XML Sitemap'), - 'description' => t('Configure site map.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_sitemap'), - 'access' => $access_config, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/settings', - 'title' => t('Site map'), - 'description' => t('Configure site map.'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -1, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/engines', - 'title' => t('Search engines'), - 'description' => t('Configure search engines.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_engines'), - 'type' => MENU_LOCAL_TASK, - ); - $items[] = array( - 'path' => 'admin/settings/xmlsitemap/additional', - 'title' => t('Additional'), - 'description' => t('Configure additional links.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('xmlsitemap_settings_additional'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 1, - ); - $items[] = array( - 'path' => 'sitemap.xml', - 'title' => t('Site map index'), - 'callback' => '_xmlsitemap_output', + $access_config = array('administer site configuration'); + $access_content = array('access content'); + $items['admin/settings/xmlsitemap'] = array( + 'title' => 'XML Sitemap', + 'description' => 'Configure site map.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_sitemap'), + 'access arguments' => $access_config, + ); + $items['admin/settings/xmlsitemap/settings'] = array( + 'title' => 'Site map', + 'description' => 'Configure site map.', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -1, + ); + $items['admin/settings/xmlsitemap/engines'] = array( + 'title' => 'Search engines', + 'description' => 'Configure search engines.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_engines'), + 'type' => MENU_LOCAL_TASK, + ); + $items['admin/settings/xmlsitemap/additional'] = array( + 'title' => 'Additional', + 'description' => 'Configure additional links.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('xmlsitemap_settings_additional'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 1, + ); + $items['sitemap.xml'] = array( + 'title' => 'Site map index', + 'page callback' => '_xmlsitemap_output', + 'type' => MENU_CALLBACK, + 'access arguments' => $access_content + ); + $chunk_count = variable_get('xmlsitemap_chunk_count', 0); + for ($chunk = 0; $chunk < $chunk_count; ++$chunk) { + $items["sitemap$chunk.xml"] = array( + 'title' => 'Site map !number', array('!number' => $chunk), + 'page callback' => '_xmlsitemap_output', + 'page arguments' => array($chunk), 'type' => MENU_CALLBACK, - 'access' => $access_content, + 'access arguments' => $access_content ); } - else { - $chunk_count = variable_get('xmlsitemap_chunk_count', 0); - for ($chunk = 0; $chunk < $chunk_count; ++$chunk) { - $items[] = array( - 'path' => "sitemap$chunk.xml", - 'title' => t('Site map !number', array('!number' => $chunk)), - 'callback' => '_xmlsitemap_output', - 'callback arguments' => array($chunk), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - } + return $items; } @@ -90,20 +81,18 @@ function xmlsitemap_menu($may_cache) { function xmlsitemap_settings_sitemap() { $form['xmlsitemap_chunk_size'] = array( '#type' => 'textfield', - '#title' => t('Chunk size'), + '#title' => 'Chunk size', '#default_value' => variable_get('xmlsitemap_chunk_size', 50000), '#size' => 10, '#maxlength' => 5, '#description' => t('This is the number of links to include in one site map. Values can range between 1 and 50,000. If the total number of links exceeds the chunk size, multiple site maps will be generated.'), - '#weight' => -1, ); $form['xmlsitemap_front_page_priority'] = array( '#type' => 'select', - '#title' => t('Front page priority'), + '#title' => 'Front page priority', '#default_value' => variable_get('xmlsitemap_front_page_priority', 1), '#options' => xmlsitemap_priority_options(), - '#description' => t('This is the absolute priority for the front page.'), - '#weight' => -1, + '#description' => 'This is the absolute priority for the front page.', ); return system_settings_form($form); } @@ -111,8 +100,8 @@ function xmlsitemap_settings_sitemap() { /** * Validate site map settings form. */ -function xmlsitemap_settings_sitemap_validate($form_id, $form_values) { - if ($form_values['xmlsitemap_chunk_size'] > 50000) { +function xmlsitemap_settings_sitemap_validate($form, &$form_state) { + if ($form_state['values']['xmlsitemap_chunk_size'] > 50000) { form_set_error('xmlsitemap_chunk_size', t('Cannot send more than 50,000 links at one time.')); } } @@ -120,8 +109,8 @@ function xmlsitemap_settings_sitemap_val /** * Submit site map settings form. */ -function xmlsitemap_settings_sitemap_submit($form_id, $form_values) { - system_settings_form_submit($form_id, $form_values); +function xmlsitemap_settings_sitemap_submit($form, &$form_state) { + system_settings_form_submit($form, $form_state['values']); xmlsitemap_update_sitemap(); } @@ -131,25 +120,25 @@ function xmlsitemap_settings_sitemap_sub function xmlsitemap_settings_engines() { $form['submission'] = array( '#type' => 'fieldset', - '#title' => t('Submission settings'), + '#title' => 'Submission settings', ); $form['submission']['xmlsitemap_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map when updated.'), + '#title' => 'Submit site map when updated.', '#default_value' => variable_get('xmlsitemap_submit', FALSE), - '#description' => t('If enabled, search engines will be notified of changes to the site map each time it is updated.'), + '#description' => 'If enabled, search engines will be notified of changes to the site map each time it is updated.', ); $form['submission']['xmlsitemap_cron_submit'] = array( '#type' => 'checkbox', - '#title' => t('Submit site map on cron run.'), + '#title' => 'Submit site map on cron run.', '#default_value' => variable_get('xmlsitemap_cron_submit', FALSE), - '#description' => t('If enabled, search engines will be notified of changes to the site map each time cron is run.'), + '#description' => 'If enabled, search engines will be notified of changes to the site map each time cron is run.', ); $form['submission']['xmlsitemap_log_access'] = array( '#type' => 'checkbox', - '#title' => t('Log access.'), + '#title' => 'Log access.', '#default_value' => variable_get('xmlsitemap_log_access', FALSE), - '#description' => t('If enabled, a watchdog entry will be made each time the site map is accessed, containing information about the requestor.'), + '#description' => 'If enabled, a watchdog entry will be made each time the site map is accessed, containing information about the requestor.', ); $form = array_merge($form, module_invoke_all('xmlsitemap_engines', 'form')); menu_rebuild(); @@ -159,12 +148,12 @@ function xmlsitemap_settings_engines() { /** * Submit search engine settings form. */ -function xmlsitemap_settings_engines_submit($form_id, $form_values) { - if ($form_values['xmlsitemap_root']) { - $form_values['xmlsitemap_submit'] = FALSE; - $form_values['xmlsitemap_log_access'] = FALSE; +function xmlsitemap_settings_engines_submit($form, &$form_state) { + if ($form_state['values']['xmlsitemap_root']) { + $form_state['values']['xmlsitemap_submit'] = FALSE; + $form_state['values']['xmlsitemap_log_access'] = FALSE; } - system_settings_form_submit($form_id, $form_values); + system_settings_form_submit($form, $form_state); } /** @@ -173,10 +162,10 @@ function xmlsitemap_settings_engines_sub function xmlsitemap_settings_additional() { $form['xmlsitemap_additional_links_priority'] = array( '#type' => 'select', - '#title' => t('Link priority'), + '#title' => 'Link priority', '#default_value' => variable_get('xmlsitemap_additional_links_priority', 0.1), '#options' => xmlsitemap_priority_options(), - '#description' => t('This is the default priority for additional links.'), + '#description' => 'This is the default priority for additional links.', ); $form['delete']['#tree'] = TRUE; $form['path']['#tree'] = TRUE; @@ -184,7 +173,7 @@ function xmlsitemap_settings_additional( $form['link']['new'] = array( '#type' => 'textfield', '#size' => 40, - '#description' => t('Enter a Drupal path to add to the site map.'), + '#description' => 'Enter a Drupal path to add to the site map.', '#attributes' => array('tabindex' => 1), ); $form['old_priority']['#tree'] = TRUE; @@ -210,13 +199,23 @@ function xmlsitemap_settings_additional( } /** + * Implementation of hook_theme(). + */ +function xmlsitemap_theme() { + return array( + 'xmlsitemap_settings_additional' => array( + ), + ); +} + +/** * Theme additional links form. * @ingroup themeable */ function theme_xmlsitemap_settings_additional($form) { $output = ''; $output .= drupal_render($form['xmlsitemap_additional_links_priority']); - $header = array(t('Delete'), t('Path'), t('Priority')); + $header = array('Delete', 'Path', 'Priority'); foreach (element_children($form['link']) as $id) { $row = array(); $row[] = isset($form['delete'][$id]) ? drupal_render($form['delete'][$id]) : array_merge(array('header' => TRUE, 'valign' => 'bottom'), theme('table_select_header_cell')); @@ -232,56 +231,57 @@ function theme_xmlsitemap_settings_addit return $output; } + /** * Submit additional links form. */ -function xmlsitemap_settings_additional_submit($form_id, $form_values) { +function xmlsitemap_settings_additional_submit($form, &$form_state) { $update = FALSE; - if ($form_values['op'] == t('Save configuration')) { - if ($form_values['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) { + if ($form_state['values']['op'] == t('Save configuration')) { + if ($form_state['values']['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) { $update = TRUE; } - if (!empty($form_values['delete'])) { - foreach ($form_values['delete'] as $id => $delete) { - if ($delete || $form_values['path'][$id] == trim($form_values['link']['new'])) { - db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_values['path'][$id]); - unset($form_values['priority'][$id]); + if (!empty($form_state['values']['delete'])) { + foreach ($form_state['values']['delete'] as $id => $delete) { + if ($delete || $form_state['values']['path'][$id] == trim($form_state['values']['link']['new'])) { + db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_state['values']['path'][$id]); + unset($form_state['values']['priority'][$id]); $update = TRUE; } } - unset($form_values['delete']); + unset($form_state['values']['delete']); } - $path = trim($form_values['link']['new']); + $path = trim($form_state['values']['link']['new']); $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $path)); if (!empty($path)) { db_query(" INSERT INTO {xmlsitemap_additional} (path, pid, last_changed, priority) VALUES ('%s', %s, %d, %s) - ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_values['priority']['new']); - unset($form_values['link'], $form_values['priority']['new']); + ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_state['values']['priority']['new']); + unset($form_state['values']['link'], $form_state['values']['priority']['new']); $update = TRUE; } - if (!empty($form_values['priority'])) { - foreach ($form_values['priority'] as $id => $priority) { - if ($priority != $form_values['old_priority'][$id]) { - $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_values['path'][$id])); + if (!empty($form_state['values']['priority'])) { + foreach ($form_state['values']['priority'] as $id => $priority) { + if ($priority != $form_state['values']['old_priority'][$id]) { + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_state['values']['path'][$id])); db_query(" UPDATE {xmlsitemap_additional} SET pid = %s, previously_changed = last_changed, last_changed = %d, priority = %s WHERE path = '%s' - ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_values['path'][$id]); + ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_state['values']['path'][$id]); $update = TRUE; } } - unset($form_values['path'], $form_values['priority'], $form_values['old_priority']); + unset($form_state['values']['path'], $form_state['values']['priority'], $form_state['values']['old_priority']); } } elseif (variable_get('xmlsitemap_additional_links_priority', 0.1) != 0.1) { - if (in_array('NULL', $form_values['old_priority'])) { + if (in_array('NULL', $form_state['values']['old_priority'])) { $update = TRUE; } - unset($form_values['delete'], $form_values['path'], $form_values['link'], $form_values['old_priority'], $form_values['priority']); + unset($form_state['values']['delete'], $form_state['values']['path'], $form_state['values']['link'], $form_state['values']['old_priority'], $form_state['values']['priority']); } - system_settings_form_submit($form_id, $form_values); + system_settings_form_submit($form, $form_state); if ($update) { xmlsitemap_update_sitemap(); } @@ -340,7 +340,7 @@ function _xmlsitemap_output($chunk = NUL $dest .= '/sitemap.xml.gz'; $link_count = _xmlsitemap_link_count(); $chunk_size = variable_get('xmlsitemap_chunk_size', 50000); - $type = $link_count > $chunk_size ? t('Site map index') : t('Site map'); + $type = $link_count > $chunk_size ? 'Site map index' : 'Site map'; } $status = TRUE; if (!file_exists($dest) || variable_get('xmlsitemap_update', FALSE)) { @@ -360,7 +360,7 @@ function _xmlsitemap_output($chunk = NUL $message = isset($message) ? $message : t('!sitemap downloaded by @user-agent at @address.', array( '!sitemap' => $type, '@user-agent' => $_SERVER['HTTP_USER_AGENT'], - '@address' => $_SERVER['REMOTE_ADDR'], + '@address' => ip_address(), )); watchdog('xmlsitemap', $message); } @@ -418,7 +418,7 @@ function _xmlsitemap_update_cache($page variable_set('xmlsitemap_chunk_count', $chunk); variable_set('xmlsitemap_update', FALSE); if (!$status) { - drupal_set_message(t('Unable to load site map. Make sure that there is an xmlsitemap directory in your files directory and that it is writable by Drupal.'), 'error'); + drupal_set_message('Unable to load site map. Make sure that there is an xmlsitemap directory in your files directory and that it is writable by Drupal.', 'error'); } $user = $current_user; return $status; @@ -706,9 +706,11 @@ function xmlsitemap_url($path = NULL, $a $script = isset($script) ? $script : strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE ? 'index.php' : ''; $clean_url = isset($clean_url) ? $clean_url : variable_get('clean_url', FALSE); $base = ($absolute ? $base_url .'/' : base_path()); + if (!empty($path) && $path != '') { $path = _xmlsitemap_get_path_alias($path, $alias); $path = drupal_urlencode($path); + if (!$clean_url) { if (isset($query)) { return $base . $script .'?q='. $path .'&'. $query . $fragment; @@ -747,12 +749,12 @@ function _xmlsitemap_get_path_alias($pat if (!empty($alias)) { $result = $alias; } - if (function_exists('custom_url_rewrite')) { - $result = custom_url_rewrite('alias', $result, $path); - } - if (module_exists('i18n')) { - i18n_get_lang_prefix($result, TRUE); - } +# if (function_exists('url')) { +# $result = url($path, array('query' => $alias, 'absolute' => $path_language)); +# } +# if (module_exists('i18n')) { +# i18n_get_lang_prefix($result, TRUE); +# } return $result; } Index: ../xmlsitemap/docs/xmlsitemap.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/docs/xmlsitemap.php,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap.php --- ../xmlsitemap/docs/xmlsitemap.php 6 Dec 2007 17:41:14 -0000 1.4 +++ ../xmlsitemap/docs/xmlsitemap.php 9 Mar 2008 16:51:10 -0000 @@ -173,10 +173,10 @@ function hook_xmlsitemap_engines($op, $t if (variable_get('xmlsitemap_engines_google_submit', TRUE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.')); + watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; Index: ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_engines.info --- ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info 9 Mar 2008 16:51:11 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Engines description = Submits site map to search engines. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap_engines.module --- ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module 13 Dec 2007 02:48:02 -0000 1.4 +++ ../xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module 9 Mar 2008 16:51:11 -0000 @@ -64,10 +64,10 @@ function _xmlsitemap_engines_google($op, if (variable_get('xmlsitemap_engines_google_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.')); + watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -116,10 +116,10 @@ function _xmlsitemap_engines_yahoo($op) if (variable_get('xmlsitemap_engines_yahoo_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Yahoo!.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Yahoo!.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -154,10 +154,10 @@ function _xmlsitemap_engines_ask($op) { if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Ask.com.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Ask.com.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -204,10 +204,10 @@ function _xmlsitemap_engines_live($op) { if (variable_get('xmlsitemap_engines_live_submit', FALSE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_live_url', 'http://webmaster.live.com/ping.aspx?siteMap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { - watchdog('xmlsitemap', t('Site map successfully submitted to Windows Live.')); + watchdog('xmlsitemap', 'Site map successfully submitted to Windows Live.'); } else { - watchdog('xmlsitemap', t('Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code)), WATCHDOG_ERROR); + watchdog('xmlsitemap', 'Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code), WATCHDOG_ERROR); } } break; @@ -217,41 +217,40 @@ function _xmlsitemap_engines_live($op) { /** * Implementation of hook_menu(). */ -function xmlsitemap_engines_menu($may_cache) { +function xmlsitemap_engines_menu() { $items = array(); - $access_content = user_access('access content'); - if ($may_cache) { - if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) { - $items[] = array( - 'path' => $verify, - 'title' => t('Google verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('google'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') { - $items[] = array( - 'path' => $verify, - 'title' => t('Yahoo! verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('yahoo'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } - if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') { - $items[] = array( - 'path' => $verify, - 'title' => t('Windows Live verification page'), - 'callback' => '_xmlsitemap_engines_verify', - 'callback arguments' => array('live'), - 'type' => MENU_CALLBACK, - 'access' => $access_content, - ); - } + $access_content = array('access content'); + if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) { + $items[$verify] = array( + 'title' => t('Google verification page'), + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('google'), + 'type' => MENU_CALLBACK, + 'access callback' => 'user_access', + 'access arguments' => $access_content, + ); + } + if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') { + $items[$verify] = array( + 'title' => t('Yahoo! verification page'), + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('yahoo'), + 'type' => MENU_CALLBACK, + 'access callback' => 'user_access', + 'access arguments' => $access_content, + ); + } + if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') { + $items[$verify] = array( + 'title' => t('Windows Live verification page'), + 'page callback' => '_xmlsitemap_engines_verify', + 'page arguments' => array('live'), + 'type' => MENU_CALLBACK, + 'access callback' => 'user_access', + 'access arguments' => $access_content, + ); } + return $items; } Index: ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_node.info --- ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.info 9 Mar 2008 16:51:11 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Node description = Adds nodes to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.install,v retrieving revision 1.7 diff -u -p -r1.7 xmlsitemap_node.install --- ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install 8 Jan 2008 05:13:35 -0000 1.7 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.install 9 Mar 2008 16:51:11 -0000 @@ -2,36 +2,87 @@ // $Id: xmlsitemap_node.install,v 1.7 2008/01/08 05:13:35 darrenoh Exp $ /** + * Implementation of hook_schema(). + */ +function xmlsitemap_node_schema() { + $schema['xmlsitemap_node'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'nid' => array( + 'description' => t('The path of this node.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_comment' => array( + 'description' => t('Link to last comment.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previous_comment' => array( + 'description' => t('Link to previous comment.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('nid'), + ); + + return $schema; +} + +/** * Implementation of hook_install(). */ -function xmlsitemap_node_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_node} ( - nid int, - pid int, - last_changed int(11), - previously_changed int(11), - last_comment int(11), - previous_comment int(11), - priority_override float, - PRIMARY KEY (nid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_node} ( - nid integer, - pid integer, - last_changed integer, - previously_changed integer, - last_comment integer, - previous_comment integer, - priority_override real, - PRIMARY KEY (nid) - );"); - break; +function xmlsitemap_node_install() { + // Create my tables. + drupal_install_schema('xmlsitemap_node'); +} + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_node_uninstall() { + // Drop my tables. + $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'"); + while ($variable = db_fetch_array($settings)) { + variable_del($variable->name); } + drupal_uninstall_schema('xmlsitemap_node'); } /** @@ -98,15 +149,3 @@ function _xmlsitemap_node_insert_query() function xmlsitemap_node_disable() { xmlsitemap_update_sitemap(); } - -/** - * Implementation of hook_uninstall(). - */ -function xmlsitemap_node_uninstall() { - db_query("DROP TABLE {xmlsitemap_node}"); - $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'"); - while ($variable = db_fetch_array($settings)) { - variable_del($variable->name); - } -} - Index: ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module,v retrieving revision 1.17 diff -u -p -r1.17 xmlsitemap_node.module --- ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.module 8 Jan 2008 05:13:35 -0000 1.17 +++ ../xmlsitemap/xmlsitemap_node/xmlsitemap_node.module 9 Mar 2008 16:51:11 -0000 @@ -52,17 +52,17 @@ function _xmlsitemap_node_links($exclude if (module_exists('comment')) { $sql = " SELECT n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override, ua.dst AS alias - FROM {node} n - LEFT JOIN {node_comment_statistics} s ON s.nid = n.nid"; + FROM {node} AS n + LEFT JOIN {node_comment_statistics} AS s ON s.nid = n.nid"; } else { $sql = " SELECT n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override, ua.dst AS alias - FROM {node} n"; + FROM {node} AS n"; } $sql .= " - LEFT JOIN {xmlsitemap_node} xn ON xn.nid = n.nid - LEFT JOIN {url_alias} ua ON ua.pid = xn.pid + LEFT JOIN {xmlsitemap_node} AS xn ON xn.nid = n.nid + LEFT JOIN {url_alias} AS ua ON ua.pid = xn.pid WHERE n.status > 0 AND (n.type NOT IN ('". implode("', '", $excludes) ."') AND xn.priority_override IS NULL OR xn.priority_override >= 0) AND n.nid <> %d"; @@ -161,7 +161,7 @@ function xmlsitemap_node_perm() { /** * Implementation of hook_form_alter(). */ -function xmlsitemap_node_form_alter($form_id, &$form) { +function xmlsitemap_node_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case $form['type']['#value'] .'_node_form': if (isset($form['type'])) { @@ -206,7 +206,7 @@ function xmlsitemap_node_form_alter($for '#description' => t('This number will be added to the priority of this content type.'), ); $form['xmlsitemap_old_priority'] = array('#type' => 'value', '#value' => variable_get("xmlsitemap_node_type_priority_{$form['#node_type']->type}", 0.1)); - $form['#submit']['_xmlsitemap_node_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_node_submit'; $form['submit']['#weight'] = 1; $form['reset']['#weight'] = 1; } @@ -258,16 +258,16 @@ function xmlsitemap_node_nodeapi(&$node, $query = " INSERT INTO {xmlsitemap_node} (nid, pid, last_changed, priority_override) SELECT %d, ua.pid, %d, %s - FROM {node} n"; + FROM {node} AS n"; switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', %d)"; + LEFT JOIN {url_alias} AS ua ON ua.src = CONCAT('node/', %d)"; break; case 'pgsql': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = 'node/' || %d"; + LEFT JOIN {url_alias} AS ua ON ua.src = 'node/' || %d"; break; } $query .= " @@ -287,7 +287,7 @@ function xmlsitemap_node_nodeapi(&$node, case 'mysql': case 'mysqli': db_query(" - UPDATE {xmlsitemap_node} xn LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', xn.nid) + UPDATE {xmlsitemap_node} AS xn LEFT JOIN {url_alias} AS ua ON ua.src = CONCAT('node/', xn.nid) SET xn.pid = ua.pid, xn.previously_changed = xn.last_changed, xn.last_changed = %d, xn.priority_override = %s WHERE xn.nid = %d ", $node->changed, $node->priority_override, $node->nid); @@ -335,13 +335,13 @@ function xmlsitemap_node_comment($op, $c * Add submit actions to forms. * @return None */ -function _xmlsitemap_node_submit($form_id, $form_values) { +function _xmlsitemap_node_submit($form, &$form_state) { switch ($form_id) { case 'node_type_form': - $op = isset($form_values['op']) ? $form_values['op'] : ''; - $type = isset($form_values['old_type']) ? $form_values['old_type'] : trim($form_values['type']); - $priority = $form_values['xmlsitemap_node_type_priority']; - $old_priority = $form_values['xmlsitemap_old_priority']; + $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; + $type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : trim($form_state['values']['type']); + $priority = $form_state['values']['xmlsitemap_node_type_priority']; + $old_priority = $form_state['values']['xmlsitemap_old_priority']; if ($op == t('Save content type') && $priority != $old_priority || $op == t('Reset to defaults') && $old_priority != 0.1) { xmlsitemap_update_sitemap(); } @@ -366,18 +366,18 @@ function xmlsitemap_node_cron() { $query = " INSERT INTO {xmlsitemap_node} (nid, pid, last_changed, last_comment, previous_comment) SELECT n.nid, MAX(ua.pid), n.changed, s.last_comment_timestamp, MAX(c.timestamp) FROM {node} n - LEFT JOIN {node_comment_statistics} s ON s.nid = n.nid - LEFT OUTER JOIN {comments} c ON c.nid = n.nid AND c.timestamp < s.last_comment_timestamp - LEFT JOIN {xmlsitemap_node} xn ON xn.nid = n.nid"; + LEFT JOIN {node_comment_statistics} AS s ON s.nid = n.nid + LEFT OUTER JOIN {comments} AS c ON c.nid = n.nid AND c.timestamp < s.last_comment_timestamp + LEFT JOIN {xmlsitemap_node} AS xn ON xn.nid = n.nid"; switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', n.nid)"; + LEFT JOIN {url_alias} AS ua ON ua.src = CONCAT('node/', n.nid)"; break; case 'pgsql': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = 'node/' || n.nid"; + LEFT JOIN {url_alias} AS ua ON ua.src = 'node/' || n.nid"; break; } $query .= " Index: ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_term.info --- ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.info 9 Mar 2008 16:51:11 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: Term description = Adds taxonomy terms to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.install,v retrieving revision 1.3 diff -u -p -r1.3 xmlsitemap_term.install --- ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install 6 Dec 2007 17:41:15 -0000 1.3 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.install 9 Mar 2008 16:51:11 -0000 @@ -2,32 +2,53 @@ // $Id: xmlsitemap_term.install,v 1.3 2007/12/06 17:41:15 darrenoh Exp $ /** - * Implementation of hook_install(). + * Implementation of hook_schema(). */ -function xmlsitemap_term_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_term} ( - tid int, - pid int, - last_changed int(11), - previously_changed int(11), - priority_override float, - PRIMARY KEY (tid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_term} ( - tid integer, - pid integer, - last_changed integer, - previously_changed integer, - priority_override real, - PRIMARY KEY (tid) - );"); - break; - } +function xmlsitemap_term_schema() { + $schema['xmlsitemap_term'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'tid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('tid'), + ); + + return $schema; } /** @@ -67,14 +88,22 @@ function xmlsitemap_term_disable() { xmlsitemap_update_sitemap(); } + +/** + * Implementation of hook_uninstall(). + */ +function xmlsitemap_term_install() { + drupal_install_schema('xmlsitemap_term'); +} + /** * Implementation of hook_uninstall(). */ function xmlsitemap_term_uninstall() { - db_query("DROP TABLE {xmlsitemap_term}"); $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_term\_%'"); while ($variable = db_fetch_object($settings)) { variable_del($variable->name); } + drupal_uninstall_schema('xmlsitemap_term'); } Index: ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_term/xmlsitemap_term.module,v retrieving revision 1.10 diff -u -p -r1.10 xmlsitemap_term.module --- ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.module 13 Dec 2007 02:18:30 -0000 1.10 +++ ../xmlsitemap/xmlsitemap_term/xmlsitemap_term.module 9 Mar 2008 16:51:11 -0000 @@ -52,10 +52,10 @@ function _xmlsitemap_term_links($exclude $links = array(); $result = db_query(db_rewrite_sql(" SELECT td.*, v.module, xt.last_changed, xt.previously_changed, xt.priority_override, ua.dst AS alias - FROM {term_data} td - LEFT JOIN {vocabulary} v ON v.vid = td.vid - LEFT JOIN {xmlsitemap_term} xt ON xt.tid = td.tid - LEFT JOIN {url_alias} ua ON ua.pid = xt.pid + FROM {term_data} AS td + LEFT JOIN {vocabulary} AS v ON v.vid = td.vid + LEFT JOIN {xmlsitemap_term} AS xt ON xt.tid = td.tid + LEFT JOIN {url_alias} AS ua ON ua.pid = xt.pid WHERE (td.vid NOT IN (". (empty($excludes) ? 0 : implode(', ', $excludes)) .") AND xt.priority_override IS NULL OR xt.priority_override >= 0) AND td.tid <> %d ", 'td', 'tid'), _xmlsitemap_term_frontpage()); @@ -129,7 +129,7 @@ function xmlsitemap_term_perm() { /** * Implementation of hook_form_alter(). */ -function xmlsitemap_term_form_alter($form_id, &$form) { +function xmlsitemap_term_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'taxonomy_form_term': $priority = db_result(db_query("SELECT priority_override FROM {xmlsitemap_term} WHERE tid = %d", $form['tid']['#value'])); @@ -231,17 +231,17 @@ function xmlsitemap_term_cron() { if (db_result(db_query_range("SELECT COUNT(*) FROM {term_data} td LEFT JOIN {xmlsitemap_term} xt ON xt.tid = td.tid WHERE xt.tid IS NULL", 0, 1))) { $query = " INSERT INTO {xmlsitemap_term} (tid, last_changed, pid) - SELECT td.tid, %d, ua.pid FROM {term_data} td - LEFT JOIN {xmlsitemap_term} xt ON xt.tid = td.tid"; + SELECT td.tid, %d, ua.pid FROM {term_data} AS td + LEFT JOIN {xmlsitemap_term} AS xt ON xt.tid = td.tid"; switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = CONCAT('taxonomy/term/', td.tid) OR ua.src = CONCAT('forum/', td.tid)"; + LEFT JOIN {url_alias} AS ua ON ua.src = CONCAT('taxonomy/term/', td.tid) OR ua.src = CONCAT('forum/', td.tid)"; break; case 'pgsql': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = 'taxonomy/term/' || td.tid OR ua.src = 'forum/' || td.tid"; + LEFT JOIN {url_alias} AS ua ON ua.src = 'taxonomy/term/' || td.tid OR ua.src = 'forum/' || td.tid"; break; } $query .= " Index: ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.info,v retrieving revision 1.1 diff -u -p -r1.1 xmlsitemap_user.info --- ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.info 9 Nov 2007 17:56:05 -0000 1.1 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.info 9 Mar 2008 16:51:11 -0000 @@ -2,5 +2,6 @@ name = XML Sitemap: User description = Adds user profiles to the site map. package = XML Sitemap -dependencies = xmlsitemap - +dependencies[] = xmlsitemap +core = 6.x +version = 6.x-1.x-dev Index: ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.install,v retrieving revision 1.4 diff -u -p -r1.4 xmlsitemap_user.install --- ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install 6 Dec 2007 17:41:15 -0000 1.4 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.install 9 Mar 2008 16:51:11 -0000 @@ -2,42 +2,76 @@ // $Id: xmlsitemap_user.install,v 1.4 2007/12/06 17:41:15 darrenoh Exp $ /** - * Implementation of hook_install(). + * Implementation of hook_schema(). */ -function xmlsitemap_user_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {xmlsitemap_user} ( - uid int, - pid int, - last_changed int(11), - previously_changed int(11), - priority_override float, - PRIMARY KEY (uid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - db_query("CREATE TABLE {xmlsitemap_user_role} ( - rid int, - priority float NOT NULL DEFAULT 0, - PRIMARY KEY (rid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - case 'pgsql': - db_query("CREATE TABLE {xmlsitemap_user} ( - uid integer, - pid integer, - last_changed integer, - previously_changed integer, - priority_override real, - PRIMARY KEY (uid) - );"); - db_query("CREATE TABLE {xmlsitemap_user_role} ( - rid integer, - priority real NOT NULL DEFAULT 0, - PRIMARY KEY (rid) - ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - break; - } +function xmlsitemap_user_schema() { + $schema['xmlsitemap_user'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'uid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'pid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'last_changed' => array( + 'description' => t('Keeps track of new changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'previously_changed' => array( + 'description' => t('Keeps track of old changes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority_override' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + ), + 'primary key' => array('uid'), + ); + + $schema['xmlsitemap_user_role'] = array( + 'description' => t('The base table for xmlsitemap.'), + 'fields' => array( + 'rid' => array( + 'description' => t('The id of the path.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'priority' => array( + 'description' => t('Stores the index value.'), + 'type' => 'float', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'pid' => array('rid'), + ), + 'primary key' => array('rid'), + ); + + return $schema; } /** @@ -84,10 +118,16 @@ function xmlsitemap_user_disable() { } /** + * Implementation of hook_install(). + */ +function xmlsitemap_user_install() { + drupal_install_schema('xmlsitemap_user'); +} + +/** * Implementation of hook_uninstall(). */ function xmlsitemap_user_uninstall() { - db_query("DROP TABLE {xmlsitemap_user}"); - db_query("DROP TABLE {xmlsitemap_user_role}"); + drupal_uninstall_schema('xmlsitemap_user'); } Index: ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/xmlsitemap/xmlsitemap_user/xmlsitemap_user.module,v retrieving revision 1.11 diff -u -p -r1.11 xmlsitemap_user.module --- ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.module 10 Dec 2007 03:15:19 -0000 1.11 +++ ../xmlsitemap/xmlsitemap_user/xmlsitemap_user.module 9 Mar 2008 16:51:11 -0000 @@ -33,11 +33,11 @@ function _xmlsitemap_user_links() { $links = array(); $result = db_query(" SELECT u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, SUM(xur.priority) as priority, ua.dst AS alias - FROM {users} u - LEFT JOIN {users_roles} ur ON ur.uid = u.uid - LEFT JOIN {xmlsitemap_user_role} xur ON xur.rid = ur.rid - LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid - LEFT JOIN {url_alias} ua ON ua.pid = xu.pid + FROM {users} AS u + LEFT JOIN {users_roles} AS ur ON ur.uid = u.uid + LEFT JOIN {xmlsitemap_user_role} AS xur ON xur.rid = ur.rid + LEFT JOIN {xmlsitemap_user} AS xu ON xu.uid = u.uid + LEFT JOIN {url_alias} AS ua ON ua.pid = xu.pid WHERE (xu.priority_override IS NULL OR xu.priority_override >= 0) AND u.uid <> %d AND u.uid > 0 GROUP BY u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, alias HAVING COUNT(xu.priority_override) > 0 OR (COUNT(xur.rid) = 0 AND %f <> -1 OR MIN(xur.priority) <> -1) @@ -90,7 +90,7 @@ function _xmlsitemap_user_priority($user /** * Implementation of hook_form_alter(). */ -function xmlsitemap_user_form_alter($form_id, &$form) { +function xmlsitemap_user_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'user_admin_settings': $form['xmlsitemap'] = array( @@ -107,7 +107,7 @@ function xmlsitemap_user_form_alter($for '#description' => t('Choose the default priority for users who have only the authenticated user role.'), ); $form['buttons']['#weight'] = 1; - $form['#submit']['_xmlsitemap_user_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_user_submit'; break; case 'user_admin_role': $form['xmlsitemap_user_role_priority'] = array( @@ -119,7 +119,7 @@ function xmlsitemap_user_form_alter($for ); $form['submit']['#weight'] = 1; $form['delete']['#weight'] = 1; - $form['#submit']['_xmlsitemap_user_submit'] = array(); + $form['#submit'][] = '_xmlsitemap_user_submit'; break; } } @@ -128,23 +128,23 @@ function xmlsitemap_user_form_alter($for * Add submit actions to forms. * @return None */ -function _xmlsitemap_user_submit($form_id, $form_values) { +function _xmlsitemap_user_submit(&$form, &$form_state, $form_id) { switch ($form_id) { case 'user_admin_settings': - if ($form_values['xmlsitemap_user_default_priority'] != $form_values['xmlsitemap_user_old_default_priority']) { + if ($form_state['values']['xmlsitemap_user_default_priority'] != $form_state['values']['xmlsitemap_user_old_default_priority']) { xmlsitemap_update_sitemap(); } break; case 'user_admin_role': - $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid'])); - if ($form_values['op'] == t('Delete role')) { - db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']); + $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid'])); + if ($form_state['values']['op'] == t('Delete role')) { + db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid']); if ($priority > 0 || $priority < 0) { xmlsitemap_update_sitemap(); } } - elseif ($form_values['xmlsitemap_user_role_priority'] != $priority) { - db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_values['xmlsitemap_user_role_priority'], $form_values['rid']); + elseif ($form_state['values']['xmlsitemap_user_role_priority'] != $priority) { + db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_state['values']['xmlsitemap_user_role_priority'], $form_state['values']['rid']); xmlsitemap_update_sitemap(); } break; @@ -239,17 +239,17 @@ function xmlsitemap_user_cron() { if (db_result(db_query_range("SELECT COUNT(*) FROM {users} u LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid WHERE u.uid <> 0 AND xu.uid IS NULL", 0, 1))) { $query = " INSERT INTO {xmlsitemap_user} (uid, last_changed, pid) - SELECT u.uid, u.created, ua.pid FROM {users} u - LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid"; + SELECT u.uid, u.created, ua.pid FROM {users} AS u + LEFT JOIN {xmlsitemap_user} AS xu ON xu.uid = u.uid"; switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = CONCAT('user/', u.uid)"; + LEFT JOIN {url_alias} AS ua ON ua.src = CONCAT('user/', u.uid)"; break; case 'pgsql': $query .= " - LEFT JOIN {url_alias} ua ON ua.src = 'user/' || u.uid"; + LEFT JOIN {url_alias} AS ua ON ua.src = 'user/' || u.uid"; break; } $query .= "