PHP Classes

File: engine/modules/core/cache/cache.hook.inc

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/core/cache/cache.hook.inc   Download  
File: engine/modules/core/cache/cache.hook.inc
Role: Example script
Content type: text/plain
Description: Example script
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 6 years ago
Size: 1,162 bytes
 

Contents

Class file image Download
<?php

/**
 * TODO: deprecated but maybe still useful.
 * Temporary function to regenerate all json files in the system. Handle with care!
 * @param $vars

function cache_regenerate_json($env, $vars) {
  $wikiroot = $env->dir['wiki'];
  $scan = $env->scanDirectory($wikiroot, array(
    'exclude_dirs' => DIR_ALL,
    'type' => DIR_DIRS,
  ));
  foreach ($scan as $k => $scanned) {
    $node = new Node($env, $scanned);
    if (!$node->isEmpty()) {
      $node->save();
    }
  }
}
 */

/**
 * Cache wiki page. Implements hook_boot
 *
 * @param Environment $env
 * The Environment.
 * @param $vars
 * An array of variables.
 */
function cache_boot($env, $vars) {
 
$env->tmpdir('cache', CACHE_FOLDER);
}

/**
 * Implements hook_clear_cache().
 *
 * Clears all cached node paths.
 *
 * @param Environment $env
 * The Environment.
 * @param array $vars
 * An array of variables.
 */
function cache_doctor_clear_cache($env, $vars) {
 
/** @var Doctor $doctor */
 
$doctor = $vars['doctor'];
 
$doctor->op('Running clear cache hooks...');
 
$doctor->op('Deleting all cached paths...');
 
exec('rm -r ' . $env->dir('cache') . '/*');
 
$doctor->ok('Done!');
}