Copy genesis to storage
parent
354f059d92
commit
5b165331df
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$this->create('office_genesis', 'ajax/genesis/{es_id}')
|
||||
->post()
|
||||
->action('\OCA\Office\Genesis', 'serve')
|
||||
;
|
||||
$this->create('office_genesis', 'ajax/genesis/{es_id}')
|
||||
->get()
|
||||
->action('\OCA\Office\Genesis', 'serve')
|
||||
;
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Office;
|
||||
|
||||
class Genesis {
|
||||
|
||||
public static function serve($args){
|
||||
\OCP\User::checkLoggedIn();
|
||||
|
||||
$session = Session::getSession(@$args['es_id']);
|
||||
|
||||
$filename = isset($session['genesis_url']) ? $session['genesis_url'] : '';
|
||||
$download = new Download($filename);
|
||||
$download->sendResponse();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Office;
|
||||
|
||||
class View extends \OC\Files\View{
|
||||
const OFFICE_DIRNAME='/office';
|
||||
protected static $officeView;
|
||||
|
||||
public static function initOfficeView($uid){
|
||||
$view = new \OC\Files\View('/' . $uid);
|
||||
if (!$view->is_dir(self::OFFICE_DIRNAME)) {
|
||||
$view->mkdir(self::OFFICE_DIRNAME);
|
||||
}
|
||||
|
||||
if (!self::$officeView){
|
||||
self::$officeView = new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
||||
}
|
||||
|
||||
return self::$officeView;
|
||||
}
|
||||
|
||||
public static function storeDocument($uid, $path){
|
||||
$view = new \OC\Files\View('/' . $uid);
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$view->copy('/files' . $path, self::OFFICE_DIRNAME . $path);
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
return $path;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue