#!/usr/bin/env php
<?php

use Aplia\Bootstrap\Base;

// Disable cache loading, we want to create it from scratch
$GLOBALS['STARTER_APP_CACHE'] = false;
$GLOBALS['STARTER_BASE_INIT'] = false;
require_once __DIR__ . '/../../../../config.php';

$app = Base::app();

$frameworks = isset($GLOBALS['STARTER_ALL_FRAMEWORKS']) ? $GLOBALS['STARTER_ALL_FRAMEWORKS'] : array('ezp', 'plain');
$buildPath = $app->config->get("app.buildPath");
foreach ($frameworks as $framework) {
    $configCache = Base::pathJoin(array($buildPath, "config_${framework}.json"));
    if (file_exists($configCache)) {
        echo "Deleting $configCache\n";
        unlink($configCache);
    }

    $bootstrap = Base::pathJoin(array($buildPath, "bootstrap_${framework}.php"));
    if (file_exists($bootstrap)) {
        echo "Deleting $bootstrap\n";
        unlink($bootstrap);
    }
}
