public function writeContextCache()
 {
     if ($this->clearedContextFiles == true) {
         return;
     }
     if ($this->writeCache == false) {
         return;
     }
     $contextFile = $this->getContextCacheFile();
     //        error_log('Wrote context cache');
     $cacheContents = '<?php
         $this->plugins = ' . var_export($this->plugins, true) . ';
         ClassLoader::setClassNames(' . var_export(ClassLoader::getClassNames(), true) . ');
         $this->context = ' . var_export($this->context, true) . ';
         $this->aliasMap = ' . var_export($this->aliasMap, true) . ';
         $this->events = ' . var_export($this->contextEvents, true) . ';
         $this->pluginDirectories = ' . var_export($this->pluginDirectories, true) . ';
         $this->enabledPluginDirectories = ' . var_export($this->enabledPluginDirectories, true) . ';';
     $cacheContents .= "\n\n";
     foreach ($this->plugins as $plugin) {
         if (!empty($plugin['directory'])) {
             $const = $this->getPluginConstant($plugin);
             $cacheContents .= "if(defined(\"{$const}\") === FALSE) define(\"{$const}\",\"{$plugin['directory']}\");\n";
         }
     }
     $cacheContents .= "return true;";
     ContextUtils::safeFilePutContents($contextFile, $cacheContents);
 }