Hello!

I have Drupal 5.2 and PostgreSQL 8.2.1.

After installing Archive, I have those errors:

warning: Missing argument 2 for archive_help() in
/var/www/html/drupal-5.2/modules/archive/archive.module
on line 7.
warning: Missing argument 2 for archive_help() in
/var/www/html/drupal-5.2/modules/archive/archive.module
on line 7.

I was looking in archive_help. It has this header:

function archive_help($path, $arg)

I replaced with this:

function archive_help($path, $arg='')

After replace, I have no errors, no warnings, but Archive not appear anywhere.

The path admin/settings/archive goes in the same page like admin/settings.

and the page: site/archive or site/?q=archive say that the page was not found.

I don't know why Archive not appear anywhere and if the function archive_help is the problem. I don't know from where to begin.

Thanks.

Miriam

Comments

Susurrus’s picture

What pages were you having the archive_help errors on? From the documentation of hook_help(), it was my understanding that a default $arg argument wasn't necessary.

My module was written to support MySQL, so I'm not sure if it'll work in a PostgreSQL environment. I would imagine that the settings and /archive page would still show up anyways though. Which PHP version are you running?

miriam_crete’s picture

I have PHP Version 4.3.9.

The archive_help errors appear on all pages if I don't put the default value for the argument $arg.

Thank you very much.

Susurrus’s picture

Well, the issue is that you downloaded the 6.x version when you're running Drupal 5.2. The 6.x version is for Drupal 6.

Susurrus’s picture

Status: Active » Closed (fixed)
miriam_crete’s picture

Version: 6.x-0.8-dev » 5.x-1.6
Status: Closed (fixed) » Postponed (maintainer needs more info)

After installing version 5.x-1.6 the module Archive appear in settings.
Thank you very much.
But I have those errors:

warning: pg_query(): Query failed: ERROR: column "page" does not exist LINE 1: ..._date FROM node n WHERE n.status = 1 AND n.type IN ("page") ^ in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 125.
user warning: query: SELECT MIN(n.created) AS min_date, MAX(n.created) AS max_date FROM node n WHERE n.status = 1 AND n.type IN ("page") in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 144.
warning: pg_query(): Query failed: ERROR: column "page" does not exist LINE 1: ...eated FROM node n WHERE n.status = 1 AND n.type IN ("page") ^ in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 125.
user warning: query: SELECT n.uid, n.created FROM node n WHERE n.status = 1 AND n.type IN ("page") in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 144.
warning: pg_query(): Query failed: ERROR: column "page" does not exist LINE 1: ...NT(*) FROM node n WHERE n.status = 1 AND n.type IN ("page") ^ in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 125.
user warning: query: SELECT COUNT(*) FROM node n WHERE n.status = 1 AND n.type IN ("page") in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 144.
warning: pg_query(): Query failed: ERROR: column "page" does not exist LINE 1: ...ype FROM node n WHERE n.status = 1 AND n.type IN ("page") OR... ^ in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 125.
user warning: query: SELECT n.nid, n.type FROM node n WHERE n.status = 1 AND n.type IN ("page") ORDER BY n.created DESC LIMIT 1 OFFSET 0 in /var/www/html/drupal-5.2/includes/database.pgsql.inc on line 144.

The problem is that in Postgres correct is:

AND n.type IN ('page')

I tried to remove

AND n.type IN ("page")

from archive.inc but the warnings still appear. Where should I modify?

Susurrus’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I'm not supporting PostreSQL for this module as I have never used it. You'll have to read up on PostgreSQL syntax to determine what the queries should look like. If you do manage to get this module working with PostgreSQL, I'd be happy to add it to the module if you provide a patch.

jmpacquet’s picture

Component: Code » Page

You only have to change double quotes into single quotes to make the archive db query compatible with postgresql. It should not harm MySQL version since both quotes are allowed. Here is the patch which works on my Drupal 5.7(+Archive 1.9)/PostgreSQL 8.3/Slackware 12.0 system:

--- archive.module~     2008-02-04 20:26:00.000000000 +0100
+++ archive.module      2008-03-12 09:53:59.000000000 +0100
@@ -289,11 +289,11 @@ function _archive_types_sql_string($type
           unset($types[$key]);
         }
       }
-      $final_types = join(array_keys($types), '", "');
+      $final_types = join(array_keys($types), "', '"); //jmp pgsql compatible
     }
   }
   if (strlen($final_types) > 0) {
-    $final_types = 'AND n.type IN ("' . $final_types . '") ';
+    $final_types = "AND n.type IN ('" . $final_types . "') "; //jmp pgsql compatible
   }
   return $final_types;
 }

Oups, I forgot this one:

--- archive.inc~        2007-12-26 20:50:34.000000000 +0100
+++ archive.inc 2008-03-12 11:48:30.000000000 +0100
@@ -134,10 +134,10 @@ function _archive_node_types($date) {
   
   $result = '';
   if ($start && $end) {
-    $result = db_query(db_rewrite_sql('SELECT t.type, t.name, COUNT(n.nid) AS node_count FROM {node} n INNER JOIN {node_type} t ON t.type = n.type WHERE n.status = 1 AND t.type IN ("'. join($types, '", "') .'") AND n.created BETWEEN %d AND %d GROUP BY n.type ORDER BY n.created'), $start - $date->tz, $end - $date->tz);
+    $result = db_query(db_rewrite_sql("SELECT t.type, t.name, COUNT(n.nid) AS node_count FROM {node} n INNER JOIN {node_type} t ON t.type = n.type WHERE n.status = 1 AND t.type IN ('". join($types, "', '") ."') AND n.created BETWEEN %d AND %d GROUP BY t.type, t.name, n.created ORDER BY n.created"), $start - $date->tz, $end - $date->tz);
   }
   else {
-    $result = db_query(db_rewrite_sql('SELECT t.type, t.name, COUNT(n.nid) AS node_count FROM {node} n INNER JOIN {node_type} t ON t.type = n.type WHERE n.status = 1 AND t.type IN ("'. join($types, '", "') .'") GROUP BY n.type ORDER BY n.created'));
+    $result = db_query(db_rewrite_sql("SELECT t.type, t.name, COUNT(n.nid) AS node_count FROM {node} n INNER JOIN {node_type} t ON t.type = n.type WHERE n.status = 1 AND t.type IN ('". join($types, "', '") ."') GROUP BY t.type, t.name, n.created ORDER BY n.created"));
   }
   
   $n_types = array();

Thanks for this nice little module that I only discovered recently.
--
jmp