Commit b10594cd authored by Nigel McNie's avatar Nigel McNie

Performance improvements for the artefact cache rebuilding cron job.

Instead of selecting every row from the artefact table, only select the IDs. This will reduce the dataset retrieved dramatically.
parent 4d58f15f
......@@ -88,14 +88,12 @@ function rebuild_artefact_parent_cache_dirty() {
function rebuild_artefact_parent_cache_complete() {
db_begin();
delete_records('artefact_parent_cache');
if ($artefacts = get_records_array('artefact')) {
foreach ($artefacts as $a) {
$parentids = array();
$current = $a->id;
$parentids = array_keys(artefact_get_parents_for_cache($current));
if ($artefactids = get_column('artefact', 'id')) {
foreach ($artefactids as $id) {
$parentids = array_keys(artefact_get_parents_for_cache($id));
foreach ($parentids as $p) {
$apc = new StdClass;
$apc->artefact = $a->id;
$apc->artefact = $id;
$apc->parent = $p;
$apc->dirty = 0;
insert_record('artefact_parent_cache', $apc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment