Ignore:
Timestamp:
02/05/08 16:04:07 (16 years ago)
Author:
bastiaans
Message:

job_monarch/libtoga.php:

  • parse CLUSTER_CONFS for cluster specific archive database settings
  • select descending while searching
  • add a PHP4 version of strpos

job_monarch/conf.php:

  • show nodes column by default
Location:
trunk/web/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/conf.php

    r417 r454  
    1818// Show the column job attribute 'nodes' hostnames?
    1919//
    20 $COLUMN_NODES = 0;
     20$COLUMN_NODES = 1;
    2121
    2222// Path to Ganglia's web frontend root
  • trunk/web/addons/job_monarch/libtoga.php

    r428 r454  
    126126}
    127127
     128/**
     129 * Replace stripos()
     130 *
     131 * @category    PHP
     132 * @package     PHP_Compat
     133 * @link        http://php.net/function.stripos
     134 * @author      Aidan Lister <aidan@php.net>
     135 * @version     $Revision: 1.1.1.1 $
     136 * @since       PHP 5
     137 * @require     PHP 4.0.1 (trigger_error)
     138 */
     139if (!function_exists('stripos'))
     140{
     141    function stripos ($haystack, $needle, $offset = null)
     142    {
     143        if (!is_scalar($haystack)) {
     144            trigger_error('stripos() expects parameter 1 to be string, ' . gettype($haystack) . ' given', E_USER_WARNING);
     145            return false;
     146        }
     147
     148        if (!is_scalar($needle)) {
     149            trigger_error('stripos() needle is not a string or an integer.', E_USER_WARNING);
     150            return false;
     151        }
     152
     153        if (!is_null($offset) && !is_numeric($offset)) {
     154            trigger_error('stripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING);
     155            return false;
     156        }
     157
     158        // Manipulate the string if there is an offset                   
     159        $fix = 0;
     160        if (!is_null($offset))
     161        {
     162            if ($offset > 0)
     163            {
     164                $haystack = substr($haystack, $offset, strlen($haystack) - $offset);
     165                $fix = $offset;
     166            }
     167        }
     168
     169        $segments = explode (strtolower($needle), strtolower($haystack), 2);
     170        $position = strlen($segments[0]) + $fix;
     171
     172        return $position;
     173    }
     174}
     175
    128176class TarchDbase {
    129177
     
    132180        function TarchDbase( $ip = null, $dbase = null ) {
    133181
     182                global $CLUSTER_CONFS, $clustername;
    134183                global $JOB_ARCHIVE_DBASE;
    135184
     185                // Import cluster specific settings
     186                //
     187                foreach( $CLUSTER_CONFS as $confcluster => $conffile )
     188                {
     189                        if( strtolower( trim($this->clustername) ) == strtolower(trim($confcluster)) )
     190                        {
     191                                include_once $conffile;
     192                        }
     193                }
     194
    136195                $db_fields = explode( '/', $JOB_ARCHIVE_DBASE );
    137196
    138                 $this->ip = $db_fields[0];
    139                 $this->dbase = $db_fields[1];
    140                 $this->conn = null;
     197                $this->ip       = $db_fields[0];
     198                $this->dbase    = $db_fields[1];
     199                $this->conn     = null;
    141200        }
    142201
     
    194253                        $this->resultcount = (int) $count_result[0][count];
    195254
    196                         $select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id LIMIT " . $SEARCH_RESULT_LIMIT;
     255                        $select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id DESC LIMIT " . $SEARCH_RESULT_LIMIT;
    197256                }
    198257
     
    10651124
    10661125                global $SORTBY_HOSTNAME, $SORT_ORDER, $skan_str;
    1067                 //global $skan_str;
    10681126                global $x_first, $y_first;
    10691127
    10701128                foreach( $CLUSTER_CONFS as $confcluster => $conffile )
    10711129                {
    1072                         //printf( "cf %s cc %s\n", $this->clustername, $confcluster);
    1073                         //printf( "cf %s cc %s\n", strtolower( trim($this->clustername)), trim($confcluster) );
    10741130                        if( strtolower( trim($this->clustername) ) == strtolower(trim($confcluster)) )
    10751131                        {
    1076                                 //printf( "cf %s cc %s\n", $conffile, $confcluster);
    10771132                                include_once $conffile;
    10781133                        }
Note: See TracChangeset for help on using the changeset viewer.