mirror of https://github.com/MISP/MISP
Restore missing tasks if needed and some updates to the install script
- If a task is missing then visiting the task index will automatically re-create it - MYSQL.sql brought up to date, the upgrade scripts in the application shouldn't have to run on first loginpull/976/head
parent
d1d6b9e5b4
commit
8c7e96a369
|
@ -1,5 +1,18 @@
|
|||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `admin_settings`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `admin_settings` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`setting` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
`value` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `attributes`
|
||||
--
|
||||
|
@ -114,6 +127,25 @@ CREATE TABLE IF NOT EXISTS `events` (
|
|||
|
||||
-- -------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for `event_delegations`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `event_delegations` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`org_id` int(11) NOT NULL,
|
||||
`requester_org_id` int(11) NOT NULL,
|
||||
`event_id` int(11) NOT NULL,
|
||||
`message` text,
|
||||
`distribution` tinyint(4) NOT NULL DEFAULT '-1',
|
||||
`sharing_group_id` int(11),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `org_id` (`org_id`),
|
||||
KEY `event_id` (`event_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for `event_tags`
|
||||
--
|
||||
|
@ -320,6 +352,35 @@ CREATE TABLE IF NOT EXISTS `shadow_attributes` (
|
|||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `shadow_attribute_correlations`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `shadow_attribute_correlations` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`org_id` int(11) NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
`distribution` tinyint(4) NOT NULL,
|
||||
`a_distribution` tinyint(4) NOT NULL,
|
||||
`sharing_group_id` int(11),
|
||||
`a_sharing_group_id` int(11),
|
||||
`attribute_id` int(11) NOT NULL,
|
||||
`1_shadow_attribute_id` int(11) NOT NULL,
|
||||
`event_id` int(11) NOT NULL,
|
||||
`1_event_id` int(11) NOT NULL,
|
||||
`info` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `org_id` (`org_id`),
|
||||
KEY `attribute_id` (`attribute_id`),
|
||||
KEY `a_sharing_group_id` (`a_sharing_group_id`),
|
||||
KEY `event_id` (`event_id`),
|
||||
KEY `1_event_id` (`event_id`),
|
||||
KEY `sharing_group_id` (`sharing_group_id`),
|
||||
KEY `1_shadow_attribute_id` (`1_shadow_attribute_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `sharing_group_orgs`
|
||||
--
|
||||
|
@ -390,18 +451,6 @@ CREATE TABLE IF NOT EXISTS `tags` (
|
|||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`timer` int(11) NOT NULL,
|
||||
`scheduled_time` varchar(8) NOT NULL DEFAULT '6:00',
|
||||
`job_id` int(11) NOT NULL,
|
||||
`description` varchar(255) NOT NULL,
|
||||
`next_execution_time` int(11) NOT NULL,
|
||||
`message` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -577,6 +626,8 @@ CREATE TABLE IF NOT EXISTS `users` (
|
|||
`contactalert` tinyint(1) NOT NULL,
|
||||
`disabled` BOOLEAN NOT NULL,
|
||||
`expiration` datetime DEFAULT NULL,
|
||||
`current_login` INT(11) DEFAULT 0,
|
||||
`last_login` INT(11) DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `email` (`email`),
|
||||
INDEX `org_id` (`org_id`),
|
||||
|
@ -634,6 +685,9 @@ CREATE TABLE IF NOT EXISTS `taxonomy_predicates` (
|
|||
-- Default values for initial installation
|
||||
--
|
||||
|
||||
INSERT INTO `admin_settings` (`id`, `setting`, `value`) VALUES
|
||||
(1, 'db_version', '2.4.21');
|
||||
|
||||
INSERT INTO `regexp` (`id`, `regexp`, `replacement`, `type`) VALUES
|
||||
(1, '/.:.ProgramData./i', '%ALLUSERSPROFILE%\\\\', 'ALL'),
|
||||
(2, '/.:.Documents and Settings.All Users./i', '%ALLUSERSPROFILE%\\\\', 'ALL'),
|
||||
|
|
|
@ -35,9 +35,11 @@ class TasksController extends AppController {
|
|||
// default tasks are:
|
||||
// 'cache_exports'
|
||||
private function __checkTasks() {
|
||||
foreach ($this->Task->tasks as $default_task) {
|
||||
if (!$this->Task->findByType($default_task['type'], array('id', 'type'))) {
|
||||
$this->Task->save($default_task);
|
||||
$existingTasks = $this->Task->find('list', array('fields' => array('type')));
|
||||
foreach ($this->Task->tasks as $taskName => $taskData) {
|
||||
if (!in_array($taskName, $existingTasks)) {
|
||||
$this->Task->create();
|
||||
$this->Task->save($taskData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class AppModel extends Model {
|
|||
// major -> minor -> hotfix -> requires_logout
|
||||
public $db_changes = array(
|
||||
2 => array(
|
||||
4 => array(18 => true, 19 => false, 20 => false)
|
||||
4 => array(18 => false, 19 => false, 20 => false)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -7,13 +7,36 @@ App::uses('AppModel', 'Model');
|
|||
*/
|
||||
class Task extends AppModel {
|
||||
public $tasks = array(
|
||||
'cache_exports' => array(
|
||||
'type' => 'cache_exports',
|
||||
'timer' => 0,
|
||||
'scheduled_time' => 0,
|
||||
'recurring' => false,
|
||||
'description' => 'Generates export caches for every export type and for every organisation. This process is heavy, schedule so it might be a good idea to schedule this outside of working hours and before your daily automatic imports on connected services are scheduled.'
|
||||
));
|
||||
'cache_exports' => array(
|
||||
'type' => 'cache_exports',
|
||||
'timer' => 0,
|
||||
'scheduled_time' => '12:00',
|
||||
'job_id' => 0,
|
||||
'description' => 'Generates export caches for every export type and for every organisation. This process is heavy, schedule so it might be a good idea to schedule this outside of working hours and before your daily automatic imports on connected services are scheduled.',
|
||||
'next_execution_time' => 1391601600,
|
||||
'message' => 'Not scheduled yet.'
|
||||
|
||||
),
|
||||
'pull_all' => array(
|
||||
'type' => 'pull_all',
|
||||
'timer' => 0,
|
||||
'scheduled_time' => '12:00',
|
||||
'job_id' => 0,
|
||||
'description' => 'Initiates a full pull for all eligible instances.',
|
||||
'next_execution_time' => 1391601600,
|
||||
'message' => 'Not scheduled yet.'
|
||||
|
||||
),
|
||||
'push_all' => array(
|
||||
'type' => 'push_all',
|
||||
'timer' => 0,
|
||||
'scheduled_time' => '12:00',
|
||||
'job_id' => 0,
|
||||
'description' => 'Initiates a full push for all eligible instances.',
|
||||
'next_execution_time' => 1391601600,
|
||||
'message' => 'Not scheduled yet.'
|
||||
)
|
||||
);
|
||||
|
||||
// takes a time in the 24h format (13:49) and an integer representing the number of hours
|
||||
// by which it needs to be incremeneted. Returns a string in the first parameters format
|
||||
|
|
Loading…
Reference in New Issue