public function save() {
		if ($this->installTasks === null) {
			return;
		}
		
		// Let's grab all install tasks and save them according to their scope.
		// If no scope is provided, we default to global scope.
		
		$localInstalls = array();
		$globalInstalls = array();
		
		foreach ($this->installTasks as $task) {
			switch ($task->getScope()) {
				case AbstractInstallTask::SCOPE_GLOBAL:
				case '':
					$globalInstalls[] = $task->toArray();
					break;
				case AbstractInstallTask::SCOPE_LOCAL:
					$localInstalls[] = $task->toArray();
					break;
				default:
					throw new MoufException("Unknown install task scope '".$task->getScope()."'.");
			}
		}
		
		$this->ensureWritable($this->globalInstallFile);
		$this->ensureWritable($this->localInstallFile);
		
		$fp = fopen($this->globalInstallFile, "w");
		fwrite($fp, "<?php\n");
		fwrite($fp, "/**\n");
		fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
		fwrite($fp, " * This file contains the status of all Mouf global installation processes for packages you have installed.\n");
		fwrite($fp, " * If you are working with a source repository, this file should be commited.\n");
		fwrite($fp, " */\n");
		fwrite($fp, "return ".var_export($globalInstalls, true).";");
		fclose($fp);		
		
		$fp = fopen($this->localInstallFile, "w");
		fwrite($fp, "<?php\n");
		fwrite($fp, "/**\n");
		fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
		fwrite($fp, " * This file contains the status of all Mouf local installation processes for packages you have installed.\n");
		fwrite($fp, " * If you are working with a source repository, this file should NOT be commited.\n");
		fwrite($fp, " */\n");
		fwrite($fp, "return ".var_export($localInstalls, true).";");
		fclose($fp);

		@chmod($this->globalInstallFile, 0664);
		@chmod($this->localInstallFile, 0664);
        if (function_exists("opcache_invalidate")) {
            opcache_invalidate($this->globalInstallFile);
            opcache_invalidate($this->localInstallFile);
        }
    }