Skip to content

Instantly share code, notes, and snippets.

@kehh
Last active September 5, 2016 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kehh/5f507c12deec226107ac35ec243c68ff to your computer and use it in GitHub Desktop.
Save kehh/5f507c12deec226107ac35ec243c68ff to your computer and use it in GitHub Desktop.
Rebuild CollectiveAccess Hierarchical Indexes
<?php
require_once('setup.php');
require_once(__CA_LIB_DIR__.'/core/Datamodel.php');
set_time_limit(3600*8);
$o_db = new Db();
$t_timer = new Timer();
$o_dm = Datamodel::load();
$va_table_names = $o_dm->getTableNames();
$vn_tc = 0;
foreach($va_table_names as $vs_table) {
if ($o_instance = $o_dm->getInstanceByTableName($vs_table)) {
if ($o_instance->isHierarchical()) {
if (!$o_instance->rebuildAllHierarchicalIndexes()) {
$o_instance->rebuildHierarchicalIndex();
}
}
}
$vn_tc++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment