diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index ffc74f47b2..060f4eb6b2 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.9.0.a3'; + protected static $number = '3.9.0.a4'; protected static $name = 'Diplodocus'; public static function getNumber() diff --git a/lib/Doctrine/Entities/UserSetting.php b/lib/Doctrine/Entities/UserSetting.php new file mode 100644 index 0000000000..544bae7f20 --- /dev/null +++ b/lib/Doctrine/Entities/UserSetting.php @@ -0,0 +1,191 @@ +id; + } + + /** + * @return integer + */ + public function getUsrId() + { + return $this->usrId; + } + + /** + * @param integer $usrId + * + * @return UserSetting + */ + public function setUsrId($usrId) + { + $this->usrId = $usrId; + + return $this; + } + + /** + * @param \Alchemy\Phrasea\Application $app + * + * @return string + */ + public function getUser(Application $app) + { + return \User_Adapter::getInstance($this->usrId, $app); + } + + /** + * @param \User_Adapter $user + * + * @return UserSetting + */ + public function setUser(\User_Adapter $user) + { + $this->setUsrId($user->get_id()); + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * + * @return UserSetting + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * + * @return UserSetting + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreated() + { + return $this->created; + } + + /** + * @param \DateTime $created + * + * @return UserSetting + */ + public function setCreated(\DateTime $created) + { + $this->created = $created; + + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * @param \DateTime $updated + * + * @return UserSetting + */ + public function setUpdated(\DateTime $updated) + { + $this->updated = $updated; + + return $this; + } +} diff --git a/lib/Doctrine/Repositories/UserSettingRepository.php b/lib/Doctrine/Repositories/UserSettingRepository.php new file mode 100644 index 0000000000..872f603c7f --- /dev/null +++ b/lib/Doctrine/Repositories/UserSettingRepository.php @@ -0,0 +1,15 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function apply(base $appbox, Application $app) + { + $conn = $app['phraseanet.appbox']->get_connection(); + $sql = 'SELECT * FROM usr_settings'; + $stmt = $conn->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $n = 0; + $em = $app['EM']; + + foreach ($rs as $row) { + if (substr($row['prop'], 0, 13) === "notification_") { + continue; + } + + $userSetting = new UserSetting(); + $userSetting->setName($row['prop']); + $userSetting->setValue($row['value']); + $userSetting->setUsrId($row['usr_id']); + + $em->persist($userSetting); + + $n++; + + if ($n % 1000 === 0) { + $em->flush(); + $em->clear(); + } + } + + $em->flush(); + $em->clear(); + } +}