Changeset 13387

Show
Ignore:
Timestamp:
11/12/07 11:16:54 (1 year ago)
Author:
rambo
Message:

specify host this entry is for (not all jobs can be executed under all host contexts), do not use RCS, use componentloader method to get interface class

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.services.at/config/mgdschema.sql

    r3202 r13387  
    1818  KEY midcom_services_at_entry_db_start_idx(start) 
    1919); 
     20ALTER TABLE midcom_services_at_entry_db ADD COLUMN host int(11) NOT NULL default '0'; 
  • branches/MidCOM_2_8/midcom.services.at/config/mgdschema.xml

    r2856 r13387  
    44        <property name="id" type="integer" primaryfield="id"/> 
    55        <property name="status" type="integer"/> 
     6        <property name="host" type="integer" link="midgard_host:id"/> 
    67        <property name="start" type="integer"/> 
    78        <property name="component" type="string"/> 
  • branches/MidCOM_2_8/midcom.services.at/cron/check.php

    r3012 r13387  
    3131        $qb = midcom_services_at_entry::new_query_builder(); 
    3232        $qb->add_constraint('start', '<=', time()); 
     33        $qb->begin_group('OR'); 
     34            $qb->add_constraint('host', '=', $_MIDGARD['host']); 
     35            $qb->add_constraint('host', '=', 0); 
     36        $qb->end_group(); 
    3337        $qb->add_constraint('status', '=', MIDCOM_SERVICES_AT_STATUS_SCHEDULED); 
    3438        debug_add('Executing QB'); 
     
    5256            $_MIDCOM->auth->drop_sudo(); 
    5357            $_MIDCOM->componentloader->load($entry->component); 
    54             $interface = str_replace('.', '_', $entry->component) . '_interface'; 
    5558            $args = $entry->arguments; 
    5659            $args['midcom_services_at_entry_object'] = $entry; 
    57             $mret = call_user_func 
    58                     ( 
    59                         array 
    60                         ( 
    61                             $interface, 
    62                             $entry->method 
    63                         ),  
    64                         $args, 
    65                         $this 
    66                     ); 
     60            $interface =& $_MIDCOM->componentloader->get_interface_class($entry->component); 
     61            $method =& $entry->method; 
     62            $mret = $interface->$method($args, $this); 
    6763            if ($mret !== true) 
    6864            { 
    69                 $error = "call_user_func(array({$interface}, {$entry->method}), {$entry->arguments}) returned '{$mret}', errstr: " . mgd_errstr(); 
     65                $error = "\$interface->{$method}(\$args, \$this) returned '{$mret}', errstr: " . mgd_errstr(); 
    7066                $this->print_error($error); 
    7167                debug_add($error, MIDCOM_LOG_ERROR); 
     68                debug_add('$interface is ' . get_class($interface)); 
     69                debug_print_r('$args', $args); 
    7270                //PONDER: Delete instead ? (There is currently nothing we do with failed entries) 
    7371                $entry->status = MIDCOM_SERVICES_AT_STATUS_FAILED; 
  • branches/MidCOM_2_8/midcom.services.at/cron/clean.php

    r10963 r13387  
    3131        // (to be) start(ed) AND last touched over two days ago 
    3232        $qb->add_constraint('start', '<=', time()-3600*24*2); 
     33        $qb->begin_group('OR'); 
     34            $qb->add_constraint('host', '=', $_MIDGARD['host']); 
     35            $qb->add_constraint('host', '=', 0); 
     36        $qb->end_group(); 
    3337        $qb->add_constraint('metadata.revised', '<=', date('Y-m-d H:i:s', time()-3600*24*2)); 
    3438        $qb->add_constraint('status', '>=', MIDCOM_SERVICES_AT_STATUS_RUNNING); 
  • branches/MidCOM_2_8/midcom.services.at/entry.php

    r5509 r13387  
    2626    function midcom_midcom_services_at_entry_db($id = null) 
    2727    { 
     28        $this->_use_rcs = false; 
    2829        return parent::__midcom_midcom_services_at_entry_db($id); 
    2930    } 
     
    5051        { 
    5152            $this->status = MIDCOM_SERVICES_AT_STATUS_SCHEDULED; 
     53        } 
     54        if (!$this->host) 
     55        { 
     56            $this->host = $_MIDGARD['host']; 
    5257        } 
    5358        $this->_serialize_arguments();