本文整理汇总了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;
}
}
示例2: addtoActivity
public function addtoActivity($data)
{
return $this->connect->insert('*PREFIX*activity', $data)->execute();
}
示例3: startInsert
public function startInsert($uid)
{
return $this->connect->insert($this->tableName, ['name' => 'Project', 'create_uid' => $uid]);
}
示例4: save
public function save($data)
{
$message = $this->connect->insert($this->tableName, $data);
return $message;
}
示例5: save
public function save($data)
{
$user = $this->connect->insert($this->tableName, $data);
return $user;
}