46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
namespace OCA\Gestion\Cron;
|
|
|
|
use \OCP\BackgroundJob\TimedJob;
|
|
use \OCP\AppFramework\Utility\ITimeFactory;
|
|
use \OCA\Gestion\Db\Bdd;
|
|
use \OCP\Files\IRootFolder;
|
|
use FPDF;
|
|
|
|
class GenerateDocument extends TimedJob {
|
|
private $idNextcloud;
|
|
private $myDb;
|
|
|
|
/** @var IRootStorage */
|
|
private $storage;
|
|
|
|
public function __construct(ITimeFactory $time,
|
|
SomeService $service,
|
|
Bdd $myDb,
|
|
$UserId,
|
|
IRootFolder $rootFolder) {
|
|
parent::__construct($time);
|
|
|
|
$this->idNextcloud = $UserId;
|
|
$this->myDb = $myDb;
|
|
try{
|
|
$this->storage = $rootFolder->getUserFolder($this->idNextcloud);
|
|
}catch(\OC\User\NoUserException $e){
|
|
|
|
}
|
|
// Run once a 10 seconds
|
|
$this->setInterval(10);
|
|
}
|
|
|
|
protected function run($arguments) {
|
|
$this->myDb->insertClient($this->idNextcloud);
|
|
// $current_config = json_decode($this->myDb->getConfiguration($this->idNextcloud));
|
|
// $clean_folder = html_entity_decode($current_config[0]->path).'/DOCS/';
|
|
// try {
|
|
// $this->storage->newFolder($_clean_folder);
|
|
// } catch(\OCP\Files\NotPermittedException $e) { }
|
|
// $this->storage->newFile($clean_folder.'test.txt');
|
|
// $file = $this->storage->get($ff);
|
|
// $file->putContent('Hello World !');
|
|
}
|
|
} |