当前位置: 首页>>代码示例>>PHP>>正文


PHP Connect::insert方法代码示例

本文整理汇总了PHP中Connect::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Connect::insert方法的具体用法?PHP Connect::insert怎么用?PHP Connect::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connect的用法示例。


在下文中一共展示了Connect::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newFile

 /**
  * 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;
     }
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:42,代码来源:files.php

示例2: addtoActivity

 public function addtoActivity($data)
 {
     return $this->connect->insert('*PREFIX*activity', $data)->execute();
 }
开发者ID:Werdffelynir,项目名称:owncollab_talks,代码行数:4,代码来源:messages.php

示例3: startInsert

 public function startInsert($uid)
 {
     return $this->connect->insert($this->tableName, ['name' => 'Project', 'create_uid' => $uid]);
 }
开发者ID:Werdffelynir,项目名称:owncollab_chart,代码行数:4,代码来源:project.php

示例4: save

 public function save($data)
 {
     $message = $this->connect->insert($this->tableName, $data);
     return $message;
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:5,代码来源:messages.php

示例5: save

 public function save($data)
 {
     $user = $this->connect->insert($this->tableName, $data);
     return $user;
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:5,代码来源:users.php


注:本文中的Connect::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。