sms-store/bin/clear-config-cache.php

47 lines
1.1 KiB
PHP
Raw Normal View History

2017-09-03 17:51:59 +02:00
<?php
/**
* Script for clearing the configuration cache.
*
* Can also be invoked as `composer clear-config-cache`.
*
2020-09-07 20:54:56 +02:00
* @see https://github.com/mezzio/mezzio-skeleton for the canonical source repository
2017-09-03 17:51:59 +02:00
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
2020-09-07 20:54:56 +02:00
* @license https://github.com/mezzio/mezzio-skeleton/blob/master/LICENSE.md New BSD License
2017-09-03 17:51:59 +02:00
*/
chdir(__DIR__ . '/../');
require 'vendor/autoload.php';
$config = include 'config/config.php';
if (! isset($config['config_cache_path'])) {
echo "No configuration cache path found" . PHP_EOL;
exit(0);
}
if (! file_exists($config['config_cache_path'])) {
printf(
"Configured config cache file '%s' not found%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);
}
if (false === unlink($config['config_cache_path'])) {
printf(
"Error removing config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(1);
}
printf(
"Removed configured config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);