Wipe index when on configuration change
parent
9067b4462f
commit
1e319c7215
|
@ -42,6 +42,9 @@ abstract class AbstractAggregateIndex implements ReadableIndex
|
||||||
$index->on('definition-added', function () {
|
$index->on('definition-added', function () {
|
||||||
$this->emit('definition-added');
|
$this->emit('definition-added');
|
||||||
});
|
});
|
||||||
|
$index->on('wipe', function() {
|
||||||
|
$this->emit('wipe');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,4 +150,14 @@ abstract class AbstractAggregateIndex implements ReadableIndex
|
||||||
}
|
}
|
||||||
return $refs;
|
return $refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wipe all indexes for a reindex
|
||||||
|
*/
|
||||||
|
public function wipe()
|
||||||
|
{
|
||||||
|
foreach ($this->getIndexes() as $index) {
|
||||||
|
$index->wipe();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,4 +211,14 @@ class Index implements ReadableIndex, \Serializable
|
||||||
'staticComplete' => $this->staticComplete
|
'staticComplete' => $this->staticComplete
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function wipe()
|
||||||
|
{
|
||||||
|
$this->definitions = [];
|
||||||
|
$this->references = [];
|
||||||
|
$this->complete = false;
|
||||||
|
$this->staticComplete = false;
|
||||||
|
|
||||||
|
$this->emit('wipe');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,4 +170,9 @@ class Workspace
|
||||||
}
|
}
|
||||||
return $dependencyReferences;
|
return $dependencyReferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function didChangeConfiguration($settings = null)
|
||||||
|
{
|
||||||
|
$this->index->wipe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue