mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Fix upgrade of feeds
This commit is contained in:
@@ -52,12 +52,15 @@ class Setup_Upgrade
|
|||||||
public function __construct(appbox &$appbox)
|
public function __construct(appbox &$appbox)
|
||||||
{
|
{
|
||||||
if (self::lock_exists())
|
if (self::lock_exists())
|
||||||
throw new Exception_Setup_UpgradeAlreadyStarted();
|
{
|
||||||
|
throw new Exception_Setup_UpgradeAlreadyStarted('The upgrade is already started');
|
||||||
|
}
|
||||||
|
|
||||||
$this->appbox = $appbox;
|
$this->appbox = $appbox;
|
||||||
|
|
||||||
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
||||||
{
|
{
|
||||||
throw new Exception_Setup_FixBadEmailAddresses();
|
throw new Exception_Setup_FixBadEmailAddresses('Please fix the database before starting');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->write_lock();
|
$this->write_lock();
|
||||||
|
@@ -55,10 +55,22 @@ class patch_320f implements patchInterface
|
|||||||
function apply(base &$appbox)
|
function apply(base &$appbox)
|
||||||
{
|
{
|
||||||
$feeds = array();
|
$feeds = array();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
|
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
|
||||||
, updater, pub_restrict, homelink
|
, updater, pub_restrict, homelink
|
||||||
FROM ssel WHERE public = "1" or homelink="1"';
|
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -73,6 +85,10 @@ class patch_320f implements patchInterface
|
|||||||
|
|
||||||
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
|
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
|
||||||
|
|
||||||
|
if(!$feed instanceof Feed_Adapter)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$entry = Feed_Entry_Adapter::create($appbox, $feed, array_shift($feed->get_publishers()), $row['name'], $row['descript'], $user->get_display_name(), $user->get_email());
|
$entry = Feed_Entry_Adapter::create($appbox, $feed, array_shift($feed->get_publishers()), $row['name'], $row['descript'], $user->get_display_name(), $user->get_email());
|
||||||
$date_create = new DateTime($row['pub_date']);
|
$date_create = new DateTime($row['pub_date']);
|
||||||
@@ -107,7 +123,8 @@ class patch_320f implements patchInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE ssel SET deleted = "1" WHERE ssel_id = :ssel_id';
|
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
|
||||||
|
WHERE ssel_id = :ssel_id';
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
$stmt->execute(array(':ssel_id' => $row['ssel_id']));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
Reference in New Issue
Block a user