public function compareAction() { // Get packages $packages = $this->_packageManager->listInstalledPackages(); // Get cached diffs if (isset($this->_session->diffs)) { $diffs = $this->_session->diffs; } else { $this->_session->diffs = $diffs = new Engine_Cache_ArrayContainer(array(), $this->_cache); } // Flush diffs if ($this->_getParam('flush')) { $diffs->clean(); unset($diffs); unset($this->_session->diffs); return $this->_helper->redirector->gotoRoute(array('flush' => null)); } // Check for skip identical $showAll = (bool) $this->_getParam('all', false); // Build diffs $indexedCount = array(); if ($diffs->count() <= 0) { foreach ($packages as $key => $package) { $operation = new Engine_Package_Manager_Operation_Install($this->_packageManager, $package); $fileOperations = $operation->getFileOperations(!$showAll); $fileOperations = $fileOperations['operations']; $currentCount = 0; $indexedOperations = array(); if (!empty($fileOperations)) { // Re-index file operations do { // Get key/val and remove $path = key($fileOperations); $info = $fileOperations[$path]; $code = $info['key']; unset($fileOperations[$path]); if (!$showAll) { if ($code == 'identical') { continue; } } // Save to index $indexedOperations[$code][$path] = $info; // Count $currentCount++; // Clear unset($path); unset($info); unset($code); } while (count($fileOperations) > 0); } unset($operation); unset($fileOperations); // Save cache //if( !empty($indexedOperations) ) { $diffs->offsetSet($package->getKey(), $indexedOperations); $indexedCount[$package->getKey()] = $currentCount; //} unset($indexedOperations); } $this->_compareCountIndex = $indexedCount; // Sort $diffs->uksort(array($this, 'compareSort')); } $this->view->diffs = $diffs; // Get extracted packages $oldPackages = array(); $it = new DirectoryIterator($this->_packageManager->getTemporaryPath(Engine_Package_Manager::PATH_PACKAGES)); foreach ($it as $child) { if ($it->isDot() || $it->isFile() || !$it->isDir()) { continue; } $oldPackages[] = basename($child->getPathname()); } $this->view->oldPackages = $oldPackages; }
public function prepend($value, $key = null) { // Only packages if (!$value instanceof Engine_Package_Manifest) { throw new Engine_Package_Manager_Exception('Cannot assign a non-package'); } $key = $value->getKey(); return parent::prepend($value, $key); }
public function prepend($value, $key = null) { // Only operations if (!$value instanceof Engine_Package_Manager_Operation_Abstract) { throw new Engine_Package_Manager_Exception('Problem loading operation from cache'); } $key = $value->getKey(); return parent::prepend($value, $key); }