Esempio n. 1
0
 /**
  * Inserts uploaded file into database
  * @param array $file
  */
 public function newFile($file, $path)
 {
     $sql = "SELECT id FROM *PREFIX*mimetypes WHERE mimetype = '" . $file['mimetype'] . "'";
     $res = $this->connect->query($sql);
     $mimetype = $res['id'];
     $sql = "SELECT numeric_id FROM *PREFIX*storages WHERE id = 'home::" . $file['owner'] . "'";
     $res = $this->connect->query($sql);
     $storageid = $res['numeric_id'];
     $sql = "SELECT fileid FROM *PREFIX*filecache WHERE path = '" . $file['path'] . "'";
     $res = $this->connect->query($sql);
     $parent = $res['fileid'];
     //$path = '/var/www/owncloud.loc/data/admin/files/Photos/San Francisco.jpg';
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path . '/' . $file['filename']);
     $etag = $storage->getETag($internalPath);
     $data = array('storage' => $storageid, 'path' => $file['path'] . '/' . $file['filename'], 'path_hash' => md5($file['path'] . '/' . $file['filename']), 'parent' => $parent, 'name' => $file['filename'], 'mimetype' => $mimetype, 'mimepart' => 5, 'size' => $file['size'], 'mtime' => $file['mtime'], 'storage_mtime' => $file['storage_mtime'], 'etag' => $etag, 'permissions' => \OCP\Constants::PERMISSION_ALL);
     $filecache = $this->save($data);
     /* file_put_contents('/tmp/inb.log', "\nPath : /\n", FILE_APPEND);
             try { 
     		$fileInfo = \OC\Files\Filesystem::getFileInfo('/', false); 
             } 
             catch (\Exception $e) {
     		file_put_contents('/tmp/inb.log', "\nGet File Info error : " . $e->getMessage() . "\n", FILE_APPEND);
     	}
             file_put_contents('/tmp/inb.log', "\nFile info : " . print_r($fileInfo, true) . "\n", FILE_APPEND);
             try { 
     		$icon = \OCA\Files\Helper::determineIcon($fileInfo); 
             } 
             catch (\Exception $e) {
     		file_put_contents('/tmp/inb.log', "\nDetermine Icon error : " . $e->getMessage() . "\n", FILE_APPEND);
     	} */
     $activity = array('activity_id' => NULL, 'timestamp' => $file['mtime'], 'priority' => 30, 'type' => 'file_created', 'user' => $file['owner'], 'affecteduser' => $file['owner'], 'app' => 'files', 'subject' => 'created_self', 'subjectparams' => '["\\/' . $file['filename'] . '"]', 'message' => '', 'messageparams' => '[]', 'file' => '/' . $file['filename'], 'link' => $file['domain'] . '/index.php/apps/files?dir=%2F', 'object_type' => 'files', 'object_id' => $filecache);
     $id = $this->connect->insert('*PREFIX*activity', $activity);
     if ($id) {
         return $filecache;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 public function addtoActivity($data)
 {
     return $this->connect->insert('*PREFIX*activity', $data)->execute();
 }
Esempio n. 3
0
 public function startInsert($uid)
 {
     return $this->connect->insert($this->tableName, ['name' => 'Project', 'create_uid' => $uid]);
 }
Esempio n. 4
0
 public function save($data)
 {
     $message = $this->connect->insert($this->tableName, $data);
     return $message;
 }
Esempio n. 5
0
 public function save($data)
 {
     $user = $this->connect->insert($this->tableName, $data);
     return $user;
 }