/** * Analyzes a FileXml from a QPM Manifest we are downloading to see what "category" it belongs to * (e.g. is it a new file to be installed, or is it going to auto-overwrite an existing file in the filesystem, * or is it going to have to modify and already-modified file in the filesystem) * @param SimpleXMLElement $objFileXml * @return string error message (if any) or null if none */ protected function AnalyzeFile(SimpleXMLElement $objFileXml) { $objFile = QFileInManifest::LoadFromQpmXml($objFileXml, $this->objDirectoryArray); // Is the DirectoryToken valid? if (!$objFile) { return 'directory token not defined in configuration.inc.php: ' . (string) $objFileXml['directoryToken']; } // Does this file currently exist in the filesystem? // Yep if ($objFile->RealPath) { // Does this file match the version with that in the QPM -- if so, add it to the "overwrite" array if ($objFile->IsMd5MatchWithFilesystem()) { $this->objOverwriteFileArray[] = $objFile; // Or does the file match the version with that in the Manifest (if applicable) -- if so, add it to the "overwrite" array } else { if (array_key_exists($objFile->RealPath, $this->objFileArrayByRealPath) && $this->objFileArrayByRealPath[$objFile->RealPath]->IsMd5MatchWithFilesystem()) { $this->objOverwriteFileArray[] = $objFile; // Otherwise, it doesn't match anything -- therefore, we will be modifying the local copy } else { $this->objModifiedFileArray[] = $objFile; } } // Nope -- it's a new file } else { $this->objNewFileArray[] = $objFile; } }