Exemplo n.º 1
0
        /**
         * Returns the Quercus instance.
         */
        protected override QuercusContext getQuercus()
        {
            if (_quercus == null)
            {
                _quercus = new GoogleQuercus();

                if (_gsBucket != null)
                {
                    _quercus.setIni("google.cloud_storage_bucket", _gsBucket);
                }
            }

            return(_quercus);
        }
        public override void init(ServletConfig config)
        {
            super.init(config);

            _context = config.getServletContext();
            _cache   = new LruCache <String, CacheEntry>(1024);

            _pwd = new FilePath(_context.getRealPath("/"));

            string mode
                = System.getProperty("com.google.appengine.tools.development.ApplicationPreparationMode");

            bool isGsDisabled = "true".equals(mode);

            if (!isGsDisabled)
            {
                string iniPath = getInitParameter("ini-file");

                if (iniPath != null)
                {
                    string realPath = _context.getRealPath(iniPath);

                    // don't call Quercus.init() as that will load all the modules for calling
                    // from PHP code, which we don't use nor want
                    GoogleQuercus quercus = new GoogleQuercus();
                    quercus.setIniFile(_pwd.lookup(realPath));

                    _gsBucket = quercus.getIniString("google.cloud_storage_bucket");

                    if (_gsBucket != null)
                    {
                        _pwd = new GoogleMergePath(_pwd, _gsBucket, true);
                    }
                }
            }

            log.log(Level.INFO, L.l("{0} initialized with bucket={1},pwd={2}",
                                    getClass().getSimpleName(), _gsBucket, _pwd.getUserPath()));
        }