Plugin Directory

Changeset 458029


Ignore:
Timestamp:
10/31/2011 09:50:04 PM (14 years ago)
Author:
hawk__
Message:

Added a timestamp to logs
Ignore errors about table "options" not existing when installing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postgresql-for-wordpress/trunk/pg4wp/driver_pgsql.php

    r436152 r458029  
    123123        }
    124124       
     125        $initial = $sql;
    125126        $sql = pg4wp_rewrite( $sql);
    126127       
    127128        $GLOBALS['pg4wp_result'] = pg_query($sql);
    128129        if( (PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && $err = pg_last_error())
    129             if( false === strpos($err, 'relation "'.$wpdb->options.'"'))
    130                 error_log("Error running :\n$initial\n---- converted to ----\n$sql\n----\n$err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
    131        
     130        {
     131            $ignore = false;
     132            if( defined('WP_INSTALLING') && WP_INSTALLING)
     133            {
     134                global $table_prefix;
     135                $ignore = strpos($err, 'relation "'.$table_prefix.'options"');
     136            }
     137            if( ! $ignore )
     138                error_log('['.microtime(true)."] Error running :\n$initial\n---- converted to ----\n$sql\n----> $err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
     139        }
    132140        return $GLOBALS['pg4wp_result'];
    133141    }
     
    152160        $data = pg_fetch_result($res, 0, 0);
    153161        if( PG4WP_DEBUG && $sql)
    154             error_log("Getting inserted ID for '$t' : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log');
     162            error_log( '['.microtime(true)."] Getting inserted ID for '$t' : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log');
    155163        return $data;
    156164    }
     
    176184                $GLOBALS['pg4wp_numrows_query'] = $sql;
    177185                if( PG4WP_DEBUG)
    178                     error_log( "Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
     186                    error_log( '['.microtime(true)."] Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
    179187            }
    180188            elseif( false !== strpos($sql, 'FOUND_ROWS()'))
     
    420428        {
    421429            if( $initial != $sql)
    422                 error_log("Converting :\n$initial\n---- to ----\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_'.$logto.'.log');
     430                error_log( '['.microtime(true)."] Converting :\n$initial\n---- to ----\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_'.$logto.'.log');
    423431            else
    424                 error_log("$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_unmodified.log');
     432                error_log( '['.microtime(true)."] $sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_unmodified.log');
    425433        }
    426434        return $sql;
Note: See TracChangeset for help on using the changeset viewer.