Now we made a couple advances and could solve many errors. The remaining and unresolved error-messages at the moment are of these type:
+++++
(ERROR @ /server/modx/core/xpdo/cache/xpdocachemanager.class.php : 413) PHP warning: unlink(/server/modx/core/cache/objects/modTemplateVarResource/2c3468c42bcf1c299e5839accdace0ea.cache.php) [<a href=’function.unlink’>function.unlink</a>]: No such file or directory
(ERROR @ /server/modx/core/xpdo/cache/xpdocachemanager.class.php : 421) PHP warning: closedir(): 413 is not a valid Directory resource
+++++
As far as we have seen these errors are produced within the function deleteTree() (Lines 413 and 421, see code below.) Obviously the requested files don`t exist.
Does anybody know what are these files about? Did they never exist or have they already deleted before?
code of the function deleteTree() (in xpdocachemanager.class.php): (Lines 413 and 421 marked with little stars)
/**
* Recursively deletes a directory tree of files.
*
* @access public
* @param string $dirname An absolute path to the source directory to delete.
* @param array $options An array of options for this function.
* @return boolean Returns true if the deletion was successful.
*/
public function deleteTree($dirname, $options= array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php'))) {
$result= false;
if (is_dir($dirname)) { /* Operate on dirs only */
if (substr($dirname, -1) != '/') {
$dirname .= '/';
}
$result= array ();
if (!is_array($options)) {
$numArgs = func_num_args();
$options = array(
'deleteTop' => is_scalar($options) ? (boolean) $options : false
,'skipDirs' => $numArgs > 2 ? func_get_arg(2) : false
,'extensions' => $numArgs > 3 ? func_get_arg(3) : array('.cache.php')
);
}
$hasMore= true;
if ($handle= opendir($dirname)) {
$limit= 4;
$extensions= $this->getOption('extensions', $options, array('.cache.php'));
$excludeItems = $this->getOption('delete_exclude_items', $options, array('.', '..','.svn','.svn/','.svn\\'));
$excludePatterns = $this->getOption('delete_exclude_patterns', $options);
while ($hasMore && $limit--) {
if (!$handle) {
$handle= opendir($dirname);
}
$hasMore= false;
while (false !== ($file= @ readdir($handle))) {
if (is_array($excludeItems) && !empty($excludeItems) && in_array($file, $excludeItems)) continue;
if (is_array($excludePatterns) && !empty($excludePatterns) && $this->matches($file, $excludePatterns)) continue;
if ($file != '.' && $file != '..') { /* Ignore . and .. */
$path= $dirname . $file;
if (is_dir($path)) {
$suboptions = $this->getOption('deleteTop', $options, false) ? $options : array_merge($options, array('deleteTop' => false));
if ($subresult= $this->deleteTree($path, $suboptions)) {
$result= array_merge($result, $subresult);
}
}
elseif (is_file($path)) {
if (is_array($extensions) && !empty($extensions) && !$this->endsWith($file, $extensions)) continue;
**************************************
LINE 413: if (unlink($path)) {
**************************************
array_push($result, $path);
} else {
$hasMore= true;
}
}
}
}
**************************************
LINE 421: closedir($handle);
**************************************
}
$options['deleteTop']= $this->getOption('skipDirs', $options, false) ? false : $this->getOption('deleteTop', $options, false);
if ($this->getOption('deleteTop', $options, false)) {
if (@ rmdir($dirname)) {
array_push($result, $dirname);
}
}
}
} else {
$result= false; /* return false if attempting to operate on a file */
}
return $result;
}
Many thanks in advance!
Letti