public static function doAppEngineCheck() { if (Environment::onDevAppServer()) { // turn on error reporting and debugging Debug::enable(E_ERROR | E_PARSE); // fix Dev AppServer XML-loading bug Environment::fixXmlFileLoaderBug(); } if (self::onAppEngine() || self::onDevAppServer()) { self::checkBucketName(); } }
public function __construct($environment = null, $debug = null) { // determine the environment / debug configuration based on whether or not this is running // in App Engine's Dev App Server, or in production if (is_null($debug)) { $debug = !Environment::onAppEngine(); } if (is_null($environment)) { $environment = $debug ? 'dev' : 'prod'; } parent::__construct($environment, $debug); // Symfony console requires timezone to be set manually. if (!ini_get('date.timezone')) { date_default_timezone_set('UTC'); } // Enable optimistic caching for GCS. $options = ['gs' => ['enable_cache' => true, 'enable_optimistic_cache' => true, 'read_cache_expiry_seconds' => 300]]; stream_context_set_default($options); $this->gcsBucketName = getenv('GCS_BUCKET_NAME'); }
<?php /* * Copyright 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use AppEngine\Environment; $loader = (require_once __DIR__ . '/../app/bootstrap.php.cache'); require_once __DIR__ . '/../app/AppKernel.php'; Environment::doAppEngineCheck(); $kernel = new AppKernel(); $kernel->boot(); Environment::clearCache($kernel->getCacheDir()); echo 'cache cleared';
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ use Symfony\Component\HttpFoundation\Request; use AppEngine\Environment; /** * @var Composer\Autoload\ClassLoader */ $loader = (require __DIR__ . '/../app/autoload.php'); include_once __DIR__ . '/../app/bootstrap.php.cache'; // Perform checks in the AppEngine environment to ensure this app runs as expected on App Engine and // App Engine Dev Server Environment::doAppEngineCheck(); // Enable APC for autoloading to improve performance. // You should change the ApcClassLoader first argument to a unique prefix // in order to prevent cache key conflicts with other applications // also using APC. /* $apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader); $loader->unregister(); $apcLoader->register(true); */ require_once __DIR__ . '/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; $kernel = new AppKernel(); $kernel->loadClassCache(); //$kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter