CVS edit link for -redShadow-

I wrote lots of Drupal modules, some published somewhere on the net, others only half-completed, but some are getting ready to be published on drupal.org..
The first module I think it is ready to be given to the community is poweradmin, a tool to administer PowerDNS (http://powerdns.com/) for which I'm planning to write also an integration module for the AEgir Drupal hosting system..

There is a current development snapshot available at:
http://stuff.hackzine.org/drupal-modules/poweradmin_20091230-003926.tbz2

The code is almost clean, I promise I'll clean it to pass code-style.pl before publishing it.. :)

Best regards,
Samuele ~redShadow~ Santi

Comments

-redShadow-’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new26.5 KB

I'm attaching the source code

avpaderno’s picture

Status: Needs review » Needs work
  1. function poweradmin_list_domains() {
      $res = db_query("SELECT d.*, count(distinct r.id) AS count_records
        FROM {domains} d LEFT JOIN {records} r ON r.domain_id=d.id
        GROUP BY d.name, d.id, d.type ORDER BY d.name");
      return _poweradmin_dbres_to_array($res, 'id');
    }
    

    The code should use db_distinct_field(). Reserved words should be written in upper case (see COUNT()).

  2. function poweradmin_get_domain($domain_id) {
      $res = db_query("SELECT * FROM {domains} WHERE id=%d", $domain_id);
      $domain = db_fetch_object($res);
      $domain->records = poweradmin_list_records($domain_id);
      //dpm($domain);
      return $domain;
    }
    

    It would be better to use db_query_range() to limit the number of returned results to 1.

  3. I think that the respect of the namespace extends also to the database tables; the code uses table names as records, supermasters. Somebody could create a module named supermasters, and use a table named supermasters too.
  4.   t("Deleted record: %name", array("%name" => $record->name .' '. $record->type .' '. $record->content));
      $form_state['redirect'] = POWERADMIN_ADMIN_ROOT .'/zones/'. $record->domain_id;
    

    The function t() doesn't show anything to the user; its purpose is different.

  5. There are some functions that contains a line that seems to mark them as deprecated. Remove those functions, and remove all the debugging functions / output.
  6. The file LICENSE.txt needs to be removed; Drupal.org CVS doesn't allow to commit that file.
-redShadow-’s picture

I'm gonna fix that. For the table name issue: these tables absolutely needs to have these names, without prefix, since PowerDNS expects to find tables with exactly these names..

UPDATE: Found the way to configure the queries in the PowerDNS configuration file. I'm gonna fix the table name problem too

-redShadow-’s picture

Status: Needs work » Needs review
StatusFileSize
new19.22 KB

Fixed the issues described in #2

-redShadow-’s picture

StatusFileSize
new21.41 KB

Sorry, I posted an older version :) This is the latest one

avpaderno’s picture

Status: Needs review » Fixed

I already reported to redShadow in IRC the little changes he could do; there is nothing that could stop this application approval, anyway.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.