Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Commit

Permalink
Opcache als invalid markieren, wenn Dateien beschrieben werden
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Apr 18, 2016
1 parent 53fdc45 commit fbdff22
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion _lastchanges.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Alle weiteren AddOns mit geplanten Änderungen etc. werden hier nicht abgehandel
Änderungen im Detail:
---------------------------------------------------------------------------------

Version 4.7.0 (2016-04-18)
Version 4.7.0 (2016-04-19)

Neu
* PHP 7 Unterstützung
* Neues Recht editMediaCategories[]

Bugfixes
* Probleme im Zusammenhang mit Opcache beseitigt (z. B. verzögerte Aktivierung von Addons etc.)


Version 4.6.2 (2015-10-27)

Wichtig
Expand Down
14 changes: 14 additions & 0 deletions redaxo/include/classes/util/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static function put($file, $content)

if (file_put_contents($file, $content) !== false) {
@chmod($file, $REX['FILEPERM']);
self::invalidateCache($file);
return true;
}

Expand Down Expand Up @@ -115,12 +116,25 @@ public static function copy($srcfile, $dstfile)
if (rex_dir::isWritable($dstdir) && (!file_exists($dstfile) || is_writable($dstfile)) && copy($srcfile, $dstfile)) {
touch($dstfile, filemtime($srcfile));
@chmod($dstfile, $REX['FILEPERM']);
self::invalidateCache($dstfile);
return true;
}
}
return false;
}

/**
* Invalidates the opcache for the given file
*
* @param string $file
*/
public static function invalidateCache($file)
{
if (function_exists('opcache_invalidate')) {
opcache_invalidate($file);
}
}

/**
* Deletes a file
*
Expand Down
1 change: 1 addition & 0 deletions redaxo/include/functions/function_rex_other.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ function rex_put_file_contents($path, $content)

$writtenBytes = file_put_contents($path, $content);
@ chmod($path, $REX['FILEPERM']);
rex_file::invalidateCache($path);

return $writtenBytes;
}
Expand Down

2 comments on commit fbdff22

@staabm
Copy link
Member

@staabm staabm commented on fbdff22 Apr 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brauchen wir das auch in r5?

@gharlan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bin ich noch am überlegen. Das Thema ist ja nur dann relevant, wenn man PHP-Dateien beschreibt, die per include später eingebunden werden. Das wurde in R4 sehr viel gemacht (master.inc.php, addons.inc.php und allgemein eigentlich alle Konfigurationen).
In R5 haben wir das deutlich weniger. Ich glaube, eigentlich nur bei den Cache-Dateien der Artikelinhalte, ansonsten nutzen wir json, yaml oder die DB.
Ich werde mal testen, ob es die festgestellten Probleme bei den Cache-Dateien auch gibt. Wenn ja, stellt sich die Frage, ob wir es in R5 eher nur speziell an entsprechenden Stellen machen, oder auch allgemein in den Datei-Schreib-Funktionen.

Please sign in to comment.