/** * @throws \Cunity\Core\Exception */ public function run() { $dir = new \DirectoryIterator($this->_directory); foreach ($dir as $fileinfo) { if (!$fileinfo->isDot() && $fileinfo->isReadable()) { if ($fileinfo->getExtension() == "php") { include_once $this->_directory . DIRECTORY_SEPARATOR . $fileinfo->getFilename(); $classname = $fileinfo->getBasename(".php"); $classnameParts = explode('Version', $classname); if (class_exists($classname) && !$this->versionInstalled($classnameParts[1])) { /** @var DbUpdateVersion $dbCmd */ $dbCmd = new $classname(Cunity::get("db")); if ($dbCmd instanceof DbCommandInterface) { /** @noinspection PhpUndefinedMethodInspection */ $dbCmd->execute(); $dbCmd->updateDatabaseTimestamp($this->versionDb); } } } } } $process = new Process(); $process->recreateSearchIndex(); }
/** * @return bool|mixed */ public function save() { if (isset($this->_modifiedFields['username']) || isset($this->_modifiedFields['firstname']) || isset($this->_modifiedFields['lastname'])) { $currentUsername = $this->username; $result = parent::save(); $searchindex = new Process(); return $result && $searchindex->updateUser($currentUsername, $this->username, $this->firstname . " " . $this->lastname); } elseif (array_key_exists('field', $_POST)) { $profileFieldsUser = new ProfileFieldsUsers([], $this); return $profileFieldsUser->update($_POST['field'], ''); } else { return parent::save(); } }
/** * @param $user * @return mixed|void */ public static function onUnregister($user) { parent::onUnregister($user); $searchindex = new Models\Process(); $searchindex->removeUser($user->username); }