2013-11-09 17:30:46 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ownCloud - Documents App
|
|
|
|
*
|
|
|
|
* @author Victor Dubiniuk
|
|
|
|
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
*/
|
|
|
|
|
2015-08-26 19:09:34 +03:00
|
|
|
$config = \OC::$server->getConfig();
|
|
|
|
$dbConnection = \OC::$server->getDatabaseConnection();
|
|
|
|
$installedVersion = $config->getAppValue('documents', 'installed_version');
|
2013-11-09 17:30:46 +03:00
|
|
|
|
2015-08-26 19:09:34 +03:00
|
|
|
$cleanup = $dbConnection->prepare('DELETE FROM `*PREFIX*documents_member` WHERE `last_activity`=0 or `last_activity` is NULL');
|
2013-11-27 18:02:16 +03:00
|
|
|
$cleanup->execute();
|
|
|
|
|
2013-11-09 17:30:46 +03:00
|
|
|
if (version_compare($installedVersion, '0.7', '<=')) {
|
2015-08-26 19:09:34 +03:00
|
|
|
$config->setAppValue('documents', 'unstable', 'false');
|
2014-08-04 20:51:50 +03:00
|
|
|
$session = new \OCA\Documents\Db\Session();
|
2013-11-09 17:30:46 +03:00
|
|
|
|
2015-08-26 19:09:34 +03:00
|
|
|
$query = $dbConnection->prepare('UPDATE `*PREFIX*documents_session` SET `genesis_url`=? WHERE `es_id`=?');
|
2013-11-09 17:30:46 +03:00
|
|
|
|
|
|
|
foreach ($session->getCollection() as $sessionData){
|
|
|
|
$sessionData['genesis_url'] = \OCA\Documents\Genesis::DOCUMENTS_DIRNAME . $sessionData['genesis_url'];
|
|
|
|
$query->execute(array(
|
|
|
|
$sessionData['genesis_url'],
|
|
|
|
$sessionData['es_id']
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
2014-04-09 17:14:53 +03:00
|
|
|
}
|
|
|
|
if (version_compare($installedVersion, '0.8', '<')) {
|
2015-08-26 19:09:34 +03:00
|
|
|
$query = $dbConnection->prepare('UPDATE `*PREFIX*documents_member` SET `is_guest`=1 WHERE `uid` LIKE \'%(guest)\' ');
|
2014-04-09 17:14:53 +03:00
|
|
|
$query->execute(array());
|
2014-11-13 01:20:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (version_compare($installedVersion, '0.9', '<')) {
|
2015-08-26 19:09:34 +03:00
|
|
|
$query = $dbConnection->prepare('UPDATE `*PREFIX*documents_op` SET `optype`=? WHERE `seq`=?');
|
2014-11-13 01:20:54 +03:00
|
|
|
$ops = new \OCA\Documents\Db\Op();
|
|
|
|
foreach ($ops->getCollection() as $opData){
|
|
|
|
$opSpec = json_decode($opData['opspec'], true);
|
|
|
|
$query->execute(
|
|
|
|
array(
|
|
|
|
$opSpec['optype'],
|
|
|
|
$opData['seq']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2013-11-28 20:21:03 +01:00
|
|
|
}
|