/** * Register the given path as a module project to look at. * * Does not immediately process it, but flags it as pending and gives it a * timestamp. * Returns NULL if the entry already exists, and does not add a new entry. * * @param string $location * Folder name. */ public function enqueueFolder($location) { // First, see if we already know about it. // If not, make a location entry and serialize it. $module = new Module(); $module->setName(basename($location)); $module->setLocation($location); $now = new \DateTime(); $module->setUpdated($now); $module->setStatus('queue:pending'); // Extract basic .info name and version. $this->runInfoScan($module); // If this Module+version exists in the DB already, don't save. $conditions = array('name' => $module->getName(), 'version' => $module->getVersion()); $found = $this->findItem($conditions); if ($found) { if ($this->options['flush']) { // Remove the pre-existing one. $this->entityManager->remove($found); } else { $conditions['location'] = $found->getLocation(); $conditions['status'] = $found->getStatus(); error_log(strtr("Have already registered module name version at location , Status is status. Not re-enqueing it. Pass in the --flush flag to reset and force a re-scan.", $conditions)); return; } } $this->entityManager->persist($module); $this->entityManager->flush(); }