Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove deleteFromOpcodeCache & clearOpcodeCache
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Jan 30, 2019
commit 9104e028a399ed2bbda63204c7627d75f9f5f381
6 changes: 2 additions & 4 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,8 @@ private function writeData() {
flock($filePointer, LOCK_UN);
fclose($filePointer);

// Try invalidating the opcache just for the file we wrote...
if (!\OC_Util::deleteFromOpcodeCache($this->configFilePath)) {
// But if that doesn't work, clear the whole cache.
\OC_Util::clearOpcodeCache();
if (function_exists('opcache_invalidate')) {
@opcache_invalidate($this->configFilePath, true);
}
}
}
Expand Down
31 changes: 0 additions & 31 deletions lib/private/legacy/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -1323,37 +1323,6 @@ public static function getTheme() {
return $theme;
}

/**
* Clear a single file from the opcode cache
* This is useful for writing to the config file
* in case the opcode cache does not re-validate files
* Returns true if successful, false if unsuccessful:
* caller should fall back on clearing the entire cache
* with clearOpcodeCache() if unsuccessful
*
* @param string $path the path of the file to clear from the cache
* @return bool true if underlying function returns true, otherwise false
*/
public static function deleteFromOpcodeCache($path): bool {
if (!empty($path) && function_exists('opcache_invalidate')) {
return @opcache_invalidate($path); // Zend OpCache >= 7.0.0, PHP >= 5.5.0
}
return false;
}

/**
* Clear the opcode cache if one exists
* This is necessary for writing to the config file
* in case the opcode cache does not re-validate files
*
* @return void
*/
public static function clearOpcodeCache(): void {
if (function_exists('opcache_reset')) {
@opcache_reset(); // Opcache (PHP >= 5.5)
}
}

/**
* Normalize a unicode string
*
Expand Down