private function makeSureThereAreNoMissingRequirements($metadata) { $requires = array(); if (!empty($metadata->require)) { $requires = (array) $metadata->require; } $dependency = new PluginDependency(); $missingDependencies = $dependency->getMissingDependencies($requires); if (!empty($missingDependencies)) { $message = ''; foreach ($missingDependencies as $dep) { $params = array(ucfirst($dep['requirement']), $dep['actualVersion'], $dep['requiredVersion']); $message .= Piwik::translate('CorePluginsAdmin_MissingRequirementsNotice', $params); } throw new PluginInstallerException($message); } }
/** * @param $plugin */ private function addMissingRequirements($plugin) { $plugin['missingRequirements'] = array(); if (empty($plugin['versions']) || !is_array($plugin['versions'])) { return $plugin; } $latestVersion = $plugin['versions'][count($plugin['versions']) - 1]; if (empty($latestVersion['requires'])) { return $plugin; } $requires = $latestVersion['requires']; $dependency = new PluginDependency(); $plugin['missingRequirements'] = $dependency->getMissingDependencies($requires); return $plugin; }
public function getMissingDependencies($piwikVersion = null) { if (empty($this->pluginInformation['require'])) { return array(); } $dependency = new Dependency(); if (!is_null($piwikVersion)) { $dependency->setPiwikVersion($piwikVersion); } return $dependency->getMissingDependencies($this->pluginInformation['require']); }
private function assertMissingDependency($requires, $expectedMissing) { $missing = $this->dependency->getMissingDependencies($requires); $this->assertEquals($expectedMissing, $missing); }