Bladeren bron

N. 550 the OpCode cache may cause the upgrade of the datamodel to fail. Let's flush it after the compilation.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4494 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 8 jaren geleden
bovenliggende
commit
e170139b58
1 gewijzigde bestanden met toevoegingen van 15 en 0 verwijderingen
  1. 15 0
      setup/compiler.class.inc.php

+ 15 - 0
setup/compiler.class.inc.php

@@ -124,6 +124,21 @@ class MFCompiler
 			// Move the results to the target directory
 			SetupUtils::movedir($sTempTargetDir, $sFinalTargetDir);
 		}
+		
+		// Reset the opcache since otherwise the PHP "model" files may still be cached !!
+		// In case of bad luck (this happens **sometimes** - see N. 550), we may analyze the database structure
+		// with the previous datamodel still loaded (in opcode cache) and thus fail to create the new fields
+		// Finally the application crashes (because of the missing field) when the cache gets updated
+		if (function_exists('opcache_reset'))
+		{
+			// Zend opcode cache
+			opcache_reset();
+		}
+		else if (function_exists('apc_clear_cache'))
+		{
+			// old style APC
+			apc_clear_cache();
+		}
 	}