Db_Session -> Db\Session
This commit is contained in:
parent
dfe26c9289
commit
7356dcfae3
@ -51,7 +51,7 @@ class DocumentController extends Controller{
|
||||
* @param array $args - array containing session id as an element with a key es_id
|
||||
*/
|
||||
public static function serve($args){
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$session->load(@$args['es_id']);
|
||||
|
||||
self::preDispatchGuest();
|
||||
@ -108,7 +108,7 @@ class DocumentController extends Controller{
|
||||
return @$b['mtime']-@$a['mtime'];
|
||||
});
|
||||
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$sessions = $session->getCollectionBy('file_id', $fileIds);
|
||||
|
||||
$members = array();
|
||||
|
@ -31,7 +31,7 @@ try{
|
||||
$request = new Request();
|
||||
$esId = $request->getParam('args/es_id');
|
||||
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$session->load($esId);
|
||||
|
||||
$memberId = $request->getParam('args/member_id');
|
||||
|
@ -23,7 +23,7 @@ class SessionController extends Controller{
|
||||
try {
|
||||
$token = Helper::getArrayValueByKey($args, 'token');
|
||||
$file = File::getByShareToken($token);
|
||||
$session = Db_Session::start($uid, $file, true);
|
||||
$session = Db\Session::start($uid, $file, true);
|
||||
\OCP\JSON::success($session);
|
||||
} catch (\Exception $e){
|
||||
Helper::warnLog('Starting a session failed. Reason: ' . $e->getMessage());
|
||||
@ -42,7 +42,7 @@ class SessionController extends Controller{
|
||||
|
||||
if ($view->isUpdatable($path)) {
|
||||
$file = new File($fileId);
|
||||
$session = Db_Session::start($uid, $file);
|
||||
$session = Db\Session::start($uid, $file);
|
||||
\OCP\JSON::success($session);
|
||||
} else {
|
||||
$info = $view->getFileInfo();
|
||||
@ -93,7 +93,7 @@ class SessionController extends Controller{
|
||||
}
|
||||
$content = stream_get_contents($stream);
|
||||
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$session->load($esId);
|
||||
|
||||
if (!$session->getEsId()){
|
||||
@ -157,7 +157,7 @@ class SessionController extends Controller{
|
||||
$session->updateGenesisHash($esId, sha1($data['content']));
|
||||
} else {
|
||||
// Last user. Kill session data
|
||||
Db_Session::cleanUp($esId);
|
||||
Db\Session::cleanUp($esId);
|
||||
}
|
||||
|
||||
$view->touch($path);
|
||||
@ -177,7 +177,7 @@ class SessionController extends Controller{
|
||||
$info = array();
|
||||
|
||||
if (is_array($items)){
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$info = $session->getInfoByFileId($items);
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ class SessionController extends Controller{
|
||||
|
||||
public static function listAll(){
|
||||
self::preDispatch();
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$sessions = $session->getCollection();
|
||||
|
||||
$preparedSessions = array_map(
|
||||
|
@ -40,7 +40,6 @@ OC::$CLASSPATH['OCA\Documents\SessionController'] = 'documents/ajax/sessionContr
|
||||
OC::$CLASSPATH['OCA\Documents\UserController'] = 'documents/ajax/userController.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Download_Simple'] = 'documents/lib/download/simple.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Download_Range'] = 'documents/lib/download/range.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Db_Session'] = 'documents/lib/db/session.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Db_Member'] = 'documents/lib/db/member.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Db_Op'] = 'documents/lib/db/op.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Filter_Office'] = 'documents/lib/filter/office.php';
|
||||
|
@ -16,7 +16,7 @@ $cleanup->execute();
|
||||
|
||||
if (version_compare($installedVersion, '0.7', '<=')) {
|
||||
\OCP\Config::setAppValue('documents', 'unstable', 'false');
|
||||
$session = new \OCA\Documents\Db_Session();
|
||||
$session = new \OCA\Documents\Db\Session();
|
||||
|
||||
$query = \OC_DB::prepare('UPDATE `*PREFIX*documents_session` SET `genesis_url`=? WHERE `es_id`=?');
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Documents;
|
||||
namespace OCA\Documents\Db;
|
||||
|
||||
/**
|
||||
* Session management
|
||||
@ -22,7 +22,7 @@ namespace OCA\Documents;
|
||||
* @method string getGenesisHash()
|
||||
*
|
||||
*/
|
||||
class Db_Session extends \OCA\Documents\Db {
|
||||
class Session extends \OCA\Documents\Db {
|
||||
|
||||
/**
|
||||
* DB table
|
||||
@ -44,15 +44,15 @@ class Db_Session extends \OCA\Documents\Db {
|
||||
*/
|
||||
public static function start($uid, $file){
|
||||
// Create a directory to store genesis
|
||||
$genesis = new Genesis($file);
|
||||
$genesis = new \OCA\Documents\Genesis($file);
|
||||
|
||||
list($ownerView, $path) = $file->getOwnerViewAndPath();
|
||||
$oldSession = new Db_Session();
|
||||
$oldSession = new Session();
|
||||
$oldSession->loadBy('file_id', $file->getFileId());
|
||||
|
||||
//If there is no existing session we need to start a new one
|
||||
if (!$oldSession->hasData()){
|
||||
$newSession = new Db_Session(array(
|
||||
$newSession = new Session(array(
|
||||
$genesis->getPath(),
|
||||
$genesis->getHash(),
|
||||
$file->getOwner(),
|
||||
@ -69,8 +69,8 @@ class Db_Session extends \OCA\Documents\Db {
|
||||
->getData()
|
||||
;
|
||||
|
||||
$memberColor = Helper::getMemberColor($uid);
|
||||
$member = new Db_Member(array(
|
||||
$memberColor = \OCA\Documents\Helper::getMemberColor($uid);
|
||||
$member = new \OCA\Documents\Db_Member(array(
|
||||
$sessionData['es_id'],
|
||||
$uid,
|
||||
$memberColor,
|
||||
@ -87,10 +87,10 @@ class Db_Session extends \OCA\Documents\Db {
|
||||
$imageUrl = $uid;
|
||||
}
|
||||
|
||||
$displayName = $file->isPublicShare() ? $uid . ' ' . Db_Member::getGuestPostfix() : \OCP\User::getDisplayName($uid);
|
||||
$displayName = $file->isPublicShare() ? $uid . ' ' . \OCA\Documents\Db_Member::getGuestPostfix() : \OCP\User::getDisplayName($uid);
|
||||
|
||||
$sessionData['member_id'] = (string) $member->getLastInsertId();
|
||||
$op = new Db_Op();
|
||||
$op = new \OCA\Documents\Db_Op();
|
||||
$op->addMember(
|
||||
$sessionData['es_id'],
|
||||
$sessionData['member_id'],
|
||||
@ -109,13 +109,13 @@ class Db_Session extends \OCA\Documents\Db {
|
||||
}
|
||||
|
||||
public static function cleanUp($esId){
|
||||
$session = new Db_Session();
|
||||
$session = new Session();
|
||||
$session->deleteBy('es_id', $esId);
|
||||
|
||||
$member = new Db_Member();
|
||||
$member = new \OCA\Documents\Db_Member();
|
||||
$member->deleteBy('es_id', $esId);
|
||||
|
||||
$op= new Db_Op();
|
||||
$op= new \OCA\Documents\Db_Op();
|
||||
$op->deleteBy('es_id', $esId);
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ class Db_Session extends \OCA\Documents\Db {
|
||||
}
|
||||
|
||||
protected function getUniqueSessionId(){
|
||||
$testSession = new Db_Session();
|
||||
$testSession = new Session();
|
||||
do{
|
||||
$id = \OC_Util::generateRandomBytes(30);
|
||||
} while ($testSession->load($id)->hasData());
|
||||
|
@ -71,7 +71,7 @@ class Storage {
|
||||
return;
|
||||
}
|
||||
|
||||
$session = new Db_Session();
|
||||
$session = new Session();
|
||||
$session->loadBy('file_id', $fileId);
|
||||
|
||||
if (!$session->getEsId()){
|
||||
@ -86,7 +86,7 @@ class Storage {
|
||||
}
|
||||
}
|
||||
|
||||
Db_Session::cleanUp($session->getEsId());
|
||||
Db\Session::cleanUp($session->getEsId());
|
||||
}
|
||||
|
||||
protected static function searchDocuments(){
|
||||
|
@ -39,7 +39,7 @@ if (isset($_GET['t'])) {
|
||||
\OCP\Util::addStyle( 'documents', '3rdparty/webodf/editor' );
|
||||
\OCP\Util::addScript('documents', 'documents');
|
||||
if ($file->getFileId()){
|
||||
$session = new Db_Session();
|
||||
$session = new Db\Session();
|
||||
$session->loadBy('file_id', $file->getFileId());
|
||||
|
||||
if ($session->getEsId()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user