Skip to content

Commit

Permalink
[mms] Saving cache data should be handled in a shutdown function, not…
Browse files Browse the repository at this point in the history
… a destructor.
  • Loading branch information
slusarz committed Jan 30, 2014
1 parent fd027a0 commit 908e813
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions framework/Autoloader_Cache/lib/Horde/Autoloader/Cache.php
Expand Up @@ -116,6 +116,10 @@ public function __construct()
$this->_cachetype = self::TEMPFILE;
}

if ($this->_cachetype) {
register_shutdown_function(array($this, 'shutdown'));
}

if ($data) {
if (extension_loaded('horde_lz4')) {
$data = @horde_lz4_uncompress($data);
Expand All @@ -137,13 +141,13 @@ public function __construct()
}

/**
* Destructor.
* Shutdown method.
*
* Attempts to save the class map to the cache.
*/
public function __destruct()
public function shutdown()
{
if (!$this->_changed || !$this->_cachetype) {
if (!$this->_changed) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions framework/Autoloader_Cache/package.xml
Expand Up @@ -27,6 +27,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Saving cache data should be handled in a shutdown function, not a destructor.
* [mms] Add Horde-specific prefix to filesystem cache name to allow for easy identification.
</notes>
<contents>
Expand Down Expand Up @@ -306,6 +307,7 @@
<date>2013-11-12</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Saving cache data should be handled in a shutdown function, not a destructor.
* [mms] Add Horde-specific prefix to filesystem cache name to allow for easy identification.
</notes>
</release>
Expand Down

0 comments on commit 908e813

Please sign in to comment.