mirror of https://github.com/MISP/MISP
sync pull backwards compatibility with MISPv2
parent
3b28d6f1e8
commit
dbf1065b3b
|
@ -167,6 +167,8 @@ class ServersController extends AppController {
|
||||||
$this->redirect(array('action' => 'index'));
|
$this->redirect(array('action' => 'index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reverse array of events, to first get the old ones, and then the new ones
|
||||||
|
$eventIds = array_reverse($eventIds);
|
||||||
$successes = array();
|
$successes = array();
|
||||||
$fails = array();
|
$fails = array();
|
||||||
// download each event
|
// download each event
|
||||||
|
@ -185,13 +187,21 @@ class ServersController extends AppController {
|
||||||
// Distribution
|
// Distribution
|
||||||
switch($event['Event']['distribution']) {
|
switch($event['Event']['distribution']) {
|
||||||
case 1:
|
case 1:
|
||||||
|
case 'This community only': // backwards compatibility
|
||||||
// if community only, downgrade to org only after pull
|
// if community only, downgrade to org only after pull
|
||||||
$event['Event']['distribution'] = 0;
|
$event['Event']['distribution'] = 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
case 'Connected communities': // backwards compatibility
|
||||||
// if connected communities downgrade to community only
|
// if connected communities downgrade to community only
|
||||||
$event['Event']['distribution'] = 1;
|
$event['Event']['distribution'] = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'All communities': // backwards compatibility
|
||||||
|
$event['Event']['distribution'] = 3;
|
||||||
|
break;
|
||||||
|
case 'Your organisation only': // backwards compatibility
|
||||||
|
$event['Event']['distribution'] = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct $event if just one Attribute
|
// correct $event if just one Attribute
|
||||||
|
@ -210,13 +220,21 @@ class ServersController extends AppController {
|
||||||
}
|
}
|
||||||
switch($event['Event']['Attribute'][$i]['distribution']) {
|
switch($event['Event']['Attribute'][$i]['distribution']) {
|
||||||
case 1:
|
case 1:
|
||||||
|
case 'This community only': // backwards compatibility
|
||||||
// if community only, downgrade to org only after pull
|
// if community only, downgrade to org only after pull
|
||||||
$event['Event']['Attribute'][$i]['distribution'] = 0;
|
$event['Event']['Attribute'][$i]['distribution'] = 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
case 'Connected communities': // backwards compatibility
|
||||||
// if connected communities downgrade to community only
|
// if connected communities downgrade to community only
|
||||||
$event['Event']['Attribute'][$i]['distribution'] = 1;
|
$event['Event']['Attribute'][$i]['distribution'] = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'All communities': // backwards compatibility
|
||||||
|
$event['Event']['Attribute'][$i]['distribution'] = 3;
|
||||||
|
break;
|
||||||
|
case 'Your organisation only': // backwards compatibility
|
||||||
|
$event['Event']['Attribute'][$i]['distribution'] = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($toRemove as $thisRemove) {
|
foreach ($toRemove as $thisRemove) {
|
||||||
|
@ -256,7 +274,6 @@ class ServersController extends AppController {
|
||||||
// error
|
// error
|
||||||
$fails[$eventId] = 'failed';
|
$fails[$eventId] = 'failed';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (count($fails) > 0) {
|
if (count($fails) > 0) {
|
||||||
// there are fails, take the lowest fail
|
// there are fails, take the lowest fail
|
||||||
|
|
Loading…
Reference in New Issue