You are here

function HTMLPurifier_DefinitionCache_Drupal::cleanup in HTML Purifier 7.2

Same name and namespace in other branches
  1. 5 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::cleanup()
  2. 6.2 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::cleanup()
  3. 6 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::cleanup()
  4. 7 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::cleanup()

File

./HTMLPurifier_DefinitionCache_Drupal.php, line 73

Class

HTMLPurifier_DefinitionCache_Drupal

Code

function cleanup($config) {

  // TODO: This does not work with the pluggable cache system in Drupal 7,
  // since it assumes a database cache is being used.
  $res = db_query("SELECT cid FROM {cache} WHERE cid LIKE :cid", array(
    ':cid' => 'htmlpurifier:%',
  ));
  foreach ($res as $row) {
    $key = substr($row->cid, 13);

    // 13 == strlen('htmlpurifier:')
    if ($this
      ->isOld($key, $config)) {
      cache_clear_all($row->cid, 'cache');
    }
  }
}