Exemple #1
0
	/**
	 * Method returns information if currently available
	 * extension list might be outdated.
	 *
	 * @access public
	 * @see Tx_Extensionmanager_Utility_Repository_Helper::PROBLEM_NO_VERSIONS_IN_DATABASE,
	 * @throws ExtensionManagerException
	 * @return int "0" if everything is perfect, otherwise bitmask with problems
	 */
	public function isExtListUpdateNecessary() {
		$updateNecessity = 0;
		if ($this->extensionRepository->countByRepository($this->repository->getUid()) <= 0) {
			$updateNecessity |= self::PROBLEM_NO_VERSIONS_IN_DATABASE;
		}
		if (!is_file($this->getLocalExtListFile())) {
			$updateNecessity |= self::PROBLEM_EXTENSION_FILE_NOT_EXISTING;
		} else {
			$remotemd5 = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($this->getRemoteExtHashFile(), 0, array(TYPO3_user_agent));
			if ($remotemd5 !== FALSE) {
				$localmd5 = md5_file($this->getLocalExtListFile());
				if ($remotemd5 !== $localmd5) {
					$updateNecessity |= self::PROBLEM_EXTENSION_HASH_CHANGED;
				}
			} else {
				throw new ExtensionManagerException('Could not retrieve extension hash file from remote server.', 1342635016);
			}
		}
		return $updateNecessity;
	}