#!/usr/bin/env php
<?php
/**
 * Script to prune the autoloader cache.
 *
 * The (external) server name has to be specified in the SERVER_NAME
 * environment variable:
 * <code>
 * SERVER_NAME=www.example.com horde-autoloader-cache-prune
 * </code>
 *
 * Some of the caching extensions do not work when using the PHP
 * command line interface!
 *
 * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @author Jan Schneider <jan@horde.org>
 */

require_once 'Horde/Autoloader/Cache.php';

if ($__autoloader->prune()) {
    if (extension_loaded('apc')) {
        echo "Pruned from APC cache.\n";
    } elseif (extension_loaded('xcache')) {
        echo "Pruned from XCache cache.\n";
    } elseif (extension_loaded('eaccelerator')) {
        echo "Pruned from eAccelerator cache.\n";
    } else {
        echo "Pruned from file system cache.\n";
    }
} else {
    echo "No cache found or pruning failed.\n";
}
