_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q27000 | Sequence.drop | train | public function drop($name)
{
// check if a valid name and sequence exists
if (! $name || ! $this->exists($name)) {
return false;
}
return $this->connection->statement("
declare
e exception;
pragma exception_init(e,-02289);
... | php | {
"resource": ""
} |
q27001 | Sequence.lastInsertId | train | public function lastInsertId($name)
{
// check if a valid name and sequence exists
if (! $name || ! $this->exists($name)) {
return 0;
}
return $this->connection->selectOne("select {$name}.currval as id from dual")->id;
} | php | {
"resource": ""
} |
q27002 | OracleBuilder.table | train | public function table($table, Closure $callback)
{
$blueprint = $this->createBlueprint($table);
$callback($blueprint);
foreach ($blueprint->getCommands() as $command) {
if ($command->get('name') == 'drop') {
$this->helper->dropAutoIncrementObjects($table);
... | php | {
"resource": ""
} |
q27003 | Comment.setComments | train | public function setComments(OracleBlueprint $blueprint)
{
$this->commentTable($blueprint);
$this->fluentComments($blueprint);
$this->commentColumns($blueprint);
} | php | {
"resource": ""
} |
q27004 | Comment.commentColumn | train | private function commentColumn($table, $column, $comment)
{
$table = $this->wrapValue($table);
$table = $this->connection->getTablePrefix() . $table;
$column = $this->wrapValue($column);
$this->connection->statement("comment on column {$table}.{$column} is '{$comment}'");
} | php | {
"resource": ""
} |
q27005 | OracleBuilder.updateLob | train | public function updateLob(array $values, array $binaries, $sequence = 'id')
{
$bindings = array_values(array_merge($values, $this->getBindings()));
/** @var \Yajra\Oci8\Query\Grammars\OracleGrammar $grammar */
$grammar = $this->grammar;
$sql = $grammar->compileUpdateLob($this, $... | php | {
"resource": ""
} |
q27006 | OracleBuilder.whereIn | train | public function whereIn($column, $values, $boolean = 'and', $not = false)
{
$type = $not ? 'NotIn' : 'In';
if ($values instanceof Arrayable) {
$values = $values->toArray();
}
if (is_array($values) && count($values) > 1000) {
$chunks = array_chunk($values, 10... | php | {
"resource": ""
} |
q27007 | OracleGrammar.compileInsertLob | train | public function compileInsertLob(Builder $query, $values, $binaries, $sequence = 'id')
{
if (empty($sequence)) {
$sequence = 'id';
}
$table = $this->wrapTable($query->from);
if (! is_array(reset($values))) {
$values = [$values];
}
if (! is_a... | php | {
"resource": ""
} |
q27008 | OracleAutoIncrementHelper.createAutoIncrementObjects | train | public function createAutoIncrementObjects(Blueprint $blueprint, $table)
{
$column = $this->getQualifiedAutoIncrementColumn($blueprint);
// return if no qualified AI column
if (is_null($column)) {
return;
}
$col = $column->name;
$start = isset($column-... | php | {
"resource": ""
} |
q27009 | OracleAutoIncrementHelper.getQualifiedAutoIncrementColumn | train | public function getQualifiedAutoIncrementColumn(Blueprint $blueprint)
{
$columns = $blueprint->getColumns();
// search for primary key / autoIncrement column
foreach ($columns as $column) {
// if column is autoIncrement set the primary col name
if ($column->autoIncre... | php | {
"resource": ""
} |
q27010 | OracleAutoIncrementHelper.createObjectName | train | private function createObjectName($prefix, $table, $col, $type)
{
// max object name length is 30 chars
return substr($prefix . $table . '_' . $col . '_' . $type, 0, 30);
} | php | {
"resource": ""
} |
q27011 | OracleAutoIncrementHelper.dropAutoIncrementObjects | train | public function dropAutoIncrementObjects($table)
{
// drop sequence and trigger object
$prefix = $this->connection->getTablePrefix();
// get the actual primary column name from table
$col = $this->getPrimaryKey($prefix . $table);
// if primary key col is set, drop auto increm... | php | {
"resource": ""
} |
q27012 | OracleAutoIncrementHelper.getPrimaryKey | train | public function getPrimaryKey($table)
{
if (! $table) {
return '';
}
$sql = "SELECT cols.column_name
FROM all_constraints cons, all_cons_columns cols
WHERE upper(cols.table_name) = upper('{$table}')
AND cons.constraint_type = 'P'
... | php | {
"resource": ""
} |
q27013 | Oci8ServiceProvider.boot | train | public function boot()
{
$this->publishes([
__DIR__ . '/../config/oracle.php' => config_path('oracle.php'),
], 'oracle');
Auth::provider('oracle', function ($app, array $config) {
return new OracleUserProvider($app['hash'], $config['model']);
});
} | php | {
"resource": ""
} |
q27014 | OracleProcessor.prepareStatement | train | private function prepareStatement(Builder $query, $sql)
{
/** @var \Yajra\Oci8\Oci8Connection $connection */
$connection = $query->getConnection();
$pdo = $connection->getPdo();
return $pdo->prepare($sql);
} | php | {
"resource": ""
} |
q27015 | OracleProcessor.bindValues | train | private function bindValues(&$values, $statement, $parameter)
{
$count = count($values);
for ($i = 0; $i < $count; $i++) {
if (is_object($values[$i])) {
if ($values[$i] instanceof DateTime) {
$values[$i] = $values[$i]->format('Y-m-d H:i:s');
... | php | {
"resource": ""
} |
q27016 | OracleProcessor.saveLob | train | public function saveLob(Builder $query, $sql, array $values, array $binaries)
{
$id = 0;
$parameter = 0;
$statement = $this->prepareStatement($query, $sql);
$parameter = $this->bindValues($values, $statement, $parameter);
$countBinary = count($binaries);
for ... | php | {
"resource": ""
} |
q27017 | Trigger.autoIncrement | train | public function autoIncrement($table, $column, $triggerName, $sequenceName)
{
if (! $table || ! $column || ! $triggerName || ! $sequenceName) {
return false;
}
if ($this->connection->getConfig('prefix_schema')) {
$table = $this->connection->getConfig('prefix_s... | php | {
"resource": ""
} |
q27018 | Trigger.wrapValue | train | protected function wrapValue($value)
{
$value = Str::upper($value);
return $this->isReserved($value) ? '"' . $value . '"' : $value;
} | php | {
"resource": ""
} |
q27019 | OracleConnector.parseConfig | train | protected function parseConfig(array $config)
{
$config = $this->setHost($config);
$config = $this->setPort($config);
$config = $this->setProtocol($config);
$config = $this->setServiceId($config);
$config = $this->setTNS($config);
$config = $this->setCharset($config);... | php | {
"resource": ""
} |
q27020 | OracleConnector.setServiceId | train | protected function setServiceId(array $config)
{
$config['service'] = empty($config['service_name'])
? $service_param = 'SID = ' . $config['database']
: $service_param = 'SERVICE_NAME = ' . $config['service_name'];
return $config;
} | php | {
"resource": ""
} |
q27021 | OracleConnector.checkMultipleHostDsn | train | protected function checkMultipleHostDsn(array $config)
{
$host = is_array($config['host']) ? $config['host'] : explode(',', $config['host']);
$count = count($host);
if ($count > 1) {
$address = '';
for ($i = 0; $i < $count; $i++) {
$address .= '(ADDRE... | php | {
"resource": ""
} |
q27022 | PropFindAll.get | train | public function get($propertyName)
{
return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null;
} | php | {
"resource": ""
} |
q27023 | PropFindAll.get404Properties | train | public function get404Properties()
{
$result = [];
foreach ($this->result as $propertyName => $stuff) {
if (404 === $stuff[0]) {
$result[] = $propertyName;
}
}
// If there's nothing in this list, we're adding one fictional item.
if (!$r... | php | {
"resource": ""
} |
q27024 | Plugin.sendSyncCollectionResponse | train | protected function sendSyncCollectionResponse($syncToken, $collectionUrl, array $added, array $modified, array $deleted, array $properties)
{
$fullPaths = [];
// Pre-fetching children, if this is possible.
foreach (array_merge($added, $modified) as $item) {
$fullPath = $collecti... | php | {
"resource": ""
} |
q27025 | Client.propFind | train | public function propFind($url, array $properties, $depth = 0)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$root = $dom->createElementNS('DAV:', 'd:propfind');
$prop = $dom->createElement('d:prop');
foreach ($properties as $property) {
li... | php | {
"resource": ""
} |
q27026 | Client.propPatch | train | public function propPatch($url, array $properties)
{
$propPatch = new Xml\Request\PropPatch();
$propPatch->properties = $properties;
$xml = $this->xml->write(
'{DAV:}propertyupdate',
$propPatch
);
$url = $this->getAbsoluteUrl($url);
$request =... | php | {
"resource": ""
} |
q27027 | Client.options | train | public function options()
{
$request = new HTTP\Request('OPTIONS', $this->getAbsoluteUrl(''));
$response = $this->send($request);
$dav = $response->getHeader('Dav');
if (!$dav) {
return [];
}
$features = explode(',', $dav);
foreach ($features as ... | php | {
"resource": ""
} |
q27028 | Client.request | train | public function request($method, $url = '', $body = null, array $headers = [])
{
$url = $this->getAbsoluteUrl($url);
$response = $this->send(new HTTP\Request($method, $url, $headers, $body));
return [
'body' => $response->getBodyAsString(),
'statusCode' => (int) $re... | php | {
"resource": ""
} |
q27029 | Client.parseMultiStatus | train | public function parseMultiStatus($body)
{
$multistatus = $this->xml->expect('{DAV:}multistatus', $body);
$result = [];
foreach ($multistatus->getResponses() as $response) {
$result[$response->getHref()] = $response->getResponseProperties();
}
return $result;
... | php | {
"resource": ""
} |
q27030 | AddressBook.getChild | train | public function getChild($name)
{
$obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name);
if (!$obj) {
throw new DAV\Exception\NotFound('Card not found');
}
return new Card($this->carddavBackend, $this->addressBookInfo, $obj);
} | php | {
"resource": ""
} |
q27031 | AddressBook.getChildren | train | public function getChildren()
{
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$children = [];
foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
$children[] = new Card($this->carddavBackend, $this->addressBookInfo, $obj);
}
... | php | {
"resource": ""
} |
q27032 | CalendarHome.getChild | train | public function getChild($name)
{
// Special nodes
if ('inbox' === $name && $this->caldavBackend instanceof Backend\SchedulingSupport) {
return new Schedule\Inbox($this->caldavBackend, $this->principalInfo['uri']);
}
if ('outbox' === $name && $this->caldavBackend instance... | php | {
"resource": ""
} |
q27033 | CalendarHome.getChildren | train | public function getChildren()
{
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
$objs = [];
foreach ($calendars as $calendar) {
if ($this->caldavBackend instanceof Backend\SharingSupport) {
$objs[] = new SharedCalendar($this->c... | php | {
"resource": ""
} |
q27034 | CalendarHome.createExtendedCollection | train | public function createExtendedCollection($name, MkCol $mkCol)
{
$isCalendar = false;
$isSubscription = false;
foreach ($mkCol->getResourceType() as $rt) {
switch ($rt) {
case '{DAV:}collection':
case '{http://calendarserver.org/ns/}shared-owner':
... | php | {
"resource": ""
} |
q27035 | CalendarHome.shareReply | train | public function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null)
{
if (!$this->caldavBackend instanceof Backend\SharingSupport) {
throw new DAV\Exception\NotImplemented('Sharing support is not implemented by this backend.');
}
return $this->caldavBackend->sh... | php | {
"resource": ""
} |
q27036 | Plugin.httpGet | train | public function httpGet(RequestInterface $request, ResponseInterface $response)
{
$queryParams = $request->getQueryParameters();
if (!array_key_exists('mount', $queryParams)) {
return;
}
$currentUri = $request->getAbsoluteUrl();
// Stripping off everything after... | php | {
"resource": ""
} |
q27037 | Plugin.davMount | train | public function davMount(ResponseInterface $response, $uri)
{
$response->setStatus(200);
$response->setHeader('Content-Type', 'application/davmount+xml');
ob_start();
echo '<?xml version="1.0"?>', "\n";
echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
... | php | {
"resource": ""
} |
q27038 | HomeCollection.getChildForPrincipal | train | public function getChildForPrincipal(array $principalInfo)
{
$owner = $principalInfo['uri'];
$acl = [
[
'privilege' => '{DAV:}all',
'principal' => '{DAV:}owner',
'protected' => true,
],
];
list(, $principalBaseN... | php | {
"resource": ""
} |
q27039 | PDO.getPrincipalsByPrefix | train | public function getPrincipalsByPrefix($prefixPath)
{
$fields = [
'uri',
];
foreach ($this->fieldMap as $key => $value) {
$fields[] = $value['dbField'];
}
$result = $this->pdo->query('SELECT '.implode(',', $fields).' FROM '.$this->tableName);
... | php | {
"resource": ""
} |
q27040 | PDO.getPrincipalByPath | train | public function getPrincipalByPath($path)
{
$fields = [
'id',
'uri',
];
foreach ($this->fieldMap as $key => $value) {
$fields[] = $value['dbField'];
}
$stmt = $this->pdo->prepare('SELECT '.implode(',', $fields).' FROM '.$this->tableName.'... | php | {
"resource": ""
} |
q27041 | PDO.updatePrincipal | train | public function updatePrincipal($path, DAV\PropPatch $propPatch)
{
$propPatch->handle(array_keys($this->fieldMap), function ($properties) use ($path) {
$query = 'UPDATE '.$this->tableName.' SET ';
$first = true;
$values = [];
foreach ($properties as $key => ... | php | {
"resource": ""
} |
q27042 | PDO.getGroupMemberSet | train | public function getGroupMemberSet($principal)
{
$principal = $this->getPrincipalByPath($principal);
if (!$principal) {
throw new DAV\Exception('Principal not found');
}
$stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS grou... | php | {
"resource": ""
} |
q27043 | PDO.setGroupMemberSet | train | public function setGroupMemberSet($principal, array $members)
{
// Grabbing the list of principal id's.
$stmt = $this->pdo->prepare('SELECT id, uri FROM '.$this->tableName.' WHERE uri IN (? '.str_repeat(', ? ', count($members)).');');
$stmt->execute(array_merge([$principal], $members));
... | php | {
"resource": ""
} |
q27044 | PDO.createPrincipal | train | public function createPrincipal($path, MkCol $mkCol)
{
$stmt = $this->pdo->prepare('INSERT INTO '.$this->tableName.' (uri) VALUES (?)');
$stmt->execute([$path]);
$this->updatePrincipal($path, $mkCol);
} | php | {
"resource": ""
} |
q27045 | TemporaryFileFilterPlugin.initialize | train | public function initialize(Server $server)
{
$this->server = $server;
$server->on('beforeMethod:*', [$this, 'beforeMethod']);
$server->on('beforeCreateFile', [$this, 'beforeCreateFile']);
} | php | {
"resource": ""
} |
q27046 | TemporaryFileFilterPlugin.beforeMethod | train | public function beforeMethod(RequestInterface $request, ResponseInterface $response)
{
if (!$tempLocation = $this->isTempFile($request->getPath())) {
return;
}
switch ($request->getMethod()) {
case 'GET':
return $this->httpGet($request, $response, $te... | php | {
"resource": ""
} |
q27047 | TemporaryFileFilterPlugin.beforeCreateFile | train | public function beforeCreateFile($uri, $data, ICollection $parent, $modified)
{
if ($tempPath = $this->isTempFile($uri)) {
$hR = $this->server->httpResponse;
$hR->setHeader('X-Sabre-Temp', 'true');
file_put_contents($tempPath, $data);
return false;
}
... | php | {
"resource": ""
} |
q27048 | TemporaryFileFilterPlugin.httpGet | train | public function httpGet(RequestInterface $request, ResponseInterface $hR, $tempLocation)
{
if (!file_exists($tempLocation)) {
return;
}
$hR->setHeader('Content-Type', 'application/octet-stream');
$hR->setHeader('Content-Length', filesize($tempLocation));
$hR->set... | php | {
"resource": ""
} |
q27049 | TemporaryFileFilterPlugin.httpPut | train | public function httpPut(RequestInterface $request, ResponseInterface $hR, $tempLocation)
{
$hR->setHeader('X-Sabre-Temp', 'true');
$newFile = !file_exists($tempLocation);
if (!$newFile && ($this->server->httpRequest->getHeader('If-None-Match'))) {
throw new Exception\Preconditi... | php | {
"resource": ""
} |
q27050 | TemporaryFileFilterPlugin.httpDelete | train | public function httpDelete(RequestInterface $request, ResponseInterface $hR, $tempLocation)
{
if (!file_exists($tempLocation)) {
return;
}
unlink($tempLocation);
$hR->setHeader('X-Sabre-Temp', 'true');
$hR->setStatus(204);
return false;
} | php | {
"resource": ""
} |
q27051 | TemporaryFileFilterPlugin.httpPropfind | train | public function httpPropfind(RequestInterface $request, ResponseInterface $hR, $tempLocation)
{
if (!file_exists($tempLocation)) {
return;
}
$hR->setHeader('X-Sabre-Temp', 'true');
$hR->setStatus(207);
$hR->setHeader('Content-Type', 'application/xml; charset=utf-... | php | {
"resource": ""
} |
q27052 | Plugin.shareResource | train | public function shareResource($path, array $sharees)
{
$node = $this->server->tree->getNodeForPath($path);
if (!$node instanceof ISharedNode) {
throw new Forbidden('Sharing is not allowed on this node');
}
// Getting ACL info
$acl = $this->server->getPlugin('acl... | php | {
"resource": ""
} |
q27053 | Plugin.propFind | train | public function propFind(PropFind $propFind, INode $node)
{
if ($node instanceof ISharedNode) {
$propFind->handle('{DAV:}share-access', function () use ($node) {
return new Property\ShareAccess($node->getShareAccess());
});
$propFind->handle('{DAV:}invite'... | php | {
"resource": ""
} |
q27054 | Plugin.httpPost | train | public function httpPost(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$contentType = $request->getHeader('Content-Type');
if (null === $contentType) {
return;
}
// We're only interested in the davsharing content type.
... | php | {
"resource": ""
} |
q27055 | Plugin.htmlActionsPanel | train | public function htmlActionsPanel(INode $node, &$output, $path)
{
if (!$node instanceof ISharedNode) {
return;
}
$aclPlugin = $this->server->getPlugin('acl');
if ($aclPlugin) {
if (!$aclPlugin->checkPrivileges($path, '{DAV:}share', \Sabre\DAVACL\Plugin::R_PARE... | php | {
"resource": ""
} |
q27056 | Plugin.browserPostAction | train | public function browserPostAction($path, $action, $postVars)
{
if ('share' !== $action) {
return;
}
if (empty($postVars['href'])) {
throw new BadRequest('The "href" POST parameter is required');
}
if (empty($postVars['access'])) {
throw ne... | php | {
"resource": ""
} |
q27057 | Server.getBaseUri | train | public function getBaseUri()
{
if (is_null($this->baseUri)) {
$this->baseUri = $this->guessBaseUri();
}
return $this->baseUri;
} | php | {
"resource": ""
} |
q27058 | Server.guessBaseUri | train | public function guessBaseUri()
{
$pathInfo = $this->httpRequest->getRawServerValue('PATH_INFO');
$uri = $this->httpRequest->getRawServerValue('REQUEST_URI');
// If PATH_INFO is found, we can assume it's accurate.
if (!empty($pathInfo)) {
// We need to make sure we ignore... | php | {
"resource": ""
} |
q27059 | Server.addPlugin | train | public function addPlugin(ServerPlugin $plugin)
{
$this->plugins[$plugin->getPluginName()] = $plugin;
$plugin->initialize($this);
} | php | {
"resource": ""
} |
q27060 | Server.getPlugin | train | public function getPlugin($name)
{
if (isset($this->plugins[$name])) {
return $this->plugins[$name];
}
return null;
} | php | {
"resource": ""
} |
q27061 | Server.invokeMethod | train | public function invokeMethod(RequestInterface $request, ResponseInterface $response, $sendResponse = true)
{
$method = $request->getMethod();
if (!$this->emit('beforeMethod:'.$method, [$request, $response])) {
return;
}
if (self::$exposeVersion) {
$response-... | php | {
"resource": ""
} |
q27062 | Server.getAllowedMethods | train | public function getAllowedMethods($path)
{
$methods = [
'OPTIONS',
'GET',
'HEAD',
'DELETE',
'PROPFIND',
'PUT',
'PROPPATCH',
'COPY',
'MOVE',
'REPORT',
];
// The MKCOL is on... | php | {
"resource": ""
} |
q27063 | Server.calculateUri | train | public function calculateUri($uri)
{
if ('' != $uri && '/' != $uri[0] && strpos($uri, '://')) {
$uri = parse_url($uri, PHP_URL_PATH);
}
$uri = Uri\normalize(preg_replace('|/+|', '/', $uri));
$baseUri = Uri\normalize($this->getBaseUri());
if (0 === strpos($uri, $... | php | {
"resource": ""
} |
q27064 | Server.getHTTPDepth | train | public function getHTTPDepth($default = self::DEPTH_INFINITY)
{
// If its not set, we'll grab the default
$depth = $this->httpRequest->getHeader('Depth');
if (is_null($depth)) {
return $default;
}
if ('infinity' == $depth) {
return self::DEPTH_INFINI... | php | {
"resource": ""
} |
q27065 | Server.getHTTPRange | train | public function getHTTPRange()
{
$range = $this->httpRequest->getHeader('range');
if (is_null($range)) {
return null;
}
// Matching "Range: bytes=1234-5678: both numbers are optional
if (!preg_match('/^bytes=([0-9]*)-([0-9]*)$/i', $range, $matches)) {
... | php | {
"resource": ""
} |
q27066 | Server.getHTTPPrefer | train | public function getHTTPPrefer()
{
$result = [
// can be true or false
'respond-async' => false,
// Could be set to 'representation' or 'minimal'.
'return' => null,
// Used as a timeout, is usually a number.
'wait' => null,
/... | php | {
"resource": ""
} |
q27067 | Server.getCopyAndMoveInfo | train | public function getCopyAndMoveInfo(RequestInterface $request)
{
// Collecting the relevant HTTP headers
if (!$request->getHeader('Destination')) {
throw new Exception\BadRequest('The destination header was not supplied');
}
$destination = $this->calculateUri($request->get... | php | {
"resource": ""
} |
q27068 | Server.getProperties | train | public function getProperties($path, $propertyNames)
{
$result = $this->getPropertiesForPath($path, $propertyNames, 0);
if (isset($result[0][200])) {
return $result[0][200];
} else {
return [];
}
} | php | {
"resource": ""
} |
q27069 | Server.getPropertiesForChildren | train | public function getPropertiesForChildren($path, $propertyNames)
{
$result = [];
foreach ($this->getPropertiesForPath($path, $propertyNames, 1) as $k => $row) {
// Skipping the parent path
if (0 === $k) {
continue;
}
$result[$row['href'... | php | {
"resource": ""
} |
q27070 | Server.getHTTPHeaders | train | public function getHTTPHeaders($path)
{
$propertyMap = [
'{DAV:}getcontenttype' => 'Content-Type',
'{DAV:}getcontentlength' => 'Content-Length',
'{DAV:}getlastmodified' => 'Last-Modified',
'{DAV:}getetag' => 'ETag',
];
$properties = $this->get... | php | {
"resource": ""
} |
q27071 | Server.generatePathNodes | train | private function generatePathNodes(PropFind $propFind, array $yieldFirst = null)
{
if (null !== $yieldFirst) {
yield $yieldFirst;
}
$newDepth = $propFind->getDepth();
$path = $propFind->getPath();
if (self::DEPTH_INFINITY !== $newDepth) {
--$newDepth;... | php | {
"resource": ""
} |
q27072 | Server.getPropertiesForMultiplePaths | train | public function getPropertiesForMultiplePaths(array $paths, array $propertyNames = [])
{
$result = [
];
$nodes = $this->tree->getMultipleNodes($paths);
foreach ($nodes as $path => $node) {
$propFind = new PropFind($path, $propertyNames);
$r = $this->getPrope... | php | {
"resource": ""
} |
q27073 | Server.createFile | train | public function createFile($uri, $data, &$etag = null)
{
list($dir, $name) = Uri\split($uri);
if (!$this->emit('beforeBind', [$uri])) {
return false;
}
$parent = $this->tree->getNodeForPath($dir);
if (!$parent instanceof ICollection) {
throw new Exce... | php | {
"resource": ""
} |
q27074 | Server.updateFile | train | public function updateFile($uri, $data, &$etag = null)
{
$node = $this->tree->getNodeForPath($uri);
// It is possible for an event handler to modify the content of the
// body, before it gets written. If this is the case, $modified
// should be set to true.
//
// If ... | php | {
"resource": ""
} |
q27075 | Server.createCollection | train | public function createCollection($uri, MkCol $mkCol)
{
list($parentUri, $newName) = Uri\split($uri);
// Making sure the parent exists
try {
$parent = $this->tree->getNodeForPath($parentUri);
} catch (Exception\NotFound $e) {
throw new Exception\Conflict('Pare... | php | {
"resource": ""
} |
q27076 | Server.updateProperties | train | public function updateProperties($path, array $properties)
{
$propPatch = new PropPatch($properties);
$this->emit('propPatch', [$path, $propPatch]);
$propPatch->commit();
return $propPatch->getResult();
} | php | {
"resource": ""
} |
q27077 | Server.getResourceTypeForNode | train | public function getResourceTypeForNode(INode $node)
{
$result = [];
foreach ($this->resourceTypeMapping as $className => $resourceType) {
if ($node instanceof $className) {
$result[] = $resourceType;
}
}
return $result;
} | php | {
"resource": ""
} |
q27078 | Server.generateMultiStatus | train | public function generateMultiStatus($fileProperties, $strip404s = false)
{
$w = $this->xml->getWriter();
$w->openMemory();
$w->contextUri = $this->baseUri;
$w->startDocument();
$w->startElement('{DAV:}multistatus');
foreach ($fileProperties as $entry) {
... | php | {
"resource": ""
} |
q27079 | MapGetToPropFind.httpGet | train | public function httpGet(RequestInterface $request, ResponseInterface $response)
{
$node = $this->server->tree->getNodeForPath($request->getPath());
if ($node instanceof DAV\IFile) {
return;
}
$subRequest = clone $request;
$subRequest->setMethod('PROPFIND');
... | php | {
"resource": ""
} |
q27080 | User.childExists | train | public function childExists($name)
{
try {
$this->getChild($name);
return true;
} catch (DAV\Exception\NotFound $e) {
return false;
}
} | php | {
"resource": ""
} |
q27081 | CorePlugin.httpOptions | train | public function httpOptions(RequestInterface $request, ResponseInterface $response)
{
$methods = $this->server->getAllowedMethods($request->getPath());
$response->setHeader('Allow', strtoupper(implode(', ', $methods)));
$features = ['1', '3', 'extended-mkcol'];
foreach ($this->serv... | php | {
"resource": ""
} |
q27082 | CorePlugin.httpHead | train | public function httpHead(RequestInterface $request, ResponseInterface $response)
{
// This is implemented by changing the HEAD request to a GET request,
// and telling the request handler that is doesn't need to create the body.
$subRequest = clone $request;
$subRequest->setMethod('G... | php | {
"resource": ""
} |
q27083 | CorePlugin.httpDelete | train | public function httpDelete(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
if (!$this->server->emit('beforeUnbind', [$path])) {
return false;
}
$this->server->tree->delete($path);
$this->server->emit('afterUnbind', [$path]);... | php | {
"resource": ""
} |
q27084 | CorePlugin.httpPropFind | train | public function httpPropFind(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$requestBody = $request->getBodyAsString();
if (strlen($requestBody)) {
try {
$propFindXml = $this->server->xml->expect('{DAV:}propfind', $requestB... | php | {
"resource": ""
} |
q27085 | CorePlugin.httpPropPatch | train | public function httpPropPatch(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
try {
$propPatch = $this->server->xml->expect('{DAV:}propertyupdate', $request->getBody());
} catch (ParseException $e) {
throw new BadRequest($e->get... | php | {
"resource": ""
} |
q27086 | CorePlugin.httpPut | train | public function httpPut(RequestInterface $request, ResponseInterface $response)
{
$body = $request->getBodyAsStream();
$path = $request->getPath();
// Intercepting Content-Range
if ($request->getHeader('Content-Range')) {
/*
An origin server that allows PU... | php | {
"resource": ""
} |
q27087 | CorePlugin.httpMkcol | train | public function httpMkcol(RequestInterface $request, ResponseInterface $response)
{
$requestBody = $request->getBodyAsString();
$path = $request->getPath();
if ($requestBody) {
$contentType = $request->getHeader('Content-Type');
if (null === $contentType || (0 !== st... | php | {
"resource": ""
} |
q27088 | CorePlugin.httpMove | train | public function httpMove(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$moveInfo = $this->server->getCopyAndMoveInfo($request);
if ($moveInfo['destinationExists']) {
if (!$this->server->emit('beforeUnbind', [$moveInfo['destination']])) {... | php | {
"resource": ""
} |
q27089 | CorePlugin.httpCopy | train | public function httpCopy(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$copyInfo = $this->server->getCopyAndMoveInfo($request);
if (!$this->server->emit('beforeBind', [$copyInfo['destination']])) {
return false;
}
if ($co... | php | {
"resource": ""
} |
q27090 | CorePlugin.httpReport | train | public function httpReport(RequestInterface $request, ResponseInterface $response)
{
$path = $request->getPath();
$result = $this->server->xml->parse(
$request->getBody(),
$request->getUrl(),
$rootElementName
);
if ($this->server->emit('report', ... | php | {
"resource": ""
} |
q27091 | CorePlugin.propFindNode | train | public function propFindNode(PropFind $propFind, INode $node)
{
if ($node instanceof IProperties && $propertyNames = $propFind->get404Properties()) {
$nodeProperties = $node->getProperties($propertyNames);
foreach ($nodeProperties as $propertyName => $propertyValue) {
... | php | {
"resource": ""
} |
q27092 | CorePlugin.exception | train | public function exception($e)
{
$logLevel = \Psr\Log\LogLevel::CRITICAL;
if ($e instanceof \Sabre\DAV\Exception) {
// If it's a standard sabre/dav exception, it means we have a http
// status code available.
$code = $e->getHTTPCode();
if ($code >= 400... | php | {
"resource": ""
} |
q27093 | SupportedReportSet.addReport | train | public function addReport($report)
{
$report = (array) $report;
foreach ($report as $r) {
if (!preg_match('/^{([^}]*)}(.*)$/', $r)) {
throw new DAV\Exception('Reportname must be in clark-notation');
}
$this->reports[] = $r;
}
} | php | {
"resource": ""
} |
q27094 | PDO.getAddressBooksForUser | train | public function getAddressBooksForUser($principalUri)
{
$stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, synctoken FROM '.$this->addressBooksTableName.' WHERE principaluri = ?');
$stmt->execute([$principalUri]);
$addressBooks = [];
foreach ($stmt... | php | {
"resource": ""
} |
q27095 | PDO.updateAddressBook | train | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
{
$supportedProperties = [
'{DAV:}displayname',
'{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description',
];
$propPatch->handle($supportedProperties, function ($mutations) use ($addre... | php | {
"resource": ""
} |
q27096 | PDO.deleteAddressBook | train | public function deleteAddressBook($addressBookId)
{
$stmt = $this->pdo->prepare('DELETE FROM '.$this->cardsTableName.' WHERE addressbookid = ?');
$stmt->execute([$addressBookId]);
$stmt = $this->pdo->prepare('DELETE FROM '.$this->addressBooksTableName.' WHERE id = ?');
$stmt->execut... | php | {
"resource": ""
} |
q27097 | PDO.getCards | train | public function getCards($addressbookId)
{
$stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, size FROM '.$this->cardsTableName.' WHERE addressbookid = ?');
$stmt->execute([$addressbookId]);
$result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$ro... | php | {
"resource": ""
} |
q27098 | PDO.getCard | train | public function getCard($addressBookId, $cardUri)
{
$stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified, etag, size FROM '.$this->cardsTableName.' WHERE addressbookid = ? AND uri = ? LIMIT 1');
$stmt->execute([$addressBookId, $cardUri]);
$result = $stmt->fetch(\PDO::FETCH_AS... | php | {
"resource": ""
} |
q27099 | PDO.createCard | train | public function createCard($addressBookId, $cardUri, $cardData)
{
$stmt = $this->pdo->prepare('INSERT INTO '.$this->cardsTableName.' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');
$etag = md5($cardData);
$stmt->execute([
$cardData,
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.