/** * Check if the temporary file is MacBinary-encoded, as some uploads * from Internet Explorer on Mac OS Classic and Mac OS X will be. * If so, the data fork will be extracted to a second temporary file, * which will then be checked for validity and either kept or discarded. * * @access private */ function checkMacBinary() { $macbin = new MacBinary($this->mUploadTempName); if ($macbin->isValid()) { $dataFile = tempnam(wfTempDir(), "WikiMacBinary"); $dataHandle = fopen($dataFile, 'wb'); wfDebug("SpecialUpload::checkMacBinary: Extracting MacBinary data fork to {$dataFile}\n"); $macbin->extractData($dataHandle); $this->mUploadTempName = $dataFile; $this->mUploadSize = $macbin->dataForkLength(); // We'll have to manually remove the new file if it's not kept. $this->mRemoveTempFile = true; } $macbin->close(); }
/** * Check if the temporary file is MacBinary-encoded, as some uploads * from Internet Explorer on Mac OS Classic and Mac OS X will be. * If so, the data fork will be extracted to a second temporary file, * which will then be checked for validity and either kept or discarded. */ private function checkMacBinary() { $macbin = new MacBinary($this->mTempPath); if ($macbin->isValid()) { $dataFile = tempnam(wfTempDir(), 'WikiMacBinary'); $dataHandle = fopen($dataFile, 'wb'); wfDebug(__METHOD__ . ": Extracting MacBinary data fork to {$dataFile}\n"); $macbin->extractData($dataHandle); $this->mTempPath = $dataFile; $this->mFileSize = $macbin->dataForkLength(); // We'll have to manually remove the new file if it's not kept. $this->mRemoveTempFile = true; } $macbin->close(); }