protected function CheckCoreDirectoriesHelper($strDirectory, $strBaseDirectory, $strToken, $blnIsCore) { if (!is_dir($strDirectory)) { return; } // Pull out the Files as an Array $objDirectory = opendir($strDirectory); $strFileArray = array(); while ($strFile = readdir($objDirectory)) { array_push($strFileArray, $strFile); } closedir($objDirectory); foreach ($strFileArray as $strFile) { if ($strFile != '.' && $strFile != '..' && $strFile != '.svn' && $strFile != 'CVS' && $strFile != '.cvsignore' && strtolower($strFile) != '.ds_store') { $strFilePath = $strDirectory . '/' . $strFile; if (is_dir($strFilePath)) { $this->CheckCoreDirectoriesHelper($strFilePath, $strBaseDirectory, $strToken, $blnIsCore); } else { if (array_key_exists(strtolower($strFilePath), $this->strTouchedFile) && $this->strTouchedFile[strtolower($strFilePath)]) { // If we're here, then we've already accounted for this file. // Do Nothing } else { if ($blnIsCore || strpos($strFilePath, '/_core/') !== false) { // We're Dealing with a CORE file $strManifestFileName = str_replace($strBaseDirectory, '', $strFilePath); // Check to see the "state" of this file $intReturnCode = file_get_contents(sprintf('%sGetFileState?mav=%s&miv=%s&bld=%s&pth=%s&tok=%s', QUpdateUtility::ServiceUrl, $this->intMajor, $this->intMinor, $this->intBuild, urlencode($strManifestFileName), $strToken)); if ($intReturnCode == 0) { if (!QUpdateUtility::IsSuffixedFile($strFilePath)) { $this->strExtraArray[$strToken . '|' . $strManifestFileName] = $strFilePath; } } else { if ($intReturnCode == -1) { $this->strDeprecatedArray[$strToken . '|' . $strManifestFileName] = $strFilePath; } else { $this->strAlertArray[] = 'Undecipherable issue with ' . $strFilePath . ' (a.k.a. ' . $strManifestFilePath . ')'; } } } $this->strTouchedFile[strtolower($strFilePath)] = true; } } } } }
<?php /* This includes library file is used by the qcodo_downloader.cli and qcodo_downloader.phpexe scripts * to perform the Qcodo Update Utility's File Downloading functionality. */ // Ensure that there are parameters if ($_SERVER['argc'] != 6) { QUpdateUtility::PrintDownloaderInstructions(); } $strVersion = trim(strtolower($_SERVER['argv'][2])); if ($strVersion == 'stable' || $strVersion == 'development') { QUpdateUtility::Error('Invalid Version format: ' . $strVersion); } $objUpdateUtility = new QUpdateUtility($strVersion); $objUpdateUtility->RunDownloader($_SERVER['argv'][3], $_SERVER['argv'][4], $_SERVER['argv'][5]);
break; case QUpdateUtility::Force: $strInteractionType = QUpdateUtility::Force; break; case QUpdateUtility::ReportOnly: $strInteractionType = QUpdateUtility::ReportOnly; break; default: QUpdateUtility::Error('Invalid Interaction Mode: ' . $strArgument); break; } if ($intIndex == $_SERVER['argc'] - 1) { QUpdateUtility::Error('No Qcodo Version was specified'); } } else { if ($strArgument == '--help') { QUpdateUtility::PrintUpdaterInstructions(true); } else { if ($intIndex != $_SERVER['argc'] - 1 || substr($strArgument, 0, 1) == '-') { QUpdateUtility::Error('Invalid Option/Argument: ' . $strArgument); } } } } } if ($strInteractionType != QUpdateUtility::ReportOnly) { printf("Qcodo Update Utility - Performing '%s' Update...\r\n", $strInteractionType); } $strVersion = $_SERVER['argv'][$_SERVER['argc'] - 1]; $objUpdateUtility = new QUpdateUtility($strVersion); $objUpdateUtility->RunUpdater($strInteractionType, $blnQuietMode);
function QUpdateUtilityErrorHandler($intErrorNumber, $strErrorString, $strErrorFile, $intErrorLine) { QUpdateUtility::Error('Could not connect to Qcodo Update webservice at ' . QUpdateUtility::ServiceUrl . ' (' . $strErrorString . ')'); }