This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

deprecated.module - upgrade assistant

I've written a module that implements the functions removed in Drupal 4.6, logging each call to these deprecated functions to the watchdog. Benefits are:

Contact Directory

I am using contact directory module, it Seems like a great module, but I want to be able to show the contacts to people who are not members of the site. So far, I can't figure out a way to do this. Is there an quick fix in the .module file?

Help using db_next_id...

I'm trying to understand why I want to use db_next_id instead of just letting a table with an autoincrement do its thing. Drupal docs says "for compatibility reasons" but I'm not sure what incompatibilities there might be. Granted I only know mysql, and only enough to get me by...

Here is an example from aggregator.module ( vrs 1.213.2.3)

    $edit['fid'] = db_next_id('{aggregator_feed}_fid');
    db_query('INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, \'%s\', \'%s\', %d, %d)',
                  $edit['fid'],$edit['title'], $edit['url'], $edit['refresh'], $edit['block']);

The aggregator fid column is autoincrement, so why not just pass it a NULL or 0?

The reason I ask is I'm playing with some ideas for a per user RSS feeds module, and I would like to reuse some of the aggregator functions. However, trying to get at the last ID added to the aggregator table without using something like LAST_INSERT_ID() is troublesome and slow. Since LAST_INSERT_ID only stores the last id when the autoincrement is allowed to 'go off' and do it's thing, using db_next_id and inserting the returned value directly doesn't register anything with LAST_INSERT_ID...

I'm thinking this is a postgre versus mysql thing...

Looking at db_next_id it uses nextval() to get the id - i thought I might be able to use currval() to do the same thing as LAST_INSERT_ID() but that didn't work out...

Menus & pages not updating (cache problem?)

I'm writing a custom module. When I change something in my module, save the changes and refresh the page on my development server, more often than not (or always even?) I can't see the changes. Not until I go to administer->menu and then poof, when I go back to the page I see the updates.

I've found similar problems with the installation of drupal-docs I've made locally.

Not fun when I'm making many changes and alt-tab, refreshing the page.

boolean operations in site search & taxonomy?

Am I being thick, or is it true that the standard boolean search operators (at least I think that's what they're called) are not supported by the drupal site-search box?

The kind of operations I mean are:
"search for whole phrase"
search+for+all+terms (usually default)
search,for,any,of,these,terms
-filter -out -these -terms
(combine)+(operators -junk)
etc etc - my apologies if I've used the wrong operator characters, I'm just used to using the common search engine defaults ...

and while I'm at it:

db_set_active acting strangely

In settings I have:

$db_url['default'] = 'mysql://aaa';
$db_url['depletion'] = 'mysql://bbb';

In my custom module I have:

db_set_active('depletion');
.
.
.
db_set_active('default');

Even with nothing but commented out lines between them, I get the following error:

user error: Table 'local_aspo.blocks' doesn't exist
query: SELECT * FROM blocks WHERE status = 1 AND region = 0 ORDER BY weight, module in /.[snip]./database.mysql.inc on line 66.

I've tried removing the word 'default' from the 'default' db_set_active which makes no change.

BUT... when I change it to:
db_set_active('anything-else-but-default-or-depletion');

... it bizarrely works!

I'm using a two-day old 4.6RC. db_set_active is:

function db_set_active($name = 'default') {
global $db_url, $db_type, $active_db;
static $db_conns;

if (!isset($db_conns[$name])) {
// Initiate a new connection, using the named DB URL specified.
if (is_array($db_url)) {
$connect_url = array_key_exists($name, $db_url) ? $db_url[$name] : $db_url['default'];
}
else {
$connect_url = $db_url;
}

$db_type = substr($connect_url, 0, strpos($connect_url, '://'));
$handler = "includes/database.$db_type.inc";

if (is_file($handler)) {
include_once($handler);
}
else {
die('Unsupported database type');

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions