repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/dfsbackends/dfs_filter_iterator.php
eZDFSFileHandlerDFSBackendFilterIterator.current
public function current() { /** @var SplFileInfo $file */ $file = $this->getInnerIterator()->current(); $filePathName = $file->getPathname(); // Trim prefix + 1 for leading / return substr( $filePathName, strlen( $this->prefix ) + 1 ); }
php
public function current() { /** @var SplFileInfo $file */ $file = $this->getInnerIterator()->current(); $filePathName = $file->getPathname(); // Trim prefix + 1 for leading / return substr( $filePathName, strlen( $this->prefix ) + 1 ); }
[ "public", "function", "current", "(", ")", "{", "/** @var SplFileInfo $file */", "$", "file", "=", "$", "this", "->", "getInnerIterator", "(", ")", "->", "current", "(", ")", ";", "$", "filePathName", "=", "$", "file", "->", "getPathname", "(", ")", ";", ...
Transforms the SplFileInfo in a simple relative path @return string The relative path to the current file
[ "Transforms", "the", "SplFileInfo", "in", "a", "simple", "relative", "path" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/dfsbackends/dfs_filter_iterator.php#L40-L48
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/status/response.php
ezpRestStatusResponse.process
public function process( ezcMvcResponseWriter $writer ) { if ( $writer instanceof ezcMvcHttpResponseWriter ) { $writer->headers["HTTP/1.1 " . $this->code] = self::$statusCodes[$this->code]; $writer->headers = $this->headers + $writer->headers; } if ( $this->message !== null ) { $writer->headers['Content-Type'] = 'application/json; charset=UTF-8'; $writer->response->body = json_encode( $this->message ); } }
php
public function process( ezcMvcResponseWriter $writer ) { if ( $writer instanceof ezcMvcHttpResponseWriter ) { $writer->headers["HTTP/1.1 " . $this->code] = self::$statusCodes[$this->code]; $writer->headers = $this->headers + $writer->headers; } if ( $this->message !== null ) { $writer->headers['Content-Type'] = 'application/json; charset=UTF-8'; $writer->response->body = json_encode( $this->message ); } }
[ "public", "function", "process", "(", "ezcMvcResponseWriter", "$", "writer", ")", "{", "if", "(", "$", "writer", "instanceof", "ezcMvcHttpResponseWriter", ")", "{", "$", "writer", "->", "headers", "[", "\"HTTP/1.1 \"", ".", "$", "this", "->", "code", "]", "=...
This method is called by the response writers to process the data contained in the status objects. The process method it responsible for undertaking the proper action depending on which response writer is used. @param ezcMvcResponseWriter $writer
[ "This", "method", "is", "called", "by", "the", "response", "writers", "to", "process", "the", "data", "contained", "in", "the", "status", "objects", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/status/response.php#L95-L108
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.getToken
public static function getToken( ezcMvcRequest $request ) { // 1. Should first extract required token from the request object // as we know that the request parser does not support this at the // moment we, will skip to the fallback right away. That is to say, // ideally the request parser would make this header available to us, // when available, automatically. $token = null; $checkStack = array( 'header', 'get', 'post' ); foreach ( $checkStack as $step ) { switch ( $step ) { case 'header': $token = self::getTokenFromAuthorizationHeader(); break; case 'get': $token = self::getTokenFromQueryComponent( $request ); break; case 'post': $token = self::getTokenFromHttpBody( $request ); break; } if ( isset( $token ) ) // Go out of the loop if we find the token during the iteration { break; } } return $token; }
php
public static function getToken( ezcMvcRequest $request ) { // 1. Should first extract required token from the request object // as we know that the request parser does not support this at the // moment we, will skip to the fallback right away. That is to say, // ideally the request parser would make this header available to us, // when available, automatically. $token = null; $checkStack = array( 'header', 'get', 'post' ); foreach ( $checkStack as $step ) { switch ( $step ) { case 'header': $token = self::getTokenFromAuthorizationHeader(); break; case 'get': $token = self::getTokenFromQueryComponent( $request ); break; case 'post': $token = self::getTokenFromHttpBody( $request ); break; } if ( isset( $token ) ) // Go out of the loop if we find the token during the iteration { break; } } return $token; }
[ "public", "static", "function", "getToken", "(", "ezcMvcRequest", "$", "request", ")", "{", "// 1. Should first extract required token from the request object", "// as we know that the request parser does not support this at the", "// moment we, will skip to the fallback right away. Th...
Retrieving token as per section 5 of draft-ietf-oauth-v2-10 Token can be present inside the Authorize header, inside a URI query parameter, or in the HTTP body. According to section 5.1 the header is the preferred way, and the query component and HTTP body are only looked at if no such header can be found. @TODO A configuration mechanism should alternatively let us select which method to use: 1. header, 2. query component, 3. http body, in other words to override the default behaviour according to spec. @param string $ezcMvcRequest @return void
[ "Retrieving", "token", "as", "per", "section", "5", "of", "draft", "-", "ietf", "-", "oauth", "-", "v2", "-", "10" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L37-L72
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.getTokenFromAuthorizationHeader
protected static function getTokenFromAuthorizationHeader() { $token = null; $authHeader = null; if ( function_exists( 'apache_request_headers' ) ) { $apacheHeaders = apache_request_headers(); if ( isset( $apacheHeaders[self::AUTH_HEADER_NAME] ) ) $authHeader = $apacheHeaders[self::AUTH_HEADER_NAME]; } else { if ( isset( $_SERVER[self::AUTH_CGI_HEADER_NAME] ) ) $authHeader = $_SERVER[self::AUTH_CGI_HEADER_NAME]; } if ( isset( $authHeader ) ) { $tokenPattern = "/^(?P<authscheme>OAuth)\s(?P<token>[a-zA-Z0-9]+)$/"; $match = preg_match( $tokenPattern, $authHeader, $m ); if ( $match > 0 ) { $token = $m['token']; } } return $token; }
php
protected static function getTokenFromAuthorizationHeader() { $token = null; $authHeader = null; if ( function_exists( 'apache_request_headers' ) ) { $apacheHeaders = apache_request_headers(); if ( isset( $apacheHeaders[self::AUTH_HEADER_NAME] ) ) $authHeader = $apacheHeaders[self::AUTH_HEADER_NAME]; } else { if ( isset( $_SERVER[self::AUTH_CGI_HEADER_NAME] ) ) $authHeader = $_SERVER[self::AUTH_CGI_HEADER_NAME]; } if ( isset( $authHeader ) ) { $tokenPattern = "/^(?P<authscheme>OAuth)\s(?P<token>[a-zA-Z0-9]+)$/"; $match = preg_match( $tokenPattern, $authHeader, $m ); if ( $match > 0 ) { $token = $m['token']; } } return $token; }
[ "protected", "static", "function", "getTokenFromAuthorizationHeader", "(", ")", "{", "$", "token", "=", "null", ";", "$", "authHeader", "=", "null", ";", "if", "(", "function_exists", "(", "'apache_request_headers'", ")", ")", "{", "$", "apacheHeaders", "=", "...
Extracts the OAuth token from the HTTP header, Authorization. The token is transmitted via the OAuth Authentication scheme ref. Section 5.1.1. PHP does not expose the Authorization header unless it uses the 'Basic' or 'Digest' schemes, and it is therefore extracted from the raw Apache headers. On systems running CGI or Fast-CGI PHP makes this header available via the <var>HTTP_AUTHORIZATION</var> header. @link http://php.net/manual/en/features.http-auth.php @throws ezpOauthInvalidRequestException @return string The access token string.
[ "Extracts", "the", "OAuth", "token", "from", "the", "HTTP", "header", "Authorization", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L91-L119
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.getTokenFromQueryComponent
protected static function getTokenFromQueryComponent( ezpRestRequest $request ) { $token = null; if( isset( $request->get['oauth_token'] ) ) { //throw new ezpOauthInvalidRequestException( "OAuth token not found in query component." ); $token = $request->get['oauth_token']; } return $token; }
php
protected static function getTokenFromQueryComponent( ezpRestRequest $request ) { $token = null; if( isset( $request->get['oauth_token'] ) ) { //throw new ezpOauthInvalidRequestException( "OAuth token not found in query component." ); $token = $request->get['oauth_token']; } return $token; }
[ "protected", "static", "function", "getTokenFromQueryComponent", "(", "ezpRestRequest", "$", "request", ")", "{", "$", "token", "=", "null", ";", "if", "(", "isset", "(", "$", "request", "->", "get", "[", "'oauth_token'", "]", ")", ")", "{", "//throw new ezp...
Extracts OAuth token query component aka GET parameter. For more information See section 5.1.2 of oauth2.0 v10 @throws ezpOauthInvalidRequestException @param ezcMvcRequest $request @return string The access token string
[ "Extracts", "OAuth", "token", "query", "component", "aka", "GET", "parameter", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L130-L140
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.getTokenFromHttpBody
protected static function getTokenFromHttpBody( ezpRestRequest $request ) { $token = null; if ( isset( $request->post['oauth_token'] ) ) { $token = $request->post['oauth_token']; } return $token; }
php
protected static function getTokenFromHttpBody( ezpRestRequest $request ) { $token = null; if ( isset( $request->post['oauth_token'] ) ) { $token = $request->post['oauth_token']; } return $token; }
[ "protected", "static", "function", "getTokenFromHttpBody", "(", "ezpRestRequest", "$", "request", ")", "{", "$", "token", "=", "null", ";", "if", "(", "isset", "(", "$", "request", "->", "post", "[", "'oauth_token'", "]", ")", ")", "{", "$", "token", "="...
Extracts OAuth token fro HTTP Post body. For more information see section 5.1.3 oauth2.0 v10 @param ezpRestRequest $request @return string The access token string
[ "Extracts", "OAuth", "token", "fro", "HTTP", "Post", "body", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L149-L158
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.doRefreshToken
public static function doRefreshToken( $clientId, $clientSecret, $refreshToken ) { $client = ezpRestClient::fetchByClientId( $clientId ); $tokenTTL = (int)eZINI::instance( 'rest.ini' )->variable( 'OAuthSettings', 'TokenTTL' ); if (! ( $client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->validateSecret( $clientSecret ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); $session = ezcPersistentSessionInstance::get(); $q = $session->createFindQuery( 'ezpRestToken' ); $q->where( $q->expr->eq( 'refresh_token', $q->bindValue( $refreshToken ) ) ); $refreshInfo = $session->find( $q, 'ezpRestToken' ); if ( empty( $refreshInfo) ) { throw new ezpOauthInvalidRequestException( "Specified refresh-token does not exist." ); } $refreshInfo = array_shift( $refreshInfo ); // Validate client is still authorized, then validate code is not expired $authorized = ezpRestAuthorizedClient::fetchForClientUser( $client, eZUser::fetch( $refreshInfo->user_id ) ); if ( !($authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); } // Ideally there should be a separate expiry for refresh tokens here, for now allow. $newToken = new ezpRestToken(); $newToken->id = ezpRestToken::generateToken( '' ); $newToken->refresh_token = ezpRestToken::generateToken( '' ); $newToken->client_id = $clientId; $newToken->user_id = $refreshInfo->user_id; $newToken->expirytime = time() + $tokenTTL; $session->save( $newToken ); $session->delete( $refreshInfo ); return $newToken; }
php
public static function doRefreshToken( $clientId, $clientSecret, $refreshToken ) { $client = ezpRestClient::fetchByClientId( $clientId ); $tokenTTL = (int)eZINI::instance( 'rest.ini' )->variable( 'OAuthSettings', 'TokenTTL' ); if (! ( $client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->validateSecret( $clientSecret ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); $session = ezcPersistentSessionInstance::get(); $q = $session->createFindQuery( 'ezpRestToken' ); $q->where( $q->expr->eq( 'refresh_token', $q->bindValue( $refreshToken ) ) ); $refreshInfo = $session->find( $q, 'ezpRestToken' ); if ( empty( $refreshInfo) ) { throw new ezpOauthInvalidRequestException( "Specified refresh-token does not exist." ); } $refreshInfo = array_shift( $refreshInfo ); // Validate client is still authorized, then validate code is not expired $authorized = ezpRestAuthorizedClient::fetchForClientUser( $client, eZUser::fetch( $refreshInfo->user_id ) ); if ( !($authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); } // Ideally there should be a separate expiry for refresh tokens here, for now allow. $newToken = new ezpRestToken(); $newToken->id = ezpRestToken::generateToken( '' ); $newToken->refresh_token = ezpRestToken::generateToken( '' ); $newToken->client_id = $clientId; $newToken->user_id = $refreshInfo->user_id; $newToken->expirytime = time() + $tokenTTL; $session->save( $newToken ); $session->delete( $refreshInfo ); return $newToken; }
[ "public", "static", "function", "doRefreshToken", "(", "$", "clientId", ",", "$", "clientSecret", ",", "$", "refreshToken", ")", "{", "$", "client", "=", "ezpRestClient", "::", "fetchByClientId", "(", "$", "clientId", ")", ";", "$", "tokenTTL", "=", "(", "...
Handles a refresh_token request. Returns the new token object as ezpRestToken @param string $clientId Client identifier @param string $clientSecret Client secret key @param string $refreshToken Refresh token @return ezpRestToken @throws ezpOauthInvalidRequestException
[ "Handles", "a", "refresh_token", "request", ".", "Returns", "the", "new", "token", "object", "as", "ezpRestToken" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L169-L214
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/oauth/utility.php
ezpOauthUtility.doRefreshTokenWithAuthorizationCode
public static function doRefreshTokenWithAuthorizationCode( $clientId, $clientSecret, $authCode, $redirectUri ) { $client = ezpRestClient::fetchByClientId( $clientId ); $tokenTTL = (int)eZINI::instance( 'rest.ini' )->variable( 'OAuthSettings', 'TokenTTL' ); if (! ( $client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->validateSecret( $clientSecret ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->isEndPointValid( $redirectUri ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_REQUEST ); $session = ezcPersistentSessionInstance::get(); $q = $session->createFindQuery( 'ezpRestAuthcode' ); $q->where( $q->expr->eq( 'id', $q->bindValue( $authCode ) ) ); $codeInfo = $session->find( $q, 'ezpRestAuthcode' ); if ( empty( $codeInfo ) ) { throw new ezpOauthInvalidTokenException( "Specified authorization code does not exist." ); } $codeInfo = array_shift( $codeInfo ); // Validate client is still authorized, then validate code is not expired $authorized = ezpRestAuthorizedClient::fetchForClientUser( $client, eZUser::fetch( $codeInfo->user_id ) ); if ( !($authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); } // Check expiry of authorization_code if ( $codeInfo->expirytime != 0 ) { if ( $codeInfo->expirytime < time() ) { $d = date( "c", $codeInfo->expirytime ); throw new ezpOauthExpiredTokenException( "Authorization code expired on {$d}" ); } } // code ok, create access and refresh tokens $accessToken = ezpRestToken::generateToken( '' ); $refreshToken = ezpRestToken::generateToken( '' ); $token = new ezpRestToken(); $token->id = $accessToken; $token->refresh_token = $refreshToken; $token->client_id = $clientId; $token->user_id = $codeInfo->user_id; $token->expirytime = time() + $tokenTTL; $session = ezcPersistentSessionInstance::get(); $session->save( $token ); // After an auth code is used, we'll remove it so it is not abused $session->delete( $codeInfo ); return $token; }
php
public static function doRefreshTokenWithAuthorizationCode( $clientId, $clientSecret, $authCode, $redirectUri ) { $client = ezpRestClient::fetchByClientId( $clientId ); $tokenTTL = (int)eZINI::instance( 'rest.ini' )->variable( 'OAuthSettings', 'TokenTTL' ); if (! ( $client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->validateSecret( $clientSecret ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); if ( !$client->isEndPointValid( $redirectUri ) ) throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_REQUEST ); $session = ezcPersistentSessionInstance::get(); $q = $session->createFindQuery( 'ezpRestAuthcode' ); $q->where( $q->expr->eq( 'id', $q->bindValue( $authCode ) ) ); $codeInfo = $session->find( $q, 'ezpRestAuthcode' ); if ( empty( $codeInfo ) ) { throw new ezpOauthInvalidTokenException( "Specified authorization code does not exist." ); } $codeInfo = array_shift( $codeInfo ); // Validate client is still authorized, then validate code is not expired $authorized = ezpRestAuthorizedClient::fetchForClientUser( $client, eZUser::fetch( $codeInfo->user_id ) ); if ( !($authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException( ezpOauthTokenEndpointErrorType::INVALID_CLIENT ); } // Check expiry of authorization_code if ( $codeInfo->expirytime != 0 ) { if ( $codeInfo->expirytime < time() ) { $d = date( "c", $codeInfo->expirytime ); throw new ezpOauthExpiredTokenException( "Authorization code expired on {$d}" ); } } // code ok, create access and refresh tokens $accessToken = ezpRestToken::generateToken( '' ); $refreshToken = ezpRestToken::generateToken( '' ); $token = new ezpRestToken(); $token->id = $accessToken; $token->refresh_token = $refreshToken; $token->client_id = $clientId; $token->user_id = $codeInfo->user_id; $token->expirytime = time() + $tokenTTL; $session = ezcPersistentSessionInstance::get(); $session->save( $token ); // After an auth code is used, we'll remove it so it is not abused $session->delete( $codeInfo ); return $token; }
[ "public", "static", "function", "doRefreshTokenWithAuthorizationCode", "(", "$", "clientId", ",", "$", "clientSecret", ",", "$", "authCode", ",", "$", "redirectUri", ")", "{", "$", "client", "=", "ezpRestClient", "::", "fetchByClientId", "(", "$", "clientId", ")...
Generates a new token against an authorization_code Auth code is checked against clientId, clientSecret and redirectUri as registered for client in admin Auth code is for one-use only and will be removed once the access token generated @param string $clientId Client identifier @param string $clientSecret Client secret key @param string $authCode Authorization code provided by the client @param string $redirectUri Redirect URI. Must be the same as registered in admin @return ezpRestToken @throws ezpOauthInvalidRequestException @throws ezpOauthInvalidTokenException @throws ezpOauthExpiredTokenException
[ "Generates", "a", "new", "token", "against", "an", "authorization_code", "Auth", "code", "is", "checked", "against", "clientId", "clientSecret", "and", "redirectUri", "as", "registered", "for", "client", "in", "admin", "Auth", "code", "is", "for", "one", "-", ...
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/oauth/utility.php#L229-L291
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getNodes
protected function getNodes( $requestUri, $depth ) { $source = $requestUri; $nodeInfo = $this->getNodeInfo( $requestUri ); if ( !$nodeInfo['nodeExists'] ) { return array(); } // No special handling for plain resources if ( !$nodeInfo['isCollection'] ) { return array( new ezcWebdavResource( $source, $this->getAllProperties( $source ) ) ); } // For zero depth just return the collection if ( $depth === ezcWebdavRequest::DEPTH_ZERO ) { return array( new ezcWebdavCollection( $source, $this->getAllProperties( $source ) ) ); } $nodes = array( new ezcWebdavCollection( $source, $this->getAllProperties( $source ) ) ); $recurseCollections = array( $source ); // Collect children for all collections listed in $recurseCollections. for ( $i = 0; $i < count( $recurseCollections ); ++$i ) { $source = $recurseCollections[$i]; // add the slash at the end of the path if it is missing if ( $source{strlen( $source ) - 1} !== '/' ) { $source .= '/'; } $children = $this->getCollectionMembers( $source, $depth ); foreach ( $children as $child ) { $nodes[] = $child; // Check if we should recurse deeper, and add collections to // processing list in this case. if ( $child instanceof ezcWebdavCollection && $depth === ezcWebdavRequest::DEPTH_INFINITY && $child->path !== $source ) // @as added for recursive DEPTH_INFINITY { $recurseCollections[] = $child->path; } } } return $nodes; }
php
protected function getNodes( $requestUri, $depth ) { $source = $requestUri; $nodeInfo = $this->getNodeInfo( $requestUri ); if ( !$nodeInfo['nodeExists'] ) { return array(); } // No special handling for plain resources if ( !$nodeInfo['isCollection'] ) { return array( new ezcWebdavResource( $source, $this->getAllProperties( $source ) ) ); } // For zero depth just return the collection if ( $depth === ezcWebdavRequest::DEPTH_ZERO ) { return array( new ezcWebdavCollection( $source, $this->getAllProperties( $source ) ) ); } $nodes = array( new ezcWebdavCollection( $source, $this->getAllProperties( $source ) ) ); $recurseCollections = array( $source ); // Collect children for all collections listed in $recurseCollections. for ( $i = 0; $i < count( $recurseCollections ); ++$i ) { $source = $recurseCollections[$i]; // add the slash at the end of the path if it is missing if ( $source{strlen( $source ) - 1} !== '/' ) { $source .= '/'; } $children = $this->getCollectionMembers( $source, $depth ); foreach ( $children as $child ) { $nodes[] = $child; // Check if we should recurse deeper, and add collections to // processing list in this case. if ( $child instanceof ezcWebdavCollection && $depth === ezcWebdavRequest::DEPTH_INFINITY && $child->path !== $source ) // @as added for recursive DEPTH_INFINITY { $recurseCollections[] = $child->path; } } } return $nodes; }
[ "protected", "function", "getNodes", "(", "$", "requestUri", ",", "$", "depth", ")", "{", "$", "source", "=", "$", "requestUri", ";", "$", "nodeInfo", "=", "$", "this", "->", "getNodeInfo", "(", "$", "requestUri", ")", ";", "if", "(", "!", "$", "node...
Returns all child nodes. Get all nodes from the resource identified by $source up to the given depth. Reuses the method {@link getCollectionMembers()}, but you may want to overwrite this implementation by somethings which fits better with your backend. @param string $source @param int $depth @return array(ezcWebdavResource|ezcWebdavCollection)
[ "Returns", "all", "child", "nodes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L207-L260
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getResourceContents
protected function getResourceContents( $target ) { $result = array( 'data' => false, 'file' => false ); $fullPath = $target; $target = $this->splitFirstPathElement( $fullPath, $currentSite ); $data = $this->getVirtualFolderData( $result, $currentSite, $target, $fullPath ); if ( $data['file'] ) { $file = eZClusterFileHandler::instance( $data['file'] ); //$this->cachedProperties[ $data['file'] ]['size'] = $file->size(); return $file->fetchContents(); } return false; }
php
protected function getResourceContents( $target ) { $result = array( 'data' => false, 'file' => false ); $fullPath = $target; $target = $this->splitFirstPathElement( $fullPath, $currentSite ); $data = $this->getVirtualFolderData( $result, $currentSite, $target, $fullPath ); if ( $data['file'] ) { $file = eZClusterFileHandler::instance( $data['file'] ); //$this->cachedProperties[ $data['file'] ]['size'] = $file->size(); return $file->fetchContents(); } return false; }
[ "protected", "function", "getResourceContents", "(", "$", "target", ")", "{", "$", "result", "=", "array", "(", "'data'", "=>", "false", ",", "'file'", "=>", "false", ")", ";", "$", "fullPath", "=", "$", "target", ";", "$", "target", "=", "$", "this", ...
Returns the contents of a resource. This method returns the content of the resource identified by $path as a string. @param string $target @return string
[ "Returns", "the", "contents", "of", "a", "resource", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L271-L286
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getCollectionMembers
protected function getCollectionMembers( $path, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { $properties = $this->handledLiveProperties; $fullPath = $path; $collection = $this->splitFirstPathElement( $fullPath, $currentSite ); if ( !$currentSite ) { // Display the root which contains a list of sites $entries = $this->fetchSiteListContent( $fullPath, $depth, $properties ); } else { $entries = $this->getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ); } $contents = array(); foreach ( $entries as $entry ) { // prevent infinite recursion if ( $path === $entry['href'] ) { continue; } if ( $entry['mimetype'] === self::DIRECTORY_MIMETYPE ) { // Add collection without any children $contents[] = new ezcWebdavCollection( $entry['href'], $this->getAllProperties( $path ) ); } else { // If this is not a collection, don't leave a trailing '/' // on the href. If you do, Goliath gets confused. $entry['href'] = rtrim( $entry['href'], '/' ); // Add files without content $contents[] = new ezcWebdavResource( $entry['href'], $this->getAllProperties( $path ) ); } } return $contents; }
php
protected function getCollectionMembers( $path, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { $properties = $this->handledLiveProperties; $fullPath = $path; $collection = $this->splitFirstPathElement( $fullPath, $currentSite ); if ( !$currentSite ) { // Display the root which contains a list of sites $entries = $this->fetchSiteListContent( $fullPath, $depth, $properties ); } else { $entries = $this->getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ); } $contents = array(); foreach ( $entries as $entry ) { // prevent infinite recursion if ( $path === $entry['href'] ) { continue; } if ( $entry['mimetype'] === self::DIRECTORY_MIMETYPE ) { // Add collection without any children $contents[] = new ezcWebdavCollection( $entry['href'], $this->getAllProperties( $path ) ); } else { // If this is not a collection, don't leave a trailing '/' // on the href. If you do, Goliath gets confused. $entry['href'] = rtrim( $entry['href'], '/' ); // Add files without content $contents[] = new ezcWebdavResource( $entry['href'], $this->getAllProperties( $path ) ); } } return $contents; }
[ "protected", "function", "getCollectionMembers", "(", "$", "path", ",", "$", "depth", "=", "ezcWebdavRequest", "::", "DEPTH_INFINITY", ")", "{", "$", "properties", "=", "$", "this", "->", "handledLiveProperties", ";", "$", "fullPath", "=", "$", "path", ";", ...
Returns members of collection. Returns an array with the members of the collection identified by $path. The returned array can contain {@link ezcWebdavCollection}, and {@link ezcWebdavResource} instances and might also be empty, if the collection has no members. Added $depth. @param string $path @param int $depth Added by @as @return array(ezcWebdavResource|ezcWebdavCollection)
[ "Returns", "members", "of", "collection", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L302-L345
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getAllProperties
public function getAllProperties( $path ) { $storage = $this->getPropertyStorage( $path ); // Add all live properties to stored properties foreach ( $this->handledLiveProperties as $property ) { $storage->attach( $this->getProperty( $path, $property ) ); } return $storage; }
php
public function getAllProperties( $path ) { $storage = $this->getPropertyStorage( $path ); // Add all live properties to stored properties foreach ( $this->handledLiveProperties as $property ) { $storage->attach( $this->getProperty( $path, $property ) ); } return $storage; }
[ "public", "function", "getAllProperties", "(", "$", "path", ")", "{", "$", "storage", "=", "$", "this", "->", "getPropertyStorage", "(", "$", "path", ")", ";", "// Add all live properties to stored properties", "foreach", "(", "$", "this", "->", "handledLiveProper...
Returns all properties for a resource. Returns all properties for the resource identified by $path as a {@link ezcWebdavBasicPropertyStorage}. @param string $path @return ezcWebdavPropertyStorage
[ "Returns", "all", "properties", "for", "a", "resource", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L523-L536
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.nodeExists
protected function nodeExists( $path ) { if ( !isset( $this->cachedNodes[$path] ) ) { $this->cachedNodes[$path] = $this->getNodeInfo( $path ); } return $this->cachedNodes[$path]['nodeExists']; }
php
protected function nodeExists( $path ) { if ( !isset( $this->cachedNodes[$path] ) ) { $this->cachedNodes[$path] = $this->getNodeInfo( $path ); } return $this->cachedNodes[$path]['nodeExists']; }
[ "protected", "function", "nodeExists", "(", "$", "path", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "cachedNodes", "[", "$", "path", "]", ")", ")", "{", "$", "this", "->", "cachedNodes", "[", "$", "path", "]", "=", "$", "this", "-...
Returns if a resource exists. Returns if a the resource identified by $path exists. @param string $path @return bool
[ "Returns", "if", "a", "resource", "exists", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L563-L571
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.isCollection
protected function isCollection( $path ) { if ( !isset( $this->cachedNodes[$path] ) ) { $this->cachedNodes[$path] = $this->getNodeInfo( $path ); } return $this->cachedNodes[$path]['isCollection']; }
php
protected function isCollection( $path ) { if ( !isset( $this->cachedNodes[$path] ) ) { $this->cachedNodes[$path] = $this->getNodeInfo( $path ); } return $this->cachedNodes[$path]['isCollection']; }
[ "protected", "function", "isCollection", "(", "$", "path", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "cachedNodes", "[", "$", "path", "]", ")", ")", "{", "$", "this", "->", "cachedNodes", "[", "$", "path", "]", "=", "$", "this", ...
Returns if resource is a collection. Returns if the resource identified by $path is a collection resource (true) or a non-collection one (false). @param string $path @return bool
[ "Returns", "if", "resource", "is", "a", "collection", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L582-L590
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.get
public function get( ezcWebdavGetRequest $request ) { $this->acquireLock( true ); $return = parent::get( $request ); $this->freeLock(); return $return; }
php
public function get( ezcWebdavGetRequest $request ) { $this->acquireLock( true ); $return = parent::get( $request ); $this->freeLock(); return $return; }
[ "public", "function", "get", "(", "ezcWebdavGetRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", "true", ")", ";", "$", "return", "=", "parent", "::", "get", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(", ...
Serves GET requests. The method receives a {@link ezcWebdavGetRequest} object containing all relevant information obout the clients request and will return an {@link ezcWebdavErrorResponse} instance on error or an instance of {@link ezcWebdavGetResourceResponse} or {@link ezcWebdavGetCollectionResponse} on success, depending on the type of resource that is referenced by the request. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavGetRequest $request @return ezcWebdavResponse
[ "Serves", "GET", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L609-L616
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.head
public function head( ezcWebdavHeadRequest $request ) { $this->acquireLock( true ); $return = parent::head( $request ); $this->freeLock(); return $return; }
php
public function head( ezcWebdavHeadRequest $request ) { $this->acquireLock( true ); $return = parent::head( $request ); $this->freeLock(); return $return; }
[ "public", "function", "head", "(", "ezcWebdavHeadRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", "true", ")", ";", "$", "return", "=", "parent", "::", "head", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(",...
Serves HEAD requests. The method receives a {@link ezcWebdavHeadRequest} object containing all relevant information obout the clients request and will return an {@link ezcWebdavErrorResponse} instance on error or an instance of {@link ezcWebdavHeadResponse} on success. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavHeadRequest $request @return ezcWebdavResponse
[ "Serves", "HEAD", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L633-L640
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.propFind
public function propFind( ezcWebdavPropFindRequest $request ) { $ini = eZINI::instance( 'i18n.ini' ); $dataCharset = $ini->variable( 'CharacterSettings', 'Charset' ); $xmlCharset = 'utf-8'; $this->acquireLock( true ); $return = parent::propFind( $request ); if ( isset( $return->responses ) && is_array( $return->responses ) ) { foreach ( $return->responses as $response ) { $href = $response->node->path; $pathArray = explode( '/', self::recode( $href, $dataCharset, $xmlCharset ) ); $encodedPath = '/'; foreach ( $pathArray as $pathElement ) { if ( $pathElement != '' ) { $encodedPath .= rawurlencode( $pathElement ); $encodedPath .= '/'; } } $encodedPath = rtrim( $encodedPath, '/' ); $response->node->path = $encodedPath; } } $this->freeLock(); return $return; }
php
public function propFind( ezcWebdavPropFindRequest $request ) { $ini = eZINI::instance( 'i18n.ini' ); $dataCharset = $ini->variable( 'CharacterSettings', 'Charset' ); $xmlCharset = 'utf-8'; $this->acquireLock( true ); $return = parent::propFind( $request ); if ( isset( $return->responses ) && is_array( $return->responses ) ) { foreach ( $return->responses as $response ) { $href = $response->node->path; $pathArray = explode( '/', self::recode( $href, $dataCharset, $xmlCharset ) ); $encodedPath = '/'; foreach ( $pathArray as $pathElement ) { if ( $pathElement != '' ) { $encodedPath .= rawurlencode( $pathElement ); $encodedPath .= '/'; } } $encodedPath = rtrim( $encodedPath, '/' ); $response->node->path = $encodedPath; } } $this->freeLock(); return $return; }
[ "public", "function", "propFind", "(", "ezcWebdavPropFindRequest", "$", "request", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", "'i18n.ini'", ")", ";", "$", "dataCharset", "=", "$", "ini", "->", "variable", "(", "'CharacterSettings'", ",", "'Ch...
Serves PROPFIND requests. The method receives a {@link ezcWebdavPropFindRequest} object containing all relevant information obout the clients request and will either return an instance of {@link ezcWebdavErrorResponse} to indicate an error or a {@link ezcWebdavPropFindResponse} on success. If the referenced resource is a collection or if some properties produced errors, an instance of {@link ezcWebdavMultistatusResponse} may be returned. The {@link ezcWebdavPropFindRequest} object contains a definition to find one or more properties of a given collection or non-collection resource. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. This method is an overwrite of the propFind method from ezcWebdavSimpleBackend, a hack necessary to permit correct output of eZ Publish nodes. The array of ezcWebdavPropFindResponse objects returned by ezcWebdavSimpleBackend::propFind is iterated and the paths of the nodes in the ezcWebdavPropFindResponse objects are encoded properly, in order to be displayed correctly in WebDAV clients. The encoding is from the ini setting Charset in [CharacterSettings] in i18n.ini. @param ezcWebdavPropFindRequest $request @return ezcWebdavResponse
[ "Serves", "PROPFIND", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L672-L703
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.propPatch
public function propPatch( ezcWebdavPropPatchRequest $request ) { $this->acquireLock(); $return = parent::propPatch( $request ); $this->freeLock(); return $return; }
php
public function propPatch( ezcWebdavPropPatchRequest $request ) { $this->acquireLock(); $return = parent::propPatch( $request ); $this->freeLock(); return $return; }
[ "public", "function", "propPatch", "(", "ezcWebdavPropPatchRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", ")", ";", "$", "return", "=", "parent", "::", "propPatch", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", ...
Serves PROPPATCH requests. The method receives a {@link ezcWebdavPropPatchRequest} object containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or a {@link ezcWebdavPropPatchResponse} response on success. If the referenced resource is a collection or if only some properties produced errors, an instance of {@link ezcWebdavMultistatusResponse} may be returned. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavPropPatchRequest $request @return ezcWebdavResponse
[ "Serves", "PROPPATCH", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L723-L730
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.setProperty
public function setProperty( $path, ezcWebdavProperty $property ) { if ( !in_array( $property->name, $this->handledLiveProperties, true ) ) { return false; } // @as @todo implement setting properties // @todo implement locking and unlocking based on the code // lock: // replace 30607 with your object ID // $object = eZContentObject::fetch( 30607 ); // $stateGroup = eZContentObjectStateGroup::fetchByIdentifier( 'ez_lock' ); // $state = eZContentObjectState::fetchByIdentifier( 'locked', $stateGroup->attribute( 'id' ) ); // $object->assignState( $state ); // unlock: // $state = eZContentObjectState::fetchByIdentifier( 'not_locked', $stateGroup->attribute( 'id' ) ); // $object->assignState( $state ); // Get namespace property storage $storage = new ezcWebdavBasicPropertyStorage(); // Attach property to store $storage->attach( $property ); // Store document back $this->storeProperties( $path, $storage ); return true; }
php
public function setProperty( $path, ezcWebdavProperty $property ) { if ( !in_array( $property->name, $this->handledLiveProperties, true ) ) { return false; } // @as @todo implement setting properties // @todo implement locking and unlocking based on the code // lock: // replace 30607 with your object ID // $object = eZContentObject::fetch( 30607 ); // $stateGroup = eZContentObjectStateGroup::fetchByIdentifier( 'ez_lock' ); // $state = eZContentObjectState::fetchByIdentifier( 'locked', $stateGroup->attribute( 'id' ) ); // $object->assignState( $state ); // unlock: // $state = eZContentObjectState::fetchByIdentifier( 'not_locked', $stateGroup->attribute( 'id' ) ); // $object->assignState( $state ); // Get namespace property storage $storage = new ezcWebdavBasicPropertyStorage(); // Attach property to store $storage->attach( $property ); // Store document back $this->storeProperties( $path, $storage ); return true; }
[ "public", "function", "setProperty", "(", "$", "path", ",", "ezcWebdavProperty", "$", "property", ")", "{", "if", "(", "!", "in_array", "(", "$", "property", "->", "name", ",", "$", "this", "->", "handledLiveProperties", ",", "true", ")", ")", "{", "retu...
Manually sets a property on a resource. Sets the given $propertyBackup for the resource identified by $path. @param string $path @param ezcWebdavProperty $property @return bool
[ "Manually", "sets", "a", "property", "on", "a", "resource", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L757-L787
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.put
public function put( ezcWebdavPutRequest $request ) { $this->acquireLock(); $return = parent::put( $request ); $this->freeLock(); return $return; }
php
public function put( ezcWebdavPutRequest $request ) { $this->acquireLock(); $return = parent::put( $request ); $this->freeLock(); return $return; }
[ "public", "function", "put", "(", "ezcWebdavPutRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", ")", ";", "$", "return", "=", "parent", "::", "put", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(", ")", ";"...
Serves PUT requests. The method receives a {@link ezcWebdavPutRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavPutResponse} on success. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavPutRequest $request @return ezcWebdavResponse
[ "Serves", "PUT", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L834-L841
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.setResourceContents
protected function setResourceContents( $path, $content ) { // Attempt to get file/resource sent from client/browser. $tempFile = $this->storeUploadedFile( $path, $content ); eZWebDAVContentBackend::appendLogEntry( 'SetResourceContents:' . $path . ';' . $tempFile ); // If there was an actual file: if ( !$tempFile ) { return false; // @as self::FAILED_FORBIDDEN; } // Attempt to do something with it (copy/whatever). $fullPath = $path; $target = $this->splitFirstPathElement( $path, $currentSite ); if ( !$currentSite ) { return false; // @as self::FAILED_FORBIDDEN; } $result = $this->putVirtualFolderData( $currentSite, $target, $tempFile ); unlink( $tempFile ); eZDir::cleanupEmptyDirectories( dirname( $tempFile ) ); return $result; }
php
protected function setResourceContents( $path, $content ) { // Attempt to get file/resource sent from client/browser. $tempFile = $this->storeUploadedFile( $path, $content ); eZWebDAVContentBackend::appendLogEntry( 'SetResourceContents:' . $path . ';' . $tempFile ); // If there was an actual file: if ( !$tempFile ) { return false; // @as self::FAILED_FORBIDDEN; } // Attempt to do something with it (copy/whatever). $fullPath = $path; $target = $this->splitFirstPathElement( $path, $currentSite ); if ( !$currentSite ) { return false; // @as self::FAILED_FORBIDDEN; } $result = $this->putVirtualFolderData( $currentSite, $target, $tempFile ); unlink( $tempFile ); eZDir::cleanupEmptyDirectories( dirname( $tempFile ) ); return $result; }
[ "protected", "function", "setResourceContents", "(", "$", "path", ",", "$", "content", ")", "{", "// Attempt to get file/resource sent from client/browser.", "$", "tempFile", "=", "$", "this", "->", "storeUploadedFile", "(", "$", "path", ",", "$", "content", ")", ...
Sets the contents of a resource. This method replaces the content of the resource identified by $path with the submitted $content. @param string $path @param string $content
[ "Sets", "the", "contents", "of", "a", "resource", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L866-L893
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.delete
public function delete( ezcWebdavDeleteRequest $request ) { $this->acquireLock(); $return = parent::delete( $request ); $this->freeLock(); return $return; }
php
public function delete( ezcWebdavDeleteRequest $request ) { $this->acquireLock(); $return = parent::delete( $request ); $this->freeLock(); return $return; }
[ "public", "function", "delete", "(", "ezcWebdavDeleteRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", ")", ";", "$", "return", "=", "parent", "::", "delete", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(", "...
Serves DELETE requests. The method receives a {@link ezcWebdavDeleteRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavDeleteResponse} on success. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavDeleteRequest $request @return ezcWebdavResponse
[ "Serves", "DELETE", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L910-L917
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.checkDeleteRecursive
public function checkDeleteRecursive( $target ) { $errors = array(); $fullPath = $target; $target = $this->splitFirstPathElement( $target, $currentSite ); if ( !$currentSite ) { // Cannot delete root folder return array( new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_403, $fullPath ), ); } if ( $target === "" ) { // Cannot delete entries in site list return array( new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_403, $fullPath ), ); } return $errors; }
php
public function checkDeleteRecursive( $target ) { $errors = array(); $fullPath = $target; $target = $this->splitFirstPathElement( $target, $currentSite ); if ( !$currentSite ) { // Cannot delete root folder return array( new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_403, $fullPath ), ); } if ( $target === "" ) { // Cannot delete entries in site list return array( new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_403, $fullPath ), ); } return $errors; }
[ "public", "function", "checkDeleteRecursive", "(", "$", "target", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "$", "fullPath", "=", "$", "target", ";", "$", "target", "=", "$", "this", "->", "splitFirstPathElement", "(", "$", "target", ",", "...
Returns if everything below a path can be deleted recursively. Checks files and directories recursively and returns if everything can be deleted. Returns an empty array if no errors occured, and an array with the files which caused errors otherwise. @param string $source @return array
[ "Returns", "if", "everything", "below", "a", "path", "can", "be", "deleted", "recursively", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L929-L959
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.performDelete
protected function performDelete( $target ) { switch ( $_SERVER['REQUEST_METHOD'] ) { case 'MOVE': // in case performDelete() was called from a MOVE operation, // do not delete anything, because the move() function in // ezcWebdavSimpleBackend first calls performDelete(), which // deletes the destination if the source and destination // are the same in URL alias terms return null; default: $errors = $this->checkDeleteRecursive( $target ); break; } // If an error will occur return the proper status. We return // multistatus in any case. if ( count( $errors ) > 0 ) { return new ezcWebdavMultistatusResponse( $errors ); } $fullPath = $target; $target = $this->splitFirstPathElement( $target, $currentSite ); $status = $this->deleteVirtualFolder( $currentSite, $target ); // @as @todo return based on $status // Return success return null; }
php
protected function performDelete( $target ) { switch ( $_SERVER['REQUEST_METHOD'] ) { case 'MOVE': // in case performDelete() was called from a MOVE operation, // do not delete anything, because the move() function in // ezcWebdavSimpleBackend first calls performDelete(), which // deletes the destination if the source and destination // are the same in URL alias terms return null; default: $errors = $this->checkDeleteRecursive( $target ); break; } // If an error will occur return the proper status. We return // multistatus in any case. if ( count( $errors ) > 0 ) { return new ezcWebdavMultistatusResponse( $errors ); } $fullPath = $target; $target = $this->splitFirstPathElement( $target, $currentSite ); $status = $this->deleteVirtualFolder( $currentSite, $target ); // @as @todo return based on $status // Return success return null; }
[ "protected", "function", "performDelete", "(", "$", "target", ")", "{", "switch", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", ")", "{", "case", "'MOVE'", ":", "// in case performDelete() was called from a MOVE operation,", "// do not delete anything, because the move...
Deletes everything below a path. Deletes the resource identified by $path recursively. Returns an instance of {@link ezcWebdavErrorResponse} if the deletion failed, and null on success. In case performDelete() was called from a MOVE operation, it does not delete anything, because the move() function in ezcWebdavSimpleBackend first calls performDelete(), which deletes the destination if the source and destination are the same in URL alias terms. @param string $path @return ezcWebdavErrorResponse
[ "Deletes", "everything", "below", "a", "path", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L976-L1010
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.copy
public function copy( ezcWebdavCopyRequest $request ) { $this->acquireLock(); $return = parent::copy( $request ); $this->freeLock(); return $return; }
php
public function copy( ezcWebdavCopyRequest $request ) { $this->acquireLock(); $return = parent::copy( $request ); $this->freeLock(); return $return; }
[ "public", "function", "copy", "(", "ezcWebdavCopyRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", ")", ";", "$", "return", "=", "parent", "::", "copy", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(", ")", ...
Serves COPY requests. The method receives a {@link ezcWebdavCopyRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavCopyResponse} on success. If only some operations failed, this method may return an instance of {@link ezcWebdavMultistatusResponse}. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavCopyRequest $request @return ezcWebdavResponse
[ "Serves", "COPY", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1028-L1035
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.performCopy
protected function performCopy( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { switch ( $_SERVER['REQUEST_METHOD'] ) { case 'MOVE': // in case performCopy() was called from a MOVE operation, // do a real move operation, because the move() function // from ezcWebdavSimpleBackend calls performCopy() and // performDelete() $errors = $this->moveRecursive( $source, $destination, $depth ); break; case 'COPY': $errors = $this->copyRecursive( $source, $destination, $depth ); break; default: $errors = $this->moveRecursive( $source, $destination, $depth ); break; } // Transform errors foreach ( $errors as $nr => $error ) { $errors[$nr] = new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_423, $error ); } // Copy dead properties $storage = $this->getPropertyStorage( $source ); $this->storeProperties( $destination, $storage ); // Updateable live properties are updated automagically, because they // are regenerated on request on base of the file they affect. So there // is no reason to keep them "alive". return $errors; }
php
protected function performCopy( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { switch ( $_SERVER['REQUEST_METHOD'] ) { case 'MOVE': // in case performCopy() was called from a MOVE operation, // do a real move operation, because the move() function // from ezcWebdavSimpleBackend calls performCopy() and // performDelete() $errors = $this->moveRecursive( $source, $destination, $depth ); break; case 'COPY': $errors = $this->copyRecursive( $source, $destination, $depth ); break; default: $errors = $this->moveRecursive( $source, $destination, $depth ); break; } // Transform errors foreach ( $errors as $nr => $error ) { $errors[$nr] = new ezcWebdavErrorResponse( ezcWebdavResponse::STATUS_423, $error ); } // Copy dead properties $storage = $this->getPropertyStorage( $source ); $this->storeProperties( $destination, $storage ); // Updateable live properties are updated automagically, because they // are regenerated on request on base of the file they affect. So there // is no reason to keep them "alive". return $errors; }
[ "protected", "function", "performCopy", "(", "$", "source", ",", "$", "destination", ",", "$", "depth", "=", "ezcWebdavRequest", "::", "DEPTH_INFINITY", ")", "{", "switch", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", ")", "{", "case", "'MOVE'", ":", ...
Copies resources recursively from one path to another. Copies the resourced identified by $fromPath recursively to $toPath with the given $depth, where $depth is one of {@link ezcWebdavRequest::DEPTH_ZERO}, {@link ezcWebdavRequest::DEPTH_ONE}, {@link ezcWebdavRequest::DEPTH_INFINITY}. Returns an array with {@link ezcWebdavErrorResponse}s for all subtrees, where the copy operation failed. Errors for subsequent resources in a subtree should be ommitted. If an empty array is return, the operation has been completed successfully. In case performCopy() was called from a MOVE operation, do a real move operation, because the move() function from ezcWebdavSimpleBackend calls performCopy() and performDelete(). @param string $fromPath @param string $toPath @param int $depth @return array(ezcWebdavErrorResponse)
[ "Copies", "resources", "recursively", "from", "one", "path", "to", "another", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1061-L1100
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.moveRecursive
public function moveRecursive( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { $errors = array(); $fullSource = $source; $fullDestination = $destination; $source = $this->splitFirstPathElement( $source, $sourceSite ); $destination = $this->splitFirstPathElement( $destination, $destinationSite ); if ( $sourceSite !== $destinationSite ) { // We do not support copying from one site to another yet // TODO: Check if the sites are using the same db, // if so allow the copy as a simple object copy // If not we will have to do an object export from // $sourceSite and import it in $destinationSite return array(); // @as self::FAILED_FORBIDDEN; } if ( !$sourceSite or !$destinationSite ) { // Cannot copy entries in site list return array( $fullSource ); // @as self::FAILED_FORBIDDEN; } $this->moveVirtualFolder( $sourceSite, $destinationSite, $source, $destination, $fullSource, $fullDestination ); if ( $depth === ezcWebdavRequest::DEPTH_ZERO || !$this->isCollection( $fullSource ) ) { // Do not recurse (any more) return array(); } // Recurse $nodes = $this->getCollectionMembers( $fullSource ); foreach ( $nodes as $node ) { if ( $node->path === $fullSource . '/' ) { // skip the current node which was copied with copyVirtualFolder() above continue; } $newDepth = ( $depth !== ezcWebdavRequest::DEPTH_ONE ) ? $depth : ezcWebdavRequest::DEPTH_ZERO; $errors = array_merge( $errors, $this->moveRecursive( $node->path, $fullDestination . '/' . $this->getProperty( $node->path, 'displayname' )->displayName, $newDepth ) ); } return $errors; }
php
public function moveRecursive( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY ) { $errors = array(); $fullSource = $source; $fullDestination = $destination; $source = $this->splitFirstPathElement( $source, $sourceSite ); $destination = $this->splitFirstPathElement( $destination, $destinationSite ); if ( $sourceSite !== $destinationSite ) { // We do not support copying from one site to another yet // TODO: Check if the sites are using the same db, // if so allow the copy as a simple object copy // If not we will have to do an object export from // $sourceSite and import it in $destinationSite return array(); // @as self::FAILED_FORBIDDEN; } if ( !$sourceSite or !$destinationSite ) { // Cannot copy entries in site list return array( $fullSource ); // @as self::FAILED_FORBIDDEN; } $this->moveVirtualFolder( $sourceSite, $destinationSite, $source, $destination, $fullSource, $fullDestination ); if ( $depth === ezcWebdavRequest::DEPTH_ZERO || !$this->isCollection( $fullSource ) ) { // Do not recurse (any more) return array(); } // Recurse $nodes = $this->getCollectionMembers( $fullSource ); foreach ( $nodes as $node ) { if ( $node->path === $fullSource . '/' ) { // skip the current node which was copied with copyVirtualFolder() above continue; } $newDepth = ( $depth !== ezcWebdavRequest::DEPTH_ONE ) ? $depth : ezcWebdavRequest::DEPTH_ZERO; $errors = array_merge( $errors, $this->moveRecursive( $node->path, $fullDestination . '/' . $this->getProperty( $node->path, 'displayname' )->displayName, $newDepth ) ); } return $errors; }
[ "public", "function", "moveRecursive", "(", "$", "source", ",", "$", "destination", ",", "$", "depth", "=", "ezcWebdavRequest", "::", "DEPTH_INFINITY", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "$", "fullSource", "=", "$", "source", ";", "$",...
Recursively move a file or directory. Recursively move a file or directory in $source to the given $destination. If a $depth is given, the operation will stop as soon as the given recursion depth is reached. A depth of -1 means no limit, while a depth of 0 means, that only the current file or directory will be copied, without any recursion. Returns an empty array if no errors occured, and an array with the files which caused errors otherwise. @param string $source @param string $destination @param int $depth @return array
[ "Recursively", "move", "a", "file", "or", "directory", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1191-L1245
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.move
public function move( ezcWebdavMoveRequest $request ) { $this->acquireLock(); $return = parent::move( $request ); $this->freeLock(); return $return; }
php
public function move( ezcWebdavMoveRequest $request ) { $this->acquireLock(); $return = parent::move( $request ); $this->freeLock(); return $return; }
[ "public", "function", "move", "(", "ezcWebdavMoveRequest", "$", "request", ")", "{", "$", "this", "->", "acquireLock", "(", ")", ";", "$", "return", "=", "parent", "::", "move", "(", "$", "request", ")", ";", "$", "this", "->", "freeLock", "(", ")", ...
Serves MOVE requests. The method receives a {@link ezcWebdavMoveRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavMoveResponse} on success. If only some operations failed, this method may return an instance of {@link ezcWebdavMultistatusResponse}. This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards. @param ezcWebdavMoveRequest $request @return ezcWebdavResponse
[ "Serves", "MOVE", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1263-L1270
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.options
public function options( ezcWebdavOptionsRequest $request ) { $response = new ezcWebdavOptionsResponse( '1' ); // Always allowed $allowed = 'GET, HEAD, PROPFIND, PROPPATCH, OPTIONS, '; // Check if modifications are allowed if ( $this instanceof ezcWebdavBackendChange ) { $allowed .= 'DELETE, COPY, MOVE, '; } // Check if MKCOL is allowed if ( $this instanceof ezcWebdavBackendMakeCollection ) { $allowed .= 'MKCOL, '; } // Check if PUT is allowed if ( $this instanceof ezcWebdavBackendPut ) { $allowed .= 'PUT, '; } // Check if LOCK and UNLOCK are allowed if ( $this instanceof ezcWebdavLockBackend ) { $allowed .= 'LOCK, UNLOCK, '; } $response->setHeader( 'Allow', substr( $allowed, 0, -2 ) ); return $response; }
php
public function options( ezcWebdavOptionsRequest $request ) { $response = new ezcWebdavOptionsResponse( '1' ); // Always allowed $allowed = 'GET, HEAD, PROPFIND, PROPPATCH, OPTIONS, '; // Check if modifications are allowed if ( $this instanceof ezcWebdavBackendChange ) { $allowed .= 'DELETE, COPY, MOVE, '; } // Check if MKCOL is allowed if ( $this instanceof ezcWebdavBackendMakeCollection ) { $allowed .= 'MKCOL, '; } // Check if PUT is allowed if ( $this instanceof ezcWebdavBackendPut ) { $allowed .= 'PUT, '; } // Check if LOCK and UNLOCK are allowed if ( $this instanceof ezcWebdavLockBackend ) { $allowed .= 'LOCK, UNLOCK, '; } $response->setHeader( 'Allow', substr( $allowed, 0, -2 ) ); return $response; }
[ "public", "function", "options", "(", "ezcWebdavOptionsRequest", "$", "request", ")", "{", "$", "response", "=", "new", "ezcWebdavOptionsResponse", "(", "'1'", ")", ";", "// Always allowed", "$", "allowed", "=", "'GET, HEAD, PROPFIND, PROPPATCH, OPTIONS, '", ";", "// ...
Required method to serve OPTIONS requests. The method receives a {@link ezcWebdavOptionsRequest} object containing all relevant information obout the clients request and should either return an error by returning an {@link ezcWebdavErrorResponse} object, or any other {@link ezcWebdavResponse} objects. @param ezcWebdavOptionsRequest $request @return ezcWebdavResponse
[ "Required", "method", "to", "serve", "OPTIONS", "requests", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1308-L1342
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.setCurrentSite
public function setCurrentSite( $site ) { eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . '1:' . $site ); $access = array( 'name' => $site, 'type' => eZSiteAccess::TYPE_STATIC ); $access = eZSiteAccess::change( $access ); eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . '2:' . $site ); eZDebugSetting::writeDebug( 'kernel-siteaccess', $access, 'current siteaccess' ); // Clear/flush global database instance. $nullVar = null; eZDB::setInstance( $nullVar ); }
php
public function setCurrentSite( $site ) { eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . '1:' . $site ); $access = array( 'name' => $site, 'type' => eZSiteAccess::TYPE_STATIC ); $access = eZSiteAccess::change( $access ); eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . '2:' . $site ); eZDebugSetting::writeDebug( 'kernel-siteaccess', $access, 'current siteaccess' ); // Clear/flush global database instance. $nullVar = null; eZDB::setInstance( $nullVar ); }
[ "public", "function", "setCurrentSite", "(", "$", "site", ")", "{", "eZWebDAVContentBackend", "::", "appendLogEntry", "(", "__FUNCTION__", ".", "'1:'", ".", "$", "site", ")", ";", "$", "access", "=", "array", "(", "'name'", "=>", "$", "site", ",", "'type'"...
Sets the current site. From eZ Publish. @param string $site Eg. 'plain_site_user' @todo remove or move in another class?
[ "Sets", "the", "current", "site", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1356-L1370
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getVirtualFolderData
protected function getVirtualFolderData( $result, $currentSite, $target, $fullPath ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !$target ) { // The rest in the virtual folder does not have any data return false; // self::FAILED_NOT_FOUND; } if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // self::FAILED_NOT_FOUND; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->getContentNodeData( $result, $currentSite, $virtualFolder, $target, $fullPath ); } return false; // self::FAILED_NOT_FOUND; }
php
protected function getVirtualFolderData( $result, $currentSite, $target, $fullPath ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !$target ) { // The rest in the virtual folder does not have any data return false; // self::FAILED_NOT_FOUND; } if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // self::FAILED_NOT_FOUND; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->getContentNodeData( $result, $currentSite, $virtualFolder, $target, $fullPath ); } return false; // self::FAILED_NOT_FOUND; }
[ "protected", "function", "getVirtualFolderData", "(", "$", "result", ",", "$", "currentSite", ",", "$", "target", ",", "$", "fullPath", ")", "{", "$", "target", "=", "$", "this", "->", "splitFirstPathElement", "(", "$", "target", ",", "$", "virtualFolder", ...
Handles data retrival on the virtual folder level. The format of the returned array is the same as $result: <code> array( 'isFile' => bool, 'isCollection' => bool, 'file' => path to the storage file which contain the contents ); </code> @param array(string=>mixed) $result @param string $currentSite Eg. 'plain_site_user' @param string $target Eg. 'Content/Folder1/file1.txt' @param string $fullPath Eg. '/plain_site_user/Content/Folder1/file1.txt' @return array(string=>mixed) Or false if an error appeared
[ "Handles", "data", "retrival", "on", "the", "virtual", "folder", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1609-L1629
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getContentNodeData
protected function getContentNodeData( $result, $currentSite, $virtualFolder, $target, $fullPath ) { // Attempt to fetch the node the client wants to get. $nodePath = $this->internalNodePath( $virtualFolder, $target ); eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . " Path:" . $nodePath ); $node = $this->fetchNodeByTranslation( $nodePath ); $info = $this->fetchNodeInfo( $fullPath, $node ); // Proceed only if the node is valid: if ( $node === null ) { return $result; } // Can we fetch the contents of the node if ( !$node->canRead() ) { return false; // @as self::FAILED_FORBIDDEN; } $object = $node->attribute( 'object' ); foreach ( $info as $key => $value ) { $result[$key] = $value; } $upload = new eZContentUpload(); $info = $upload->objectFileInfo( $object ); if ( $info ) { $result['file'] = $info['filepath']; } else { $class = $object->contentClass(); if ( $this->isObjectFolder( $object, $class ) ) { $result['isCollection'] = true; } } return $result; }
php
protected function getContentNodeData( $result, $currentSite, $virtualFolder, $target, $fullPath ) { // Attempt to fetch the node the client wants to get. $nodePath = $this->internalNodePath( $virtualFolder, $target ); eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . " Path:" . $nodePath ); $node = $this->fetchNodeByTranslation( $nodePath ); $info = $this->fetchNodeInfo( $fullPath, $node ); // Proceed only if the node is valid: if ( $node === null ) { return $result; } // Can we fetch the contents of the node if ( !$node->canRead() ) { return false; // @as self::FAILED_FORBIDDEN; } $object = $node->attribute( 'object' ); foreach ( $info as $key => $value ) { $result[$key] = $value; } $upload = new eZContentUpload(); $info = $upload->objectFileInfo( $object ); if ( $info ) { $result['file'] = $info['filepath']; } else { $class = $object->contentClass(); if ( $this->isObjectFolder( $object, $class ) ) { $result['isCollection'] = true; } } return $result; }
[ "protected", "function", "getContentNodeData", "(", "$", "result", ",", "$", "currentSite", ",", "$", "virtualFolder", ",", "$", "target", ",", "$", "fullPath", ")", "{", "// Attempt to fetch the node the client wants to get.", "$", "nodePath", "=", "$", "this", "...
Handles data retrival on the content tree level. The format of the returned array is the same as $result: <code> array( 'isFile' => bool, 'isCollection' => bool, 'file' => path to the storage file which contain the contents ); </code> @param array(string=>mixed) $result @param string $currentSite Eg. 'plain_site_user' @param string $virtualFolder Eg. 'Content' @param string $target Eg. 'Folder1/file1.txt' @param string $fullPath Eg. '/plain_site_user/Content/Folder1/file1.txt' @return array(string=>mixed) Or false if an error appeared @todo remove/replace eZContentUpload
[ "Handles", "data", "retrival", "on", "the", "content", "tree", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1649-L1693
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getCollectionContent
protected function getCollectionContent( $collection, $depth = false, $properties = false ) { $fullPath = $collection; $collection = $this->splitFirstPathElement( $collection, $currentSite ); if ( !$currentSite ) { // Display the root which contains a list of sites $entries = $this->fetchSiteListContent( $fullPath, $depth, $properties ); return $entries; } return $this->getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ); }
php
protected function getCollectionContent( $collection, $depth = false, $properties = false ) { $fullPath = $collection; $collection = $this->splitFirstPathElement( $collection, $currentSite ); if ( !$currentSite ) { // Display the root which contains a list of sites $entries = $this->fetchSiteListContent( $fullPath, $depth, $properties ); return $entries; } return $this->getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ); }
[ "protected", "function", "getCollectionContent", "(", "$", "collection", ",", "$", "depth", "=", "false", ",", "$", "properties", "=", "false", ")", "{", "$", "fullPath", "=", "$", "collection", ";", "$", "collection", "=", "$", "this", "->", "splitFirstPa...
Produces the collection content. Builds either the virtual start folder with the virtual content folder in it (and additional files). OR: if we're browsing within the content folder: it gets the content of the target/given folder. @param string $collection Eg. '/plain_site_user/Content/Folder1' @param int $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(string=>array())
[ "Produces", "the", "collection", "content", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1707-L1720
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.fetchVirtualSiteContent
protected function fetchVirtualSiteContent( $target, $site, $depth, $properties ) { $requestUri = $target; // Always add the current collection $contentEntry = array(); $scriptURL = $requestUri; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $contentEntry["name"] = $scriptURL; $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'settings/siteaccess/' . $site ); $contentEntry["mtime"] = filemtime( 'settings/siteaccess/' . $site ); $contentEntry["href"] = $requestUri; $entries[] = $contentEntry; $defctime = $contentEntry['ctime']; $defmtime = $contentEntry['mtime']; if ( $depth > 0 ) { $scriptURL = $requestUri; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } // Set up attributes for the virtual content folder: foreach ( array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) as $name ) { $entry = array(); $entry["name"] = $name; $entry["size"] = 0; $entry["mimetype"] = self::DIRECTORY_MIMETYPE; $entry["ctime"] = $defctime; $entry["mtime"] = $defmtime; $entry["href"] = $scriptURL . $name; $entries[] = $entry; } } return $entries; }
php
protected function fetchVirtualSiteContent( $target, $site, $depth, $properties ) { $requestUri = $target; // Always add the current collection $contentEntry = array(); $scriptURL = $requestUri; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $contentEntry["name"] = $scriptURL; $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'settings/siteaccess/' . $site ); $contentEntry["mtime"] = filemtime( 'settings/siteaccess/' . $site ); $contentEntry["href"] = $requestUri; $entries[] = $contentEntry; $defctime = $contentEntry['ctime']; $defmtime = $contentEntry['mtime']; if ( $depth > 0 ) { $scriptURL = $requestUri; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } // Set up attributes for the virtual content folder: foreach ( array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) as $name ) { $entry = array(); $entry["name"] = $name; $entry["size"] = 0; $entry["mimetype"] = self::DIRECTORY_MIMETYPE; $entry["ctime"] = $defctime; $entry["mtime"] = $defmtime; $entry["href"] = $scriptURL . $name; $entries[] = $entry; } } return $entries; }
[ "protected", "function", "fetchVirtualSiteContent", "(", "$", "target", ",", "$", "site", ",", "$", "depth", ",", "$", "properties", ")", "{", "$", "requestUri", "=", "$", "target", ";", "// Always add the current collection", "$", "contentEntry", "=", "array", ...
Builds and returns the content of the virtual start folder for a site. The virtual startfolder is an intermediate step between the site-list and actual content. This directory contains the "content" folder which leads to the site's actual content. An entry in the the returned array is of this form: <code> array( 'name' => node name (eg. 'Group picture'), 'size' => storage size of the_node in bytes (eg. 57123), 'mimetype' => mime type of the node (eg. 'image/jpeg'), 'ctime' => creation time as timestamp, 'mtime' => latest modification time as timestamp, 'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg') </code> @param string $target Eg. '/plain_site_user/Content/Folder1' @param string $site Eg. 'plain_site_user @param string $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(array(string=>mixed))
[ "Builds", "and", "returns", "the", "content", "of", "the", "virtual", "start", "folder", "for", "a", "site", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1779-L1825
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getVirtualFolderCollection
protected function getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ) { if ( !$collection ) { // We are inside a site so we display the virtual folder for the site $entries = $this->fetchVirtualSiteContent( $fullPath, $currentSite, $depth, $properties ); return $entries; } $collection = $this->splitFirstPathElement( $collection, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // self::FAILED_NOT_FOUND; } // added by @ds 2008-12-07 to fix problems with IE6 SP2 $ini = eZINI::instance(); $prefixAdded = false; $prefix = $ini->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) && $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) != '' ? eZURLAliasML::cleanURL( $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) ) : false; if ( $prefix ) { $escapedPrefix = preg_quote( $prefix, '#' ); // Only prepend the path prefix if it's not already the first element of the url. if ( !preg_match( "#^$escapedPrefix(/.*)?$#i", $collection ) ) { $exclude = $ini->hasVariable( 'SiteAccessSettings', 'PathPrefixExclude' ) ? $ini->variable( 'SiteAccessSettings', 'PathPrefixExclude' ) : false; $breakInternalURI = false; foreach ( $exclude as $item ) { $escapedItem = preg_quote( $item, '#' ); if ( preg_match( "#^$escapedItem(/.*)?$#i", $collection ) ) { $breakInternalURI = true; break; } } if ( !$breakInternalURI ) { $collection = $prefix . '/' . $collection; $prefixAdded = true; } } } return $this->getContentTreeCollection( $currentSite, $virtualFolder, $collection, $fullPath, $depth, $properties ); }
php
protected function getVirtualFolderCollection( $currentSite, $collection, $fullPath, $depth, $properties ) { if ( !$collection ) { // We are inside a site so we display the virtual folder for the site $entries = $this->fetchVirtualSiteContent( $fullPath, $currentSite, $depth, $properties ); return $entries; } $collection = $this->splitFirstPathElement( $collection, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // self::FAILED_NOT_FOUND; } // added by @ds 2008-12-07 to fix problems with IE6 SP2 $ini = eZINI::instance(); $prefixAdded = false; $prefix = $ini->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) && $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) != '' ? eZURLAliasML::cleanURL( $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) ) : false; if ( $prefix ) { $escapedPrefix = preg_quote( $prefix, '#' ); // Only prepend the path prefix if it's not already the first element of the url. if ( !preg_match( "#^$escapedPrefix(/.*)?$#i", $collection ) ) { $exclude = $ini->hasVariable( 'SiteAccessSettings', 'PathPrefixExclude' ) ? $ini->variable( 'SiteAccessSettings', 'PathPrefixExclude' ) : false; $breakInternalURI = false; foreach ( $exclude as $item ) { $escapedItem = preg_quote( $item, '#' ); if ( preg_match( "#^$escapedItem(/.*)?$#i", $collection ) ) { $breakInternalURI = true; break; } } if ( !$breakInternalURI ) { $collection = $prefix . '/' . $collection; $prefixAdded = true; } } } return $this->getContentTreeCollection( $currentSite, $virtualFolder, $collection, $fullPath, $depth, $properties ); }
[ "protected", "function", "getVirtualFolderCollection", "(", "$", "currentSite", ",", "$", "collection", ",", "$", "fullPath", ",", "$", "depth", ",", "$", "properties", ")", "{", "if", "(", "!", "$", "collection", ")", "{", "// We are inside a site so we display...
Handles collections on the virtual folder level, if no virtual folder elements are accessed it lists the virtual folders. An entry in the the returned array is of this form: <code> array( 'name' => node name (eg. 'Group picture'), 'size' => storage size of the_node in bytes (eg. 57123), 'mimetype' => mime type of the node (eg. 'image/jpeg'), 'ctime' => creation time as timestamp, 'mtime' => latest modification time as timestamp, 'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg') </code> @param string $site Eg. 'plain_site_user @param string $collection Eg. 'Folder1' @param string $fullPath Eg. '/plain_site_user/Content/Folder1' @param string $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(array(string=>mixed))
[ "Handles", "collections", "on", "the", "virtual", "folder", "level", "if", "no", "virtual", "folder", "elements", "are", "accessed", "it", "lists", "the", "virtual", "folders", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1848-L1899
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.getContentTreeCollection
protected function getContentTreeCollection( $currentSite, $virtualFolder, $collection, $fullPath, $depth, $properties ) { $nodePath = $this->internalNodePath( $virtualFolder, $collection ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( !$node ) { return false; // self::FAILED_NOT_FOUND; } // Can we list the children of the node? if ( !$node->canRead() ) { return false; // self::FAILED_FORBIDDEN; } $entries = $this->fetchContentList( $fullPath, $node, $nodePath, $depth, $properties ); return $entries; }
php
protected function getContentTreeCollection( $currentSite, $virtualFolder, $collection, $fullPath, $depth, $properties ) { $nodePath = $this->internalNodePath( $virtualFolder, $collection ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( !$node ) { return false; // self::FAILED_NOT_FOUND; } // Can we list the children of the node? if ( !$node->canRead() ) { return false; // self::FAILED_FORBIDDEN; } $entries = $this->fetchContentList( $fullPath, $node, $nodePath, $depth, $properties ); return $entries; }
[ "protected", "function", "getContentTreeCollection", "(", "$", "currentSite", ",", "$", "virtualFolder", ",", "$", "collection", ",", "$", "fullPath", ",", "$", "depth", ",", "$", "properties", ")", "{", "$", "nodePath", "=", "$", "this", "->", "internalNode...
Handles collections on the content tree level. Depending on the virtual folder we will generate a node path url and fetch the nodes for that path. An entry in the the returned array is of this form: <code> array( 'name' => node name (eg. 'Folder1'), 'size' => storage size of the_node in bytes (eg. 4096 for collections), 'mimetype' => mime type of the node (eg. 'httpd/unix-directory'), 'ctime' => creation time as timestamp, 'mtime' => latest modification time as timestamp, 'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/') </code> @param string $site Eg. 'plain_site_user @param string $virtualFolder Eg. 'Content' @param string $collection Eg. 'Folder1' @param string $fullPath Eg. '/plain_site_user/Content/Folder1/' @param string $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(array(string=>mixed))
[ "Handles", "collections", "on", "the", "content", "tree", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1925-L1943
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.fetchContentList
protected function fetchContentList( $fullPath, &$node, $target, $depth, $properties ) { // We'll return an array of entries (which is an array of attributes). $entries = array(); if ( $depth === ezcWebdavRequest::DEPTH_ONE || $depth === ezcWebdavRequest::DEPTH_INFINITY ) // @as added || $depth === ezcWebdavRequest::DEPTH_INFINITY { // Get all the children of the target node. $subTree = $node->subTree( array ( 'Depth' => 1 ) ); // Build the entries array by going through all the // nodes in the subtree and getting their attributes: foreach ( $subTree as $someNode ) { $entries[] = $this->fetchNodeInfo( $fullPath, $someNode ); } } // Always include the information about the current level node $thisNodeInfo = $this->fetchNodeInfo( $fullPath, $node ); $scriptURL = $fullPath; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $thisNodeInfo["href"] = $scriptURL; $entries[] = $thisNodeInfo; // Return the content of the target. return $entries; }
php
protected function fetchContentList( $fullPath, &$node, $target, $depth, $properties ) { // We'll return an array of entries (which is an array of attributes). $entries = array(); if ( $depth === ezcWebdavRequest::DEPTH_ONE || $depth === ezcWebdavRequest::DEPTH_INFINITY ) // @as added || $depth === ezcWebdavRequest::DEPTH_INFINITY { // Get all the children of the target node. $subTree = $node->subTree( array ( 'Depth' => 1 ) ); // Build the entries array by going through all the // nodes in the subtree and getting their attributes: foreach ( $subTree as $someNode ) { $entries[] = $this->fetchNodeInfo( $fullPath, $someNode ); } } // Always include the information about the current level node $thisNodeInfo = $this->fetchNodeInfo( $fullPath, $node ); $scriptURL = $fullPath; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $thisNodeInfo["href"] = $scriptURL; $entries[] = $thisNodeInfo; // Return the content of the target. return $entries; }
[ "protected", "function", "fetchContentList", "(", "$", "fullPath", ",", "&", "$", "node", ",", "$", "target", ",", "$", "depth", ",", "$", "properties", ")", "{", "// We'll return an array of entries (which is an array of attributes).", "$", "entries", "=", "array",...
Gets and returns the content of an actual node. List of other nodes belonging to the target node (one level below it) will be returned as well. An entry in the the returned array is of this form: <code> array( 'name' => node name (eg. 'Content'), 'size' => storage size of the_node in bytes (eg. 4096 for collections), 'mimetype' => mime type of the node (eg. 'httpd/unix-directory'), 'ctime' => creation time as timestamp, 'mtime' => latest modification time as timestamp, 'href' => the path to the node (eg. '/plain_site_user/Content/') </code> @param string $fullPath Eg. '/plain_site_user/Content/' @param eZContentObject &$node The note corresponding to $fullPath @param string $target Eg. 'Content' @param string $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(array(string=>mixed))
[ "Gets", "and", "returns", "the", "content", "of", "an", "actual", "node", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L1968-L2001
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.fetchSiteListContent
protected function fetchSiteListContent( $target, $depth, $properties ) { // At the end: we'll return an array of entry-arrays. $entries = array(); // An entry consists of several attributes (name, size, etc). $contentEntry = array(); $entries = array(); // add a slash at the end of the path, if it is missing $scriptURL = $target; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $thisNodeInfo["href"] = $scriptURL; // Set up attributes for the virtual site-list folder: $contentEntry["name"] = '/'; $contentEntry["href"] = $scriptURL; $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'var' ); $contentEntry["mtime"] = filemtime( 'var' ); $entries[] = $contentEntry; if ( $depth > 0 ) { // For all available sites: foreach ( $this->availableSites as $site ) { // Set up attributes for the virtual site-list folder: $contentEntry["name"] = $scriptURL . $site . '/'; // @as added '/' $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'settings/siteaccess/' . $site ); $contentEntry["mtime"] = filemtime( 'settings/siteaccess/' . $site ); if ( $target === '/' ) { $contentEntry["href"] = $contentEntry["name"]; } else { $contentEntry["href"] = $scriptURL . $contentEntry["name"]; } $entries[] = $contentEntry; } } return $entries; }
php
protected function fetchSiteListContent( $target, $depth, $properties ) { // At the end: we'll return an array of entry-arrays. $entries = array(); // An entry consists of several attributes (name, size, etc). $contentEntry = array(); $entries = array(); // add a slash at the end of the path, if it is missing $scriptURL = $target; if ( $scriptURL{strlen( $scriptURL ) - 1} !== '/' ) { $scriptURL .= "/"; } $thisNodeInfo["href"] = $scriptURL; // Set up attributes for the virtual site-list folder: $contentEntry["name"] = '/'; $contentEntry["href"] = $scriptURL; $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'var' ); $contentEntry["mtime"] = filemtime( 'var' ); $entries[] = $contentEntry; if ( $depth > 0 ) { // For all available sites: foreach ( $this->availableSites as $site ) { // Set up attributes for the virtual site-list folder: $contentEntry["name"] = $scriptURL . $site . '/'; // @as added '/' $contentEntry["size"] = 0; $contentEntry["mimetype"] = self::DIRECTORY_MIMETYPE; $contentEntry["ctime"] = filectime( 'settings/siteaccess/' . $site ); $contentEntry["mtime"] = filemtime( 'settings/siteaccess/' . $site ); if ( $target === '/' ) { $contentEntry["href"] = $contentEntry["name"]; } else { $contentEntry["href"] = $scriptURL . $contentEntry["name"]; } $entries[] = $contentEntry; } } return $entries; }
[ "protected", "function", "fetchSiteListContent", "(", "$", "target", ",", "$", "depth", ",", "$", "properties", ")", "{", "// At the end: we'll return an array of entry-arrays.", "$", "entries", "=", "array", "(", ")", ";", "// An entry consists of several attributes (nam...
Builds a content-list of available sites and returns it. An entry in the the returned array is of this form: <code> array( 'name' => node name (eg. 'plain_site_user'), 'size' => storage size of the_node in bytes (eg. 4096 for collections), 'mimetype' => mime type of the node (eg. 'httpd/unix-directory'), 'ctime' => creation time as timestamp, 'mtime' => latest modification time as timestamp, 'href' => the path to the node (eg. '/plain_site_user/') </code> @param string $target Eg. '/' @param string $depth One of -1 (infinite), 0, 1 @param array(string) $properties Currently not used @return array(array(string=>mixed))
[ "Builds", "a", "content", "-", "list", "of", "available", "sites", "and", "returns", "it", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2021-L2075
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.mkcolVirtualFolder
protected function mkcolVirtualFolder( $currentSite, $target ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$target ) { // We have reached the end of the path // We do not allow 'mkcol' operations for the virtual folder. return false; // @as self::FAILED_FORBIDDEN; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->mkcolContent( $currentSite, $virtualFolder, $target ); } return false; // @as self::FAILED_FORBIDDEN; }
php
protected function mkcolVirtualFolder( $currentSite, $target ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$target ) { // We have reached the end of the path // We do not allow 'mkcol' operations for the virtual folder. return false; // @as self::FAILED_FORBIDDEN; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->mkcolContent( $currentSite, $virtualFolder, $target ); } return false; // @as self::FAILED_FORBIDDEN; }
[ "protected", "function", "mkcolVirtualFolder", "(", "$", "currentSite", ",", "$", "target", ")", "{", "$", "target", "=", "$", "this", "->", "splitFirstPathElement", "(", "$", "target", ",", "$", "virtualFolder", ")", ";", "if", "(", "!", "in_array", "(", ...
Handles collection creation on the virtual folder level. It will check if the target is below a content folder in which it calls mkcolContent(). @param string $currentSite Eg. 'plain_site_user' @param string $target Eg. 'Content/Folder1' @return bool
[ "Handles", "collection", "creation", "on", "the", "virtual", "folder", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2218-L2241
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.mkcolContent
protected function mkcolContent( $currentSite, $virtualFolder, $target ) { $nodePath = $this->internalNodePath( $virtualFolder, $target ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( $node ) { return false; // @as self::FAILED_EXISTS; } $parentNode = $this->fetchParentNodeByTranslation( $nodePath ); if ( !$parentNode ) { return false; // @as self::FAILED_NOT_FOUND; } // Can we create a collection in the parent node if ( !$parentNode->canRead() ) { return false; // @as self::FAILED_FORBIDDEN; } return $this->createFolder( $parentNode, $nodePath ); }
php
protected function mkcolContent( $currentSite, $virtualFolder, $target ) { $nodePath = $this->internalNodePath( $virtualFolder, $target ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( $node ) { return false; // @as self::FAILED_EXISTS; } $parentNode = $this->fetchParentNodeByTranslation( $nodePath ); if ( !$parentNode ) { return false; // @as self::FAILED_NOT_FOUND; } // Can we create a collection in the parent node if ( !$parentNode->canRead() ) { return false; // @as self::FAILED_FORBIDDEN; } return $this->createFolder( $parentNode, $nodePath ); }
[ "protected", "function", "mkcolContent", "(", "$", "currentSite", ",", "$", "virtualFolder", ",", "$", "target", ")", "{", "$", "nodePath", "=", "$", "this", "->", "internalNodePath", "(", "$", "virtualFolder", ",", "$", "target", ")", ";", "$", "node", ...
Handles collection creation on the content tree level. It will try to find the parent node of the wanted placement and create a new collection (folder etc.) as a child. @param string $currentSite Eg. 'plain_site_user' @param string $virtualFolder Eg. 'Content' @param string $target Eg. 'Folder1' @return bool
[ "Handles", "collection", "creation", "on", "the", "content", "tree", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2254-L2277
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.deleteVirtualFolder
protected function deleteVirtualFolder( $currentSite, $target ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$target ) { // We have reached the end of the path // We do not allow 'delete' operations for the virtual folder. return false; // @as self::FAILED_FORBIDDEN; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->deleteContent( $currentSite, $virtualFolder, $target ); } return false; // @as self::FAILED_FORBIDDEN; }
php
protected function deleteVirtualFolder( $currentSite, $target ) { $target = $this->splitFirstPathElement( $target, $virtualFolder ); if ( !in_array( $virtualFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$target ) { // We have reached the end of the path // We do not allow 'delete' operations for the virtual folder. return false; // @as self::FAILED_FORBIDDEN; } if ( $virtualFolder === self::virtualContentFolderName() or $virtualFolder === self::virtualMediaFolderName() ) { return $this->deleteContent( $currentSite, $virtualFolder, $target ); } return false; // @as self::FAILED_FORBIDDEN; }
[ "protected", "function", "deleteVirtualFolder", "(", "$", "currentSite", ",", "$", "target", ")", "{", "$", "target", "=", "$", "this", "->", "splitFirstPathElement", "(", "$", "target", ",", "$", "virtualFolder", ")", ";", "if", "(", "!", "in_array", "(",...
Handles deletion on the virtual folder level. It will check if the target is below a content folder in which it calls deleteContent(). @param string $currentSite Eg. 'plain_site_user' @param string $target Eg. 'Content/Folder1/file1.txt' @return bool
[ "Handles", "deletion", "on", "the", "virtual", "folder", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2330-L2353
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.deleteContent
protected function deleteContent( $currentSite, $virtualFolder, $target ) { $nodePath = $this->internalNodePath( $virtualFolder, $target ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( $node === null ) { return false; // @as self::FAILED_NOT_FOUND; } // Can we delete the node? if ( !$node->canRead() or !$node->canRemove() ) { return false; // @as self::FAILED_FORBIDDEN; } // added by @as: use the content.ini setting for handling delete: 'delete' or 'trash' // default is 'trash' $contentINI = eZINI::instance( 'content.ini' ); $removeAction = $contentINI->hasVariable( 'RemoveSettings', 'DefaultRemoveAction' ) ? $contentINI->variable( 'RemoveSettings', 'DefaultRemoveAction' ) : 'trash'; if ( $removeAction !== 'trash' && $removeAction !== 'delete' ) { // default remove action is to trash $removeAction = 'trash'; } $moveToTrash = ( $removeAction === 'trash' ) ? true : false; $node->removeNodeFromTree( $moveToTrash ); return true; // @as self::OK; }
php
protected function deleteContent( $currentSite, $virtualFolder, $target ) { $nodePath = $this->internalNodePath( $virtualFolder, $target ); $node = $this->fetchNodeByTranslation( $nodePath ); if ( $node === null ) { return false; // @as self::FAILED_NOT_FOUND; } // Can we delete the node? if ( !$node->canRead() or !$node->canRemove() ) { return false; // @as self::FAILED_FORBIDDEN; } // added by @as: use the content.ini setting for handling delete: 'delete' or 'trash' // default is 'trash' $contentINI = eZINI::instance( 'content.ini' ); $removeAction = $contentINI->hasVariable( 'RemoveSettings', 'DefaultRemoveAction' ) ? $contentINI->variable( 'RemoveSettings', 'DefaultRemoveAction' ) : 'trash'; if ( $removeAction !== 'trash' && $removeAction !== 'delete' ) { // default remove action is to trash $removeAction = 'trash'; } $moveToTrash = ( $removeAction === 'trash' ) ? true : false; $node->removeNodeFromTree( $moveToTrash ); return true; // @as self::OK; }
[ "protected", "function", "deleteContent", "(", "$", "currentSite", ",", "$", "virtualFolder", ",", "$", "target", ")", "{", "$", "nodePath", "=", "$", "this", "->", "internalNodePath", "(", "$", "virtualFolder", ",", "$", "target", ")", ";", "$", "node", ...
Handles deletion on the content tree level. It will try to find the node with the path $target and then try to remove it (ie. move to trash) if the user is allowed. @param string $currentSite Eg. 'plain_site_user' @param string $virtualFolder Eg. 'Content' @param string $target Eg. 'Folder1/file1.txt' @return bool
[ "Handles", "deletion", "on", "the", "content", "tree", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2366-L2399
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.copyVirtualFolder
protected function copyVirtualFolder( $sourceSite, $destinationSite, $source, $destination ) { $source = $this->splitFirstPathElement( $source, $sourceVFolder ); $destination = $this->splitFirstPathElement( $destination, $destinationVFolder ); if ( !in_array( $sourceVFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !in_array( $destinationVFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$source or !$destination ) { // We have reached the end of the path for source or destination // We do not allow 'copy' operations for the virtual folder (from or to) return false; // @as self::FAILED_FORBIDDEN; } if ( ( $sourceVFolder === self::virtualContentFolderName() or $sourceVFolder === self::virtualMediaFolderName() ) and ( $destinationVFolder === self::virtualContentFolderName() or $destinationVFolder === self::virtualMediaFolderName() ) ) { return $this->copyContent( $sourceSite, $destinationSite, $sourceVFolder, $destinationVFolder, $source, $destination ); } return false; // @as self::FAILED_FORBIDDEN; }
php
protected function copyVirtualFolder( $sourceSite, $destinationSite, $source, $destination ) { $source = $this->splitFirstPathElement( $source, $sourceVFolder ); $destination = $this->splitFirstPathElement( $destination, $destinationVFolder ); if ( !in_array( $sourceVFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !in_array( $destinationVFolder, array( self::virtualContentFolderName(), self::virtualMediaFolderName() ) ) ) { return false; // @as self::FAILED_NOT_FOUND; } if ( !$source or !$destination ) { // We have reached the end of the path for source or destination // We do not allow 'copy' operations for the virtual folder (from or to) return false; // @as self::FAILED_FORBIDDEN; } if ( ( $sourceVFolder === self::virtualContentFolderName() or $sourceVFolder === self::virtualMediaFolderName() ) and ( $destinationVFolder === self::virtualContentFolderName() or $destinationVFolder === self::virtualMediaFolderName() ) ) { return $this->copyContent( $sourceSite, $destinationSite, $sourceVFolder, $destinationVFolder, $source, $destination ); } return false; // @as self::FAILED_FORBIDDEN; }
[ "protected", "function", "copyVirtualFolder", "(", "$", "sourceSite", ",", "$", "destinationSite", ",", "$", "source", ",", "$", "destination", ")", "{", "$", "source", "=", "$", "this", "->", "splitFirstPathElement", "(", "$", "source", ",", "$", "sourceVFo...
Handles copying on the virtual folder level. It will check if the target is below a content folder in which it calls copyContent(). @param string $sourceSite Eg. 'plain_site_user' @param string $destinationSite Eg. 'plain_site_user' @param string $source Eg. 'Content/Folder1/file1.txt' @param string $destination Eg. 'Content/Folder2/file1.txt' @return bool
[ "Handles", "copying", "on", "the", "virtual", "folder", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2501-L2536
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.moveVirtualFolder
protected function moveVirtualFolder( $sourceSite, $destinationSite, $source, $destination, $fullSource, $fullDestination ) { $this->setCurrentSite( $sourceSite ); $source = $this->splitFirstPathElement( $source, $sourceVFolder ); $destination = $this->splitFirstPathElement( $destination, $destinationVFolder ); if ( !$source or !$destination ) { // We have reached the end of the path for source or destination // We do not allow 'move' operations for the virtual folder (from or to) return false; // @as self::FAILED_FORBIDDEN; } if ( ( $sourceVFolder === self::virtualContentFolderName() or $sourceVFolder === self::virtualMediaFolderName() ) and ( $destinationVFolder === self::virtualContentFolderName() or $destinationVFolder === self::virtualMediaFolderName() ) ) { return $this->moveContent( $sourceSite, $destinationSite, $sourceVFolder, $destinationVFolder, $source, $destination, $fullSource, $fullDestination ); } return false; // @as self::FAILED_FORBIDDEN; }
php
protected function moveVirtualFolder( $sourceSite, $destinationSite, $source, $destination, $fullSource, $fullDestination ) { $this->setCurrentSite( $sourceSite ); $source = $this->splitFirstPathElement( $source, $sourceVFolder ); $destination = $this->splitFirstPathElement( $destination, $destinationVFolder ); if ( !$source or !$destination ) { // We have reached the end of the path for source or destination // We do not allow 'move' operations for the virtual folder (from or to) return false; // @as self::FAILED_FORBIDDEN; } if ( ( $sourceVFolder === self::virtualContentFolderName() or $sourceVFolder === self::virtualMediaFolderName() ) and ( $destinationVFolder === self::virtualContentFolderName() or $destinationVFolder === self::virtualMediaFolderName() ) ) { return $this->moveContent( $sourceSite, $destinationSite, $sourceVFolder, $destinationVFolder, $source, $destination, $fullSource, $fullDestination ); } return false; // @as self::FAILED_FORBIDDEN; }
[ "protected", "function", "moveVirtualFolder", "(", "$", "sourceSite", ",", "$", "destinationSite", ",", "$", "source", ",", "$", "destination", ",", "$", "fullSource", ",", "$", "fullDestination", ")", "{", "$", "this", "->", "setCurrentSite", "(", "$", "sou...
Handles moving on the virtual folder level. It will check if the target is below a content folder in which it calls moveContent(). @param string $sourceSite Eg. 'plain_site_user' @param string $destinationSite Eg. 'plain_site_user' @param string $source Eg. 'Content/Folder1/file1.txt' @param string $destination Eg. 'Content/Folder2/file1.txt' @return bool
[ "Handles", "moving", "on", "the", "virtual", "folder", "level", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2768-L2797
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.tempDirectory
protected static function tempDirectory() { $tempDir = eZSys::varDirectory() . '/webdav/tmp'; if ( !file_exists( $tempDir ) ) { eZDir::mkdir( $tempDir, eZDir::directoryPermission(), true ); } return $tempDir; }
php
protected static function tempDirectory() { $tempDir = eZSys::varDirectory() . '/webdav/tmp'; if ( !file_exists( $tempDir ) ) { eZDir::mkdir( $tempDir, eZDir::directoryPermission(), true ); } return $tempDir; }
[ "protected", "static", "function", "tempDirectory", "(", ")", "{", "$", "tempDir", "=", "eZSys", "::", "varDirectory", "(", ")", ".", "'/webdav/tmp'", ";", "if", "(", "!", "file_exists", "(", "$", "tempDir", ")", ")", "{", "eZDir", "::", "mkdir", "(", ...
Returns the path to the WebDAV temporary directory. If the directory does not exist yet, it will be created first. @return string @todo remove or replace with eZ Components functionality
[ "Returns", "the", "path", "to", "the", "WebDAV", "temporary", "directory", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2946-L2954
train
ezsystems/ezpublish-legacy
kernel/private/classes/webdav/ezwebdavcontentbackend.php
eZWebDAVContentBackend.internalNodePath
protected function internalNodePath( $virtualFolder, $collection ) { // All root nodes needs to prepend their name to get the correct path // except for the content root which uses the path directly. if ( $virtualFolder === self::virtualMediaFolderName() ) { $nodePath = 'media'; if ( strlen( $collection ) > 0 ) { $nodePath .= '/' . $collection; } } else { $nodePath = $collection; } return $nodePath; }
php
protected function internalNodePath( $virtualFolder, $collection ) { // All root nodes needs to prepend their name to get the correct path // except for the content root which uses the path directly. if ( $virtualFolder === self::virtualMediaFolderName() ) { $nodePath = 'media'; if ( strlen( $collection ) > 0 ) { $nodePath .= '/' . $collection; } } else { $nodePath = $collection; } return $nodePath; }
[ "protected", "function", "internalNodePath", "(", "$", "virtualFolder", ",", "$", "collection", ")", "{", "// All root nodes needs to prepend their name to get the correct path", "// except for the content root which uses the path directly.", "if", "(", "$", "virtualFolder", "===",...
Returns a path that corresponds to the internal path of nodes. @param string $virtualFolder @param string $collection @return string @todo remove or replace
[ "Returns", "a", "path", "that", "corresponds", "to", "the", "internal", "path", "of", "nodes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/webdav/ezwebdavcontentbackend.php#L2981-L2998
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.parameterSet
static function parameterSet( $fileName = 'site.ini', $rootDir = 'settings', &$section, &$parameter ) { if ( !eZINI::exists( $fileName, $rootDir ) ) return false; $iniInstance = eZINI::instance( $fileName, $rootDir, null, null, null, true ); return $iniInstance->hasVariable( $section, $parameter ); }
php
static function parameterSet( $fileName = 'site.ini', $rootDir = 'settings', &$section, &$parameter ) { if ( !eZINI::exists( $fileName, $rootDir ) ) return false; $iniInstance = eZINI::instance( $fileName, $rootDir, null, null, null, true ); return $iniInstance->hasVariable( $section, $parameter ); }
[ "static", "function", "parameterSet", "(", "$", "fileName", "=", "'site.ini'", ",", "$", "rootDir", "=", "'settings'", ",", "&", "$", "section", ",", "&", "$", "parameter", ")", "{", "if", "(", "!", "eZINI", "::", "exists", "(", "$", "fileName", ",", ...
Check whether a specified parameter in a specified section is set in a specified file @deprecated Since 4.4 @param string fileName file name (optional) @param string rootDir directory (optional) @param string section section name @param string parameter parameter name @return bool True if the the parameter is set.
[ "Check", "whether", "a", "specified", "parameter", "in", "a", "specified", "section", "is", "set", "in", "a", "specified", "file" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L319-L326
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.selectOverrideScope
protected static function selectOverrideScope( $scope, $identifier, $dir, $default ) { if ( $scope !== null ) { $def = self::defaultOverrideDirs(); if ( isset( $def[$scope] ) ) return $scope; eZDebug::writeWarning( "Undefined override dir scope: '$scope' with dir: '$dir'", __METHOD__ ); } if ( $identifier === 'siteaccess' ) return 'siteaccess'; else if ( $identifier && strpos($identifier, 'extension:') === 0 ) return 'extension'; else if ( strpos($dir, 'siteaccess') !== false ) return 'siteaccess'; else if ( strpos($dir, 'extension') !== false ) return 'extension'; eZDebug::writeStrict( "Could not figgure out INI scope for \$identifier: '$identifier' with \$dir: '$dir', falling back to '$default'", __METHOD__ ); return $default; }
php
protected static function selectOverrideScope( $scope, $identifier, $dir, $default ) { if ( $scope !== null ) { $def = self::defaultOverrideDirs(); if ( isset( $def[$scope] ) ) return $scope; eZDebug::writeWarning( "Undefined override dir scope: '$scope' with dir: '$dir'", __METHOD__ ); } if ( $identifier === 'siteaccess' ) return 'siteaccess'; else if ( $identifier && strpos($identifier, 'extension:') === 0 ) return 'extension'; else if ( strpos($dir, 'siteaccess') !== false ) return 'siteaccess'; else if ( strpos($dir, 'extension') !== false ) return 'extension'; eZDebug::writeStrict( "Could not figgure out INI scope for \$identifier: '$identifier' with \$dir: '$dir', falling back to '$default'", __METHOD__ ); return $default; }
[ "protected", "static", "function", "selectOverrideScope", "(", "$", "scope", ",", "$", "identifier", ",", "$", "dir", ",", "$", "default", ")", "{", "if", "(", "$", "scope", "!==", "null", ")", "{", "$", "def", "=", "self", "::", "defaultOverrideDirs", ...
Function to handle bc with code from pre 4.4 that does not know about scopes @since 4.4 @param string|null $scope @param string $identifier @param string $dir @param string $default @return string
[ "Function", "to", "handle", "bc", "with", "code", "from", "pre", "4", ".", "4", "that", "does", "not", "know", "about", "scopes" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1377-L1397
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.variable
function variable( $blockName, $varName ) { if ( isset( $this->BlockValues[$blockName][$varName] ) ) { $value = $this->BlockValues[$blockName][$varName]; } if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $value = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( $value ) && isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $value ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $value = array_merge( $value, self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } if ( isset( $value ) ) return $value; if ( !isset( $this->BlockValues[$blockName] ) ) eZDebug::writeError( "Undefined group: '$blockName' in " . $this->FileName, __METHOD__ ); else eZDebug::writeError( "Undefined variable: '$varName' in group '$blockName' in " . $this->FileName, __METHOD__ ); return false; }
php
function variable( $blockName, $varName ) { if ( isset( $this->BlockValues[$blockName][$varName] ) ) { $value = $this->BlockValues[$blockName][$varName]; } if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $value = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( $value ) && isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $value ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $value = array_merge( $value, self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } if ( isset( $value ) ) return $value; if ( !isset( $this->BlockValues[$blockName] ) ) eZDebug::writeError( "Undefined group: '$blockName' in " . $this->FileName, __METHOD__ ); else eZDebug::writeError( "Undefined variable: '$varName' in group '$blockName' in " . $this->FileName, __METHOD__ ); return false; }
[ "function", "variable", "(", "$", "blockName", ",", "$", "varName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "BlockValues", "[", "$", "blockName", "]", "[", "$", "varName", "]", ")", ")", "{", "$", "value", "=", "$", "this", "->", "B...
Reads a variable from the ini file. Returns false, if the variable was not found. @since 5.0 takes injected settings into account @param string $blockName @param string $varName @return mixed
[ "Reads", "a", "variable", "from", "the", "ini", "file", ".", "Returns", "false", "if", "the", "variable", "was", "not", "found", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1421-L1450
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.variableMulti
function variableMulti( $blockName, $varNames, $signatures = array() ) { $ret = array(); if ( !isset( $this->BlockValues[$blockName] ) && !isset( self::$injectedSettings[$this->FileName][$blockName] ) ) { eZDebug::writeError( "Undefined group: '$blockName' in " . $this->FileName, "eZINI" ); return false; } foreach ( $varNames as $key => $varName ) { $ret[$key] = null; if ( isset( $this->BlockValues[$blockName][$varName] ) ) { $ret[$key] = $this->BlockValues[$blockName][$varName]; } if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $ret[$key] = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $ret[$key] ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $ret[$key] = array_merge( $this->BlockValues[$blockName][$varName], self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } if ( isset( $ret[$key] ) && isset( $signatures[$key] ) ) { switch ( $signatures[$key] ) { case 'enabled': $ret[$key] = $this->BlockValues[$blockName][$varName] == 'enabled'; break; } } } return $ret; }
php
function variableMulti( $blockName, $varNames, $signatures = array() ) { $ret = array(); if ( !isset( $this->BlockValues[$blockName] ) && !isset( self::$injectedSettings[$this->FileName][$blockName] ) ) { eZDebug::writeError( "Undefined group: '$blockName' in " . $this->FileName, "eZINI" ); return false; } foreach ( $varNames as $key => $varName ) { $ret[$key] = null; if ( isset( $this->BlockValues[$blockName][$varName] ) ) { $ret[$key] = $this->BlockValues[$blockName][$varName]; } if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $ret[$key] = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $ret[$key] ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $ret[$key] = array_merge( $this->BlockValues[$blockName][$varName], self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } if ( isset( $ret[$key] ) && isset( $signatures[$key] ) ) { switch ( $signatures[$key] ) { case 'enabled': $ret[$key] = $this->BlockValues[$blockName][$varName] == 'enabled'; break; } } } return $ret; }
[ "function", "variableMulti", "(", "$", "blockName", ",", "$", "varNames", ",", "$", "signatures", "=", "array", "(", ")", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "BlockValues", "[", "$", ...
Reads multiple variables from the ini file. Returns false, if the block does not exist. @since 5.0 takes injected settings into account @param string $blockName @param string $varNames @param array $signatures @return false|array
[ "Reads", "multiple", "variables", "from", "the", "ini", "file", ".", "Returns", "false", "if", "the", "block", "does", "not", "exist", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1462-L1509
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.hasVariable
function hasVariable( $blockName, $varName ) { // 1. Check if the variable is set in either injected or regular settings. if ( !isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) && !isset( $this->BlockValues[$blockName][$varName] ) ) { return false; } // 2. Check if injected setting isn't strictly false (false being the default value when a variable doesn't exist). if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) && self::$injectedSettings[$this->FileName][$blockName][$varName] === false ) { return false; } return true; }
php
function hasVariable( $blockName, $varName ) { // 1. Check if the variable is set in either injected or regular settings. if ( !isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) && !isset( $this->BlockValues[$blockName][$varName] ) ) { return false; } // 2. Check if injected setting isn't strictly false (false being the default value when a variable doesn't exist). if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) && self::$injectedSettings[$this->FileName][$blockName][$varName] === false ) { return false; } return true; }
[ "function", "hasVariable", "(", "$", "blockName", ",", "$", "varName", ")", "{", "// 1. Check if the variable is set in either injected or regular settings.", "if", "(", "!", "isset", "(", "self", "::", "$", "injectedSettings", "[", "$", "this", "->", "FileName", "]...
Checks if a variable is set. @since 5.0 also checks in the injected settings @param string $blockName @param string $varName @return bool
[ "Checks", "if", "a", "variable", "is", "set", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1519-L1540
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.variableArray
function variableArray( $blockName, $varName ) { $ret = $this->variable( $blockName, $varName ); if ( is_array( $ret ) ) { $arr = array(); foreach ( $ret as $key => $retItem ) { $arr[$key] = explode( ';', $retItem ); } $ret = $arr; } else if ( $ret !== false ) { $ret = trim( $ret ) === '' ? array() : explode( ';', $ret ); } return $ret; }
php
function variableArray( $blockName, $varName ) { $ret = $this->variable( $blockName, $varName ); if ( is_array( $ret ) ) { $arr = array(); foreach ( $ret as $key => $retItem ) { $arr[$key] = explode( ';', $retItem ); } $ret = $arr; } else if ( $ret !== false ) { $ret = trim( $ret ) === '' ? array() : explode( ';', $ret ); } return $ret; }
[ "function", "variableArray", "(", "$", "blockName", ",", "$", "varName", ")", "{", "$", "ret", "=", "$", "this", "->", "variable", "(", "$", "blockName", ",", "$", "varName", ")", ";", "if", "(", "is_array", "(", "$", "ret", ")", ")", "{", "$", "...
Reads a variable from the ini file or injected settings. The variable will be returned as an array. ; is used as delimiter. @param string $blockName @param string $varName @return array
[ "Reads", "a", "variable", "from", "the", "ini", "file", "or", "injected", "settings", ".", "The", "variable", "will", "be", "returned", "as", "an", "array", ".", ";", "is", "used", "as", "delimiter", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1572-L1591
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.group
function group( $blockName ) { if ( !isset( $this->BlockValues[$blockName] ) ) { eZDebug::writeError( "Unknown group: '$blockName'", __METHOD__ ); $ret = null; return $ret; } if ( isset( self::$injectedSettings[$this->FileName][$blockName] ) ) { $ret = array_merge( $this->BlockValues[$blockName], self::$injectedSettings[$this->FileName][$blockName] ); } else { $ret = $this->BlockValues[$blockName]; } return $ret; }
php
function group( $blockName ) { if ( !isset( $this->BlockValues[$blockName] ) ) { eZDebug::writeError( "Unknown group: '$blockName'", __METHOD__ ); $ret = null; return $ret; } if ( isset( self::$injectedSettings[$this->FileName][$blockName] ) ) { $ret = array_merge( $this->BlockValues[$blockName], self::$injectedSettings[$this->FileName][$blockName] ); } else { $ret = $this->BlockValues[$blockName]; } return $ret; }
[ "function", "group", "(", "$", "blockName", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "BlockValues", "[", "$", "blockName", "]", ")", ")", "{", "eZDebug", "::", "writeError", "(", "\"Unknown group: '$blockName'\"", ",", "__METHOD__", ")", ...
Fetches a variable group and returns it as an associative array. @since 5.0 takes injected settings into account @since 5.0 does not return the array by reference anymore @param string $blockName @return array
[ "Fetches", "a", "variable", "group", "and", "returns", "it", "as", "an", "associative", "array", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1612-L1633
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.groups
function groups() { if ( isset( self::$injectedSettings[$this->FileName] ) || isset( self::$injectedMergeSettings[$this->FileName] ) ) { $result = $this->BlockValues; foreach ( $result as $blockName => $vars ) { foreach ( $vars as $varName => $varValue ) { if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $result[$blockName][$varName] = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $result[$blockName][$varName] ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $result[$blockName][$varName] = array_merge( $varValue, self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } } } foreach ( self::$injectedSettings[$this->FileName] as $blockName => $vars ) { if ( !isset( $result[$blockName] ) ) { $result[$blockName] = $vars; } } return $result; } return $this->BlockValues; }
php
function groups() { if ( isset( self::$injectedSettings[$this->FileName] ) || isset( self::$injectedMergeSettings[$this->FileName] ) ) { $result = $this->BlockValues; foreach ( $result as $blockName => $vars ) { foreach ( $vars as $varName => $varValue ) { if ( isset( self::$injectedSettings[$this->FileName][$blockName][$varName] ) ) { $result[$blockName][$varName] = self::$injectedSettings[$this->FileName][$blockName][$varName]; } if ( isset( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { if ( !is_array( $result[$blockName][$varName] ) || !is_array( self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ) ) { throw new RuntimeException( "injected-merge-settings can only reference and contain array values" ); } $result[$blockName][$varName] = array_merge( $varValue, self::$injectedMergeSettings[$this->FileName][$blockName][$varName] ); } } } foreach ( self::$injectedSettings[$this->FileName] as $blockName => $vars ) { if ( !isset( $result[$blockName] ) ) { $result[$blockName] = $vars; } } return $result; } return $this->BlockValues; }
[ "function", "groups", "(", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "injectedSettings", "[", "$", "this", "->", "FileName", "]", ")", "||", "isset", "(", "self", "::", "$", "injectedMergeSettings", "[", "$", "this", "->", "FileName", "]", ...
Fetches all defined groups and returns them as an associative array @since 5.0 does not return the array by reference anymore @since 5.0 takes injected settings into account @return array
[ "Fetches", "all", "defined", "groups", "and", "returns", "them", "as", "an", "associative", "array" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1684-L1721
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.getNamedArray
function getNamedArray() { if ( isset( self::$injectedSettings[$this->FileName] ) ) { return array_merge( $this->BlockValues, self::$injectedSettings[$this->FileName] ); } return $this->BlockValues; }
php
function getNamedArray() { if ( isset( self::$injectedSettings[$this->FileName] ) ) { return array_merge( $this->BlockValues, self::$injectedSettings[$this->FileName] ); } return $this->BlockValues; }
[ "function", "getNamedArray", "(", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "injectedSettings", "[", "$", "this", "->", "FileName", "]", ")", ")", "{", "return", "array_merge", "(", "$", "this", "->", "BlockValues", ",", "self", "::", "$", ...
Returns BlockValues, which is a nicely named Array @return array
[ "Returns", "BlockValues", "which", "is", "a", "nicely", "named", "Array" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1869-L1879
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezini.php
eZINI.resetGlobals
static function resetGlobals( $fileName = 'site.ini', $rootDir = 'settings', $useLocalOverrides = null ) { self::resetInstance( $fileName, $rootDir, $useLocalOverrides ); }
php
static function resetGlobals( $fileName = 'site.ini', $rootDir = 'settings', $useLocalOverrides = null ) { self::resetInstance( $fileName, $rootDir, $useLocalOverrides ); }
[ "static", "function", "resetGlobals", "(", "$", "fileName", "=", "'site.ini'", ",", "$", "rootDir", "=", "'settings'", ",", "$", "useLocalOverrides", "=", "null", ")", "{", "self", "::", "resetInstance", "(", "$", "fileName", ",", "$", "rootDir", ",", "$",...
Resets a specific instance of eZINI. @deprecated since 4.5, use resetInstance() instead @param string $fileName @param string $rootDir @param null|bool $useLocalOverrides default system setting if null @see resetInstance()
[ "Resets", "a", "specific", "instance", "of", "eZINI", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezini.php#L1988-L1991
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/default_regexp_prefix_filter.php
ezpRestDefaultRegexpPrefixFilter.filter
public function filter( ) { if ( preg_match( $this->getPrefixPattern(), $this->request->uri, $tokenMatches ) ) { $this->versionToken = isset( $tokenMatches['version'] ) ? $tokenMatches['version'] : ''; $this->apiProviderToken = isset( $tokenMatches['provider'] ) ? $tokenMatches['provider'] : ''; self::$version = $this->parseVersionValue(); self::$apiProvider = empty( $this->apiProviderToken ) ? null : $this->apiProviderToken; } }
php
public function filter( ) { if ( preg_match( $this->getPrefixPattern(), $this->request->uri, $tokenMatches ) ) { $this->versionToken = isset( $tokenMatches['version'] ) ? $tokenMatches['version'] : ''; $this->apiProviderToken = isset( $tokenMatches['provider'] ) ? $tokenMatches['provider'] : ''; self::$version = $this->parseVersionValue(); self::$apiProvider = empty( $this->apiProviderToken ) ? null : $this->apiProviderToken; } }
[ "public", "function", "filter", "(", ")", "{", "if", "(", "preg_match", "(", "$", "this", "->", "getPrefixPattern", "(", ")", ",", "$", "this", "->", "request", "->", "uri", ",", "$", "tokenMatches", ")", ")", "{", "$", "this", "->", "versionToken", ...
Filters the request object for API provider name and version token. API provider name is assumed to be the first URI element. If version token exists, gets the numerical value of this token, and filters the URI in the request object, removing said token. This lets us not to deal with any version token data, in our route definitions. This is a benefit, since different systems, might have different preferences for what the version token should look like. @return void
[ "Filters", "the", "request", "object", "for", "API", "provider", "name", "and", "version", "token", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/default_regexp_prefix_filter.php#L68-L78
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.disconnect
public function disconnect() { if ( self::$dbbackend !== null ) { self::$dbbackend->_disconnect(); self::$dbbackend= null; } }
php
public function disconnect() { if ( self::$dbbackend !== null ) { self::$dbbackend->_disconnect(); self::$dbbackend= null; } }
[ "public", "function", "disconnect", "(", ")", "{", "if", "(", "self", "::", "$", "dbbackend", "!==", "null", ")", "{", "self", "::", "$", "dbbackend", "->", "_disconnect", "(", ")", ";", "self", "::", "$", "dbbackend", "=", "null", ";", "}", "}" ]
Disconnects the cluster handler from the database
[ "Disconnects", "the", "cluster", "handler", "from", "the", "database" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L112-L119
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.loadMetaData
public function loadMetaData( $force = false ) { // Fetch metadata. if ( $this->filePath === false ) return; if ( $force && isset( $GLOBALS['eZClusterInfo'][$this->filePath] ) ) unset( $GLOBALS['eZClusterInfo'][$this->filePath] ); // Checks for metadata stored in memory, useful for repeated access // to the same file in one request // TODO: On PHP5 turn into static member if ( isset( $GLOBALS['eZClusterInfo'][$this->filePath] ) ) { $GLOBALS['eZClusterInfo'][$this->filePath]['cnt'] += 1; $this->_metaData = $GLOBALS['eZClusterInfo'][$this->filePath]['data']; return; } $metaData = self::$dbbackend->_fetchMetadata( $this->filePath ); if ( $metaData ) $this->_metaData = $metaData; else $this->_metaData = false; // Clean up old entries if the maximum count is reached if ( isset( $GLOBALS['eZClusterInfo'] ) && count( $GLOBALS['eZClusterInfo'] ) >= self::INFOCACHE_MAX ) { usort( $GLOBALS['eZClusterInfo'], function ( $a, $b ) { $a = $a['cnt']; $b = $b['cnt']; if ( $a == $b ) { return 0; } return $a > $b ? -1 : 1; }); array_pop( $GLOBALS['eZClusterInfo'] ); } $GLOBALS['eZClusterInfo'][$this->filePath] = array( 'cnt' => 1, 'data' => $metaData ); }
php
public function loadMetaData( $force = false ) { // Fetch metadata. if ( $this->filePath === false ) return; if ( $force && isset( $GLOBALS['eZClusterInfo'][$this->filePath] ) ) unset( $GLOBALS['eZClusterInfo'][$this->filePath] ); // Checks for metadata stored in memory, useful for repeated access // to the same file in one request // TODO: On PHP5 turn into static member if ( isset( $GLOBALS['eZClusterInfo'][$this->filePath] ) ) { $GLOBALS['eZClusterInfo'][$this->filePath]['cnt'] += 1; $this->_metaData = $GLOBALS['eZClusterInfo'][$this->filePath]['data']; return; } $metaData = self::$dbbackend->_fetchMetadata( $this->filePath ); if ( $metaData ) $this->_metaData = $metaData; else $this->_metaData = false; // Clean up old entries if the maximum count is reached if ( isset( $GLOBALS['eZClusterInfo'] ) && count( $GLOBALS['eZClusterInfo'] ) >= self::INFOCACHE_MAX ) { usort( $GLOBALS['eZClusterInfo'], function ( $a, $b ) { $a = $a['cnt']; $b = $b['cnt']; if ( $a == $b ) { return 0; } return $a > $b ? -1 : 1; }); array_pop( $GLOBALS['eZClusterInfo'] ); } $GLOBALS['eZClusterInfo'][$this->filePath] = array( 'cnt' => 1, 'data' => $metaData ); }
[ "public", "function", "loadMetaData", "(", "$", "force", "=", "false", ")", "{", "// Fetch metadata.", "if", "(", "$", "this", "->", "filePath", "===", "false", ")", "return", ";", "if", "(", "$", "force", "&&", "isset", "(", "$", "GLOBALS", "[", "'eZC...
Loads file meta information. @param bool $force File stats will be refreshed if true @return void
[ "Loads", "file", "meta", "information", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L127-L171
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.fileStore
public function fileStore( $filePath, $scope = false, $delete = false, $datatype = false ) { $filePath = self::cleanPath( $filePath ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileStore( '$filePath' )" ); if ( $scope === false ) $scope = 'UNKNOWN_SCOPE'; if ( $datatype === false ) $datatype = 'misc'; self::$dbbackend->_store( $filePath, $datatype, $scope ); if ( $delete ) @unlink( $filePath ); }
php
public function fileStore( $filePath, $scope = false, $delete = false, $datatype = false ) { $filePath = self::cleanPath( $filePath ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileStore( '$filePath' )" ); if ( $scope === false ) $scope = 'UNKNOWN_SCOPE'; if ( $datatype === false ) $datatype = 'misc'; self::$dbbackend->_store( $filePath, $datatype, $scope ); if ( $delete ) @unlink( $filePath ); }
[ "public", "function", "fileStore", "(", "$", "filePath", ",", "$", "scope", "=", "false", ",", "$", "delete", "=", "false", ",", "$", "datatype", "=", "false", ")", "{", "$", "filePath", "=", "self", "::", "cleanPath", "(", "$", "filePath", ")", ";",...
Stores a file by path to the backend @param string $filePath Path to the file being stored. @param string $scope Means something like "file category". May be used to clean caches of a certain type. @param bool $delete true if the file should be deleted after storing. @param string $datatype @return void
[ "Stores", "a", "file", "by", "path", "to", "the", "backend" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L184-L199
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.storeContents
public function storeContents( $contents, $scope = false, $datatype = false, $storeLocally = false ) { if ( $scope === false ) $scope = 'UNKNOWN_SCOPE'; if ( $datatype === false ) $datatype = 'misc'; $filePath = $this->filePath; eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::storeContents( '$filePath' )" ); // the file is stored with the current time as mtime $result = self::$dbbackend->_storeContents( $filePath, $contents, $scope, $datatype ); if ( $result && $storeLocally ) { eZFile::create( basename( $filePath ), dirname( $filePath ), $contents, true ); } return $result; }
php
public function storeContents( $contents, $scope = false, $datatype = false, $storeLocally = false ) { if ( $scope === false ) $scope = 'UNKNOWN_SCOPE'; if ( $datatype === false ) $datatype = 'misc'; $filePath = $this->filePath; eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::storeContents( '$filePath' )" ); // the file is stored with the current time as mtime $result = self::$dbbackend->_storeContents( $filePath, $contents, $scope, $datatype ); if ( $result && $storeLocally ) { eZFile::create( basename( $filePath ), dirname( $filePath ), $contents, true ); } return $result; }
[ "public", "function", "storeContents", "(", "$", "contents", ",", "$", "scope", "=", "false", ",", "$", "datatype", "=", "false", ",", "$", "storeLocally", "=", "false", ")", "{", "if", "(", "$", "scope", "===", "false", ")", "$", "scope", "=", "'UNK...
Store file contents using binary data @param string $contents Binary file content @param string $scope "file category". May be used by cache management @param string $datatype Datatype for the file. Also used to clean cache up @param bool $storeLocally If true the file will also be stored on the local file system.
[ "Store", "file", "contents", "using", "binary", "data" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L236-L255
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.fileFetch
function fileFetch( $filePath ) { $filePath = self::cleanPath( $filePath ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileFetch( '$filePath' )" ); return self::$dbbackend->_fetch( $filePath ); }
php
function fileFetch( $filePath ) { $filePath = self::cleanPath( $filePath ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileFetch( '$filePath' )" ); return self::$dbbackend->_fetch( $filePath ); }
[ "function", "fileFetch", "(", "$", "filePath", ")", "{", "$", "filePath", "=", "self", "::", "cleanPath", "(", "$", "filePath", ")", ";", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "\"dfs::fileFetch( '$filePath' )\"", ")", ";", "retur...
Fetches file from DFS and saves it in LFS under the same name. @param string $filePath @return string|false the file path, or false if fetching failed
[ "Fetches", "file", "from", "DFS", "and", "saves", "it", "in", "LFS", "under", "the", "same", "name", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L264-L270
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.fetchUnique
public function fetchUnique() { $filePath = $this->filePath; eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fetchUnique( '$filePath' )" ); $fetchedFilePath = self::$dbbackend->_fetch( $filePath, true ); $this->uniqueName = $fetchedFilePath; return $fetchedFilePath; }
php
public function fetchUnique() { $filePath = $this->filePath; eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fetchUnique( '$filePath' )" ); $fetchedFilePath = self::$dbbackend->_fetch( $filePath, true ); $this->uniqueName = $fetchedFilePath; return $fetchedFilePath; }
[ "public", "function", "fetchUnique", "(", ")", "{", "$", "filePath", "=", "$", "this", "->", "filePath", ";", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "\"dfs::fetchUnique( '$filePath' )\"", ")", ";", "$", "fetchedFilePath", "=", "self...
Fetches file from db and saves it in FS under a unique name @return string filename with path of a saved file. You can use this filename to get contents of file from filesystem.
[ "Fetches", "file", "from", "db", "and", "saves", "it", "in", "FS", "under", "a", "unique", "name" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L302-L310
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.isDBFileExpired
public function isDBFileExpired( $expiry, $curtime, $ttl ) { $mtime = isset( $this->metaData['mtime'] ) ? $this->metaData['mtime'] : 0; return self::isFileExpired( $this->filePath, $mtime, $expiry, $curtime, $ttl ); }
php
public function isDBFileExpired( $expiry, $curtime, $ttl ) { $mtime = isset( $this->metaData['mtime'] ) ? $this->metaData['mtime'] : 0; return self::isFileExpired( $this->filePath, $mtime, $expiry, $curtime, $ttl ); }
[ "public", "function", "isDBFileExpired", "(", "$", "expiry", ",", "$", "curtime", ",", "$", "ttl", ")", "{", "$", "mtime", "=", "isset", "(", "$", "this", "->", "metaData", "[", "'mtime'", "]", ")", "?", "$", "this", "->", "metaData", "[", "'mtime'",...
Calculates if the DB file is expired or not. @param int $expiry Time when file is to be expired, a value of -1 will disable this check. @param int $curtime The current time to check against. @param int $ttl Number of seconds the data can live, set to null to disable TTL. @return bool
[ "Calculates", "if", "the", "DB", "file", "is", "expired", "or", "not", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L772-L776
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.fileDeleteByWildcard
public function fileDeleteByWildcard( $wildcard ) { $wildcard = self::cleanPath( $wildcard ); eZDebug::writeWarning( "Using " . __METHOD__ . " is not recommended since it has some severe performance issues" ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileDeleteByWildcard( '$wildcard' )" ); self::$dbbackend->_deleteByWildcard( $wildcard ); }
php
public function fileDeleteByWildcard( $wildcard ) { $wildcard = self::cleanPath( $wildcard ); eZDebug::writeWarning( "Using " . __METHOD__ . " is not recommended since it has some severe performance issues" ); eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::fileDeleteByWildcard( '$wildcard' )" ); self::$dbbackend->_deleteByWildcard( $wildcard ); }
[ "public", "function", "fileDeleteByWildcard", "(", "$", "wildcard", ")", "{", "$", "wildcard", "=", "self", "::", "cleanPath", "(", "$", "wildcard", ")", ";", "eZDebug", "::", "writeWarning", "(", "\"Using \"", ".", "__METHOD__", ".", "\" is not recommended sinc...
Deletes a list of files by wildcard @param string $wildcard The wildcard used to look for files. Can contain * and ? @return void @todo -ceZDFSFileHandler write unit test
[ "Deletes", "a", "list", "of", "files", "by", "wildcard" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L971-L978
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.purge
function purge( $printCallback = false, $microsleep = false, $max = false, $expiry = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::purge( '$this->filePath' )" ); $file = $this->filePath; if ( $max === false ) { $max = 100; } $count = 0; /** * The loop starts without knowing how many files are to be deleted. * When _purgeByLike is called, it returns the number of affected rows. * If rows were affected, _purgeByLike will be called again */ do { // @todo this won't work on windows, make a wrapper that uses // either usleep or sleep depending on the OS if ( $count > 0 && $microsleep ) { usleep( $microsleep ); // Sleep a bit to make the database happier } $count = self::$dbbackend->_purgeByLike( $file . "/%", true, $max, $expiry, 'purge' ); self::$dbbackend->_purge( $file, true, $expiry, 'purge' ); if ( $printCallback ) { call_user_func_array( $printCallback, array( $file, $count ) ); } // @todo Compare $count to $max. If $count < $max, no more files are to // be purged, and we can exit the loop } while ( $count > 0 ); // Remove local copies if ( is_file( $file ) ) { @unlink( $file ); } elseif ( is_dir( $file ) ) { eZDir::recursiveDelete( $file ); } eZClusterFileHandler::cleanupEmptyDirectories( $file ); }
php
function purge( $printCallback = false, $microsleep = false, $max = false, $expiry = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::purge( '$this->filePath' )" ); $file = $this->filePath; if ( $max === false ) { $max = 100; } $count = 0; /** * The loop starts without knowing how many files are to be deleted. * When _purgeByLike is called, it returns the number of affected rows. * If rows were affected, _purgeByLike will be called again */ do { // @todo this won't work on windows, make a wrapper that uses // either usleep or sleep depending on the OS if ( $count > 0 && $microsleep ) { usleep( $microsleep ); // Sleep a bit to make the database happier } $count = self::$dbbackend->_purgeByLike( $file . "/%", true, $max, $expiry, 'purge' ); self::$dbbackend->_purge( $file, true, $expiry, 'purge' ); if ( $printCallback ) { call_user_func_array( $printCallback, array( $file, $count ) ); } // @todo Compare $count to $max. If $count < $max, no more files are to // be purged, and we can exit the loop } while ( $count > 0 ); // Remove local copies if ( is_file( $file ) ) { @unlink( $file ); } elseif ( is_dir( $file ) ) { eZDir::recursiveDelete( $file ); } eZClusterFileHandler::cleanupEmptyDirectories( $file ); }
[ "function", "purge", "(", "$", "printCallback", "=", "false", ",", "$", "microsleep", "=", "false", ",", "$", "max", "=", "false", ",", "$", "expiry", "=", "false", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "\"dfs::pu...
Purges local and remote file data for current file path. Can be given a file or a folder. In order to clear a folder, do NOT add a trailing / at the end of the file's path: path/to/file instead of path/to/file/. By default, only expired files will be removed (ezdfsfile.expired = 1). If you specify an $expiry time, it will replace the expired test and only purge files older than the given expiry timestamp. @param callback $printCallback Callback called after each delete iteration (@see $max) to print out a report of the deleted files. This callback expects two parameters, $file (delete pattern used to perform deletion) and $count (number of deleted items) @param int $microsleep Wait interval before each purge batch of $max items @param int $max Maximum number of items to delete in one batch (default: 100) @param int $expiry If specificed, only files older than this date will be purged @return void
[ "Purges", "local", "and", "remote", "file", "data", "for", "current", "file", "path", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L1096-L1141
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.passthrough
function passthrough( $startOffset = 0, $length = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::passthrough( '{$this->filePath}', $startOffset, $length )" ); self::$dbbackend->_passThrough( $this->filePath, $startOffset, $length, "dfs::passthrough( '{$this->filePath}'" ); }
php
function passthrough( $startOffset = 0, $length = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::passthrough( '{$this->filePath}', $startOffset, $length )" ); self::$dbbackend->_passThrough( $this->filePath, $startOffset, $length, "dfs::passthrough( '{$this->filePath}'" ); }
[ "function", "passthrough", "(", "$", "startOffset", "=", "0", ",", "$", "length", "=", "false", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "\"dfs::passthrough( '{$this->filePath}', $startOffset, $length )\"", ")", ";", "self", "::...
Outputs file contents directly @param int $startOffset Byte offset to start transfer from @param int $length Byte length to transfer. NOT end offset, end offset = $startOffset + $length @return void
[ "Outputs", "file", "contents", "directly" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L1177-L1181
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.getFileList
function getFileList( $scopes = false, $excludeScopes = false, $limit = false, $path = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', sprintf( "dfs::getFileList( array( %s ), %d )", is_array( $scopes ) ? implode( ', ', $scopes ) : '', (int) $excludeScopes ) ); return self::$dbbackend->_getFileList( $scopes, $excludeScopes, $limit, $path ); }
php
function getFileList( $scopes = false, $excludeScopes = false, $limit = false, $path = false ) { eZDebugSetting::writeDebug( 'kernel-clustering', sprintf( "dfs::getFileList( array( %s ), %d )", is_array( $scopes ) ? implode( ', ', $scopes ) : '', (int) $excludeScopes ) ); return self::$dbbackend->_getFileList( $scopes, $excludeScopes, $limit, $path ); }
[ "function", "getFileList", "(", "$", "scopes", "=", "false", ",", "$", "excludeScopes", "=", "false", ",", "$", "limit", "=", "false", ",", "$", "path", "=", "false", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "sprintf...
Get list of files stored in database. Used in bin/php/clusterize.php. @param array $scopes return only files that belong to any of these scopes @param boolean $excludeScopes if true, then reverse the meaning of $scopes, which is @param array $limit limits the search to offset limit[0], limit limit[1] @param string $path filter to include entries only including $path return only files that do not belong to any of the scopes listed in $scopes
[ "Get", "list", "of", "files", "stored", "in", "database", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L1250-L1256
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.startCacheGeneration
public function startCacheGeneration() { eZDebugSetting::writeDebug( 'kernel-clustering', "Starting cache generation", "dfs::startCacheGeneration( '{$this->filePath}' )" ); $generatingFilePath = $this->filePath . '.generating'; try { $ret = self::$dbbackend->_startCacheGeneration( $this->filePath, $generatingFilePath ); } catch( RuntimeException $e ) { eZDebug::writeError( $e->getMessage() ); return false; } // generation granted if ( $ret['result'] == 'ok' ) { eZClusterFileHandler::addGeneratingFile( $this ); $this->realFilePath = $this->filePath; $this->filePath = $generatingFilePath; $this->generationStartTimestamp = $ret['mtime']; return true; } // failure: the file is being generated elseif ( $ret['result'] == 'ko' ) { return $ret['remaining']; } // unhandled error case, should not happen else { eZLog::write( "An error occured starting cache generation on '$generatingFilePath'", 'cluster.log' ); return false; } }
php
public function startCacheGeneration() { eZDebugSetting::writeDebug( 'kernel-clustering', "Starting cache generation", "dfs::startCacheGeneration( '{$this->filePath}' )" ); $generatingFilePath = $this->filePath . '.generating'; try { $ret = self::$dbbackend->_startCacheGeneration( $this->filePath, $generatingFilePath ); } catch( RuntimeException $e ) { eZDebug::writeError( $e->getMessage() ); return false; } // generation granted if ( $ret['result'] == 'ok' ) { eZClusterFileHandler::addGeneratingFile( $this ); $this->realFilePath = $this->filePath; $this->filePath = $generatingFilePath; $this->generationStartTimestamp = $ret['mtime']; return true; } // failure: the file is being generated elseif ( $ret['result'] == 'ko' ) { return $ret['remaining']; } // unhandled error case, should not happen else { eZLog::write( "An error occured starting cache generation on '$generatingFilePath'", 'cluster.log' ); return false; } }
[ "public", "function", "startCacheGeneration", "(", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "\"Starting cache generation\"", ",", "\"dfs::startCacheGeneration( '{$this->filePath}' )\"", ")", ";", "$", "generatingFilePath", "=", "$", "...
Starts cache generation for the current file. This is done by creating a file named by the original file name, prefixed with '.generating'. @return bool false if the file is being generated, true if it is not
[ "Starts", "cache", "generation", "for", "the", "current", "file", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L1289-L1321
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php
eZDFSFileHandler.abortCacheGeneration
public function abortCacheGeneration() { eZDebugSetting::writeDebug( 'kernel-clustering', 'Aborting cache generation', "dfs::abortCacheGeneration( '{$this->filePath}' )" ); self::$dbbackend->_abortCacheGeneration( $this->filePath ); $this->filePath = $this->realFilePath; $this->realFilePath = null; eZClusterFileHandler::removeGeneratingFile( $this ); }
php
public function abortCacheGeneration() { eZDebugSetting::writeDebug( 'kernel-clustering', 'Aborting cache generation', "dfs::abortCacheGeneration( '{$this->filePath}' )" ); self::$dbbackend->_abortCacheGeneration( $this->filePath ); $this->filePath = $this->realFilePath; $this->realFilePath = null; eZClusterFileHandler::removeGeneratingFile( $this ); }
[ "public", "function", "abortCacheGeneration", "(", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-clustering'", ",", "'Aborting cache generation'", ",", "\"dfs::abortCacheGeneration( '{$this->filePath}' )\"", ")", ";", "self", "::", "$", "dbbackend", "->", ...
Aborts the current cache generation process. Does so by rolling back the current transaction, which should be the .generating file lock
[ "Aborts", "the", "current", "cache", "generation", "process", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/ezdfsfilehandler.php#L1358-L1365
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/object.php
ezpRestCacheStorageClusterObject.prepareData
protected function prepareData( $data ) { if ( ( is_object( $data ) && !( $data instanceof ezcBaseExportable ) ) || is_resource( $data ) ) { throw new ezcCacheInvalidDataException( gettype( $data ), array( 'scalar', 'array', 'ezcBaseExportable' ) ); } return "<?php\nreturn " . var_export( $data, true ) . ";\n?>\n"; }
php
protected function prepareData( $data ) { if ( ( is_object( $data ) && !( $data instanceof ezcBaseExportable ) ) || is_resource( $data ) ) { throw new ezcCacheInvalidDataException( gettype( $data ), array( 'scalar', 'array', 'ezcBaseExportable' ) ); } return "<?php\nreturn " . var_export( $data, true ) . ";\n?>\n"; }
[ "protected", "function", "prepareData", "(", "$", "data", ")", "{", "if", "(", "(", "is_object", "(", "$", "data", ")", "&&", "!", "(", "$", "data", "instanceof", "ezcBaseExportable", ")", ")", "||", "is_resource", "(", "$", "data", ")", ")", "{", "t...
Serialize the data for storing. Serializes the given $data to a executable PHP code representation string. This works with objects implementing {@link ezcBaseExportable}, arrays and scalar values (int, bool, float, string). The return value is executable PHP code to be stored to disk. The data can be unserialized using the {@link fetchData()} method. @param mixed $data @return string @throws ezcCacheInvalidDataException if the $data can not be serialized (e.g. an object that does not implement ezcBaseExportable, a resource, ...).
[ "Serialize", "the", "data", "for", "storing", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/object.php#L49-L57
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsjs.php
ezjscServerFunctionsJs.makePostArray
protected static function makePostArray( eZHTTPTool $http, $key ) { if ( $http->hasPostVariable( $key ) && $http->postVariable( $key ) !== '' ) { $value = $http->postVariable( $key ); if ( is_array( $value ) ) return $value; elseif( strpos($value, ',') === false ) return array( $value ); else return explode( ',', $value ); } return array(); }
php
protected static function makePostArray( eZHTTPTool $http, $key ) { if ( $http->hasPostVariable( $key ) && $http->postVariable( $key ) !== '' ) { $value = $http->postVariable( $key ); if ( is_array( $value ) ) return $value; elseif( strpos($value, ',') === false ) return array( $value ); else return explode( ',', $value ); } return array(); }
[ "protected", "static", "function", "makePostArray", "(", "eZHTTPTool", "$", "http", ",", "$", "key", ")", "{", "if", "(", "$", "http", "->", "hasPostVariable", "(", "$", "key", ")", "&&", "$", "http", "->", "postVariable", "(", "$", "key", ")", "!==", ...
Creates an array out of a post parameter, return empty array if post parameter is not set. Splits string on ',' in case of comma seperated values. @param eZHTTPTool $http @param string $key @return array
[ "Creates", "an", "array", "out", "of", "a", "post", "parameter", "return", "empty", "array", "if", "post", "parameter", "is", "not", "set", ".", "Splits", "string", "on", "in", "case", "of", "comma", "seperated", "values", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsjs.php#L562-L575
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsjs.php
ezjscServerFunctionsJs.hasPostValue
protected static function hasPostValue( eZHTTPTool $http, $key, $falseValue = '' ) { return $http->hasPostVariable( $key ) && $http->postVariable( $key ) !== $falseValue; }
php
protected static function hasPostValue( eZHTTPTool $http, $key, $falseValue = '' ) { return $http->hasPostVariable( $key ) && $http->postVariable( $key ) !== $falseValue; }
[ "protected", "static", "function", "hasPostValue", "(", "eZHTTPTool", "$", "http", ",", "$", "key", ",", "$", "falseValue", "=", "''", ")", "{", "return", "$", "http", "->", "hasPostVariable", "(", "$", "key", ")", "&&", "$", "http", "->", "postVariable"...
Checks if a post variable exitst and has a value @param eZHTTPTool $http @param string $key @return bool
[ "Checks", "if", "a", "post", "variable", "exitst", "and", "has", "a", "value" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsjs.php#L584-L587
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsjs.php
ezjscServerFunctionsJs.getDesignFile
protected static function getDesignFile( $file ) { static $bases = null; static $wwwDir = null; if ( $bases === null ) $bases = eZTemplateDesignResource::allDesignBases(); if ( $wwwDir === null ) $wwwDir = eZSys::wwwDir() . '/'; $triedFiles = array(); $match = eZTemplateDesignResource::fileMatch( $bases, '', $file, $triedFiles ); if ( $match === false ) { eZDebug::writeWarning( "Could not find: $file", __METHOD__ ); return false; } return $wwwDir . htmlspecialchars( $match['path'] ); }
php
protected static function getDesignFile( $file ) { static $bases = null; static $wwwDir = null; if ( $bases === null ) $bases = eZTemplateDesignResource::allDesignBases(); if ( $wwwDir === null ) $wwwDir = eZSys::wwwDir() . '/'; $triedFiles = array(); $match = eZTemplateDesignResource::fileMatch( $bases, '', $file, $triedFiles ); if ( $match === false ) { eZDebug::writeWarning( "Could not find: $file", __METHOD__ ); return false; } return $wwwDir . htmlspecialchars( $match['path'] ); }
[ "protected", "static", "function", "getDesignFile", "(", "$", "file", ")", "{", "static", "$", "bases", "=", "null", ";", "static", "$", "wwwDir", "=", "null", ";", "if", "(", "$", "bases", "===", "null", ")", "$", "bases", "=", "eZTemplateDesignResource...
Internal function to get current index dir @return string
[ "Internal", "function", "to", "get", "current", "index", "dir" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsjs.php#L629-L646
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.count
public static function count( $def, $conds = null, $field = null ) { if ( !isset( $field ) ) { $field = '*'; } $customFields = array( array( 'operation' => 'COUNT( ' . $field . ' )', 'name' => 'row_count' ) ); $rows = eZPersistentObject::fetchObjectList( $def, array(), $conds, array(), null, false, false, $customFields ); return $rows[0]['row_count']; }
php
public static function count( $def, $conds = null, $field = null ) { if ( !isset( $field ) ) { $field = '*'; } $customFields = array( array( 'operation' => 'COUNT( ' . $field . ' )', 'name' => 'row_count' ) ); $rows = eZPersistentObject::fetchObjectList( $def, array(), $conds, array(), null, false, false, $customFields ); return $rows[0]['row_count']; }
[ "public", "static", "function", "count", "(", "$", "def", ",", "$", "conds", "=", "null", ",", "$", "field", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "field", ")", ")", "{", "$", "field", "=", "'*'", ";", "}", "$", "customField...
Fetches the number of rows by using the object definition. Uses fetchObjectList for the actual SQL handling. See {@link eZPersistentObject::fetchObjectList()} for a full description of the input parameters. @param array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info) @param array|null $conds @param string|null $field @return int
[ "Fetches", "the", "number", "of", "rows", "by", "using", "the", "object", "definition", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L187-L196
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.fetchObject
public static function fetchObject( $def, $field_filters, $conds, $asObject = true, $grouping = null, $custom_fields = null ) { $rows = eZPersistentObject::fetchObjectList( $def, $field_filters, $conds, array(), null, $asObject, $grouping, $custom_fields ); if ( $rows ) return $rows[0]; return null; }
php
public static function fetchObject( $def, $field_filters, $conds, $asObject = true, $grouping = null, $custom_fields = null ) { $rows = eZPersistentObject::fetchObjectList( $def, $field_filters, $conds, array(), null, $asObject, $grouping, $custom_fields ); if ( $rows ) return $rows[0]; return null; }
[ "public", "static", "function", "fetchObject", "(", "$", "def", ",", "$", "field_filters", ",", "$", "conds", ",", "$", "asObject", "=", "true", ",", "$", "grouping", "=", "null", ",", "$", "custom_fields", "=", "null", ")", "{", "$", "rows", "=", "e...
Fetches and returns an object based on the given parameters and returns is either as an object or as an array See {@link eZPersistentObject::fetchObjectList()} for a full description of the input parameters. @param array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info) @param array $field_filters If defined determines the fields which are extracted, if not all fields are fetched @param array $conds An array of conditions which determines which rows are fetched @param bool $asObject If true the returned item is an object otherwise a db row (array). @param array|null $grouping An array of elements to group by @param array $custom_fields|null An array of extra fields to fetch, each field may be a SQL operation @return eZPersistentObject|array|null
[ "Fetches", "and", "returns", "an", "object", "based", "on", "the", "given", "parameters", "and", "returns", "is", "either", "as", "an", "object", "or", "as", "an", "array" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L213-L221
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.newObjectOrder
public static function newObjectOrder( $def, $orderField, $conditions ) { $db = eZDB::instance(); $table = $def["name"]; $keys = $def["keys"]; $cond_text = eZPersistentObject::conditionText( $conditions ); $rows = $db->arrayQuery( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" ); if ( count( $rows ) > 0 and isset( $rows[0][$orderField] ) ) return $rows[0][$orderField] + 1; else return 1; }
php
public static function newObjectOrder( $def, $orderField, $conditions ) { $db = eZDB::instance(); $table = $def["name"]; $keys = $def["keys"]; $cond_text = eZPersistentObject::conditionText( $conditions ); $rows = $db->arrayQuery( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" ); if ( count( $rows ) > 0 and isset( $rows[0][$orderField] ) ) return $rows[0][$orderField] + 1; else return 1; }
[ "public", "static", "function", "newObjectOrder", "(", "$", "def", ",", "$", "orderField", ",", "$", "conditions", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "table", "=", "$", "def", "[", "\"name\"", "]", ";", "$", "ke...
Returns an order value which can be used for new items in table, for instance placement. Uses $def, $orderField and $conditions to figure out the currently maximum order value and returns one that is larger. @param array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info) @param string $orderField @param array $conditions @return int
[ "Returns", "an", "order", "value", "which", "can", "be", "used", "for", "new", "items", "in", "table", "for", "instance", "placement", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L1027-L1039
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.reorderObject
public static function reorderObject( $def, $orderField, $conditions, $down = true ) { $db = eZDB::instance(); $table = $def["name"]; $keys = $def["keys"]; reset( $orderField ); $order_id = key( $orderField ); $order_val = $orderField[$order_id]; if ( $down ) { $order_operator = ">="; $order_type = "asc"; $order_add = -1; } else { $order_operator = "<="; $order_type = "desc"; $order_add = 1; } $fields = array_merge( $keys, array( $order_id ) ); $rows = eZPersistentObject::fetchObjectList( $def, $fields, array_merge( $conditions, array( $order_id => array( $order_operator, $order_val ) ) ), array( $order_id => $order_type ), array( "length" => 2 ), false ); if ( count( $rows ) == 2 ) { $swapSQL1 = eZPersistentObject::swapRow( $table, $keys, $order_id, $rows, 1, 0 ); $swapSQL2 = eZPersistentObject::swapRow( $table, $keys, $order_id, $rows, 0, 1 ); $db->begin(); $db->query( $swapSQL1 ); $db->query( $swapSQL2 ); $db->commit(); } else { $tmp = eZPersistentObject::fetchObjectList( $def, $fields, $conditions, array( $order_id => $order_type ), array( "length" => 1 ), false ); $where_text = eZPersistentObject::conditionTextByRow( $keys, $rows[0] ); $db->query( "UPDATE $table SET $order_id='" . ( $tmp[0][$order_id] + $order_add ) . "'$where_text" ); } }
php
public static function reorderObject( $def, $orderField, $conditions, $down = true ) { $db = eZDB::instance(); $table = $def["name"]; $keys = $def["keys"]; reset( $orderField ); $order_id = key( $orderField ); $order_val = $orderField[$order_id]; if ( $down ) { $order_operator = ">="; $order_type = "asc"; $order_add = -1; } else { $order_operator = "<="; $order_type = "desc"; $order_add = 1; } $fields = array_merge( $keys, array( $order_id ) ); $rows = eZPersistentObject::fetchObjectList( $def, $fields, array_merge( $conditions, array( $order_id => array( $order_operator, $order_val ) ) ), array( $order_id => $order_type ), array( "length" => 2 ), false ); if ( count( $rows ) == 2 ) { $swapSQL1 = eZPersistentObject::swapRow( $table, $keys, $order_id, $rows, 1, 0 ); $swapSQL2 = eZPersistentObject::swapRow( $table, $keys, $order_id, $rows, 0, 1 ); $db->begin(); $db->query( $swapSQL1 ); $db->query( $swapSQL2 ); $db->commit(); } else { $tmp = eZPersistentObject::fetchObjectList( $def, $fields, $conditions, array( $order_id => $order_type ), array( "length" => 1 ), false ); $where_text = eZPersistentObject::conditionTextByRow( $keys, $rows[0] ); $db->query( "UPDATE $table SET $order_id='" . ( $tmp[0][$order_id] + $order_add ) . "'$where_text" ); } }
[ "public", "static", "function", "reorderObject", "(", "$", "def", ",", "$", "orderField", ",", "$", "conditions", ",", "$", "down", "=", "true", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "table", "=", "$", "def", "[", ...
Moves a row in a database table. Uses $orderField to determine the order of objects in a table, usually this is a placement of some kind. It uses this order field to figure out how move the row, the row is either swapped with another row which is either above or below according to whether $down is true or false, or it is swapped with the first item or the last item depending on whether this row is first or last. Uses $conditions to figure out unique rows. Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit. @param array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info) @param array $orderField Associative array with one element, the key is the order id and values is order value. @param array $conditions @param bool $down @return void
[ "Moves", "a", "row", "in", "a", "database", "table", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L1062-L1113
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.updateObjectList
public static function updateObjectList( $parameters ) { $db = eZDB::instance(); $def = $parameters['definition']; $table = $def['name']; $fields = $def['fields']; $keys = $def['keys']; $updateFields = $parameters['update_fields']; $conditions = $parameters['conditions']; $query = "UPDATE $table SET "; $i = 0; $valueBound = false; foreach( $updateFields as $field => $value ) { $fieldDef = $fields[ $field ]; $numericDataTypes = array( 'integer', 'float', 'double' ); if ( strlen( $value ) == 0 && is_array( $fieldDef ) && in_array( $fieldDef['datatype'], $numericDataTypes ) && array_key_exists( 'default', $fieldDef ) && $fieldDef[ 'default' ] !== null ) { $value = $fieldDef[ 'default' ]; } $bindDataTypes = array( 'text' ); if ( $db->bindingType() != eZDBInterface::BINDING_NO && $db->countStringSize( $value ) > 2000 && is_array( $fieldDef ) && in_array( $fieldDef['datatype'], $bindDataTypes ) ) { $value = $db->bindVariable( $value, $fieldDef ); $valueBound = true; } else $valueBound = false; if ( $i > 0 ) $query .= ', '; if ( $valueBound ) $query .= $field . "=" . $value; else $query .= $field . "='" . $db->escapeString( $value ) . "'"; ++$i; } $query .= ' WHERE '; $i = 0; foreach( $conditions as $conditionKey => $condition ) { if ( $i > 0 ) $query .= ' AND '; if ( is_array( $condition ) ) { $query .= $conditionKey . ' IN ('; $j = 0; foreach( $condition as $conditionValue ) { if ( $j > 0 ) $query .= ', '; $query .= "'" . $db->escapeString( $conditionValue ) . "'"; ++$j; } $query .= ')'; } else $query .= $conditionKey . "='" . $db->escapeString( $condition ) . "'"; ++$i; } $db->query( $query ); }
php
public static function updateObjectList( $parameters ) { $db = eZDB::instance(); $def = $parameters['definition']; $table = $def['name']; $fields = $def['fields']; $keys = $def['keys']; $updateFields = $parameters['update_fields']; $conditions = $parameters['conditions']; $query = "UPDATE $table SET "; $i = 0; $valueBound = false; foreach( $updateFields as $field => $value ) { $fieldDef = $fields[ $field ]; $numericDataTypes = array( 'integer', 'float', 'double' ); if ( strlen( $value ) == 0 && is_array( $fieldDef ) && in_array( $fieldDef['datatype'], $numericDataTypes ) && array_key_exists( 'default', $fieldDef ) && $fieldDef[ 'default' ] !== null ) { $value = $fieldDef[ 'default' ]; } $bindDataTypes = array( 'text' ); if ( $db->bindingType() != eZDBInterface::BINDING_NO && $db->countStringSize( $value ) > 2000 && is_array( $fieldDef ) && in_array( $fieldDef['datatype'], $bindDataTypes ) ) { $value = $db->bindVariable( $value, $fieldDef ); $valueBound = true; } else $valueBound = false; if ( $i > 0 ) $query .= ', '; if ( $valueBound ) $query .= $field . "=" . $value; else $query .= $field . "='" . $db->escapeString( $value ) . "'"; ++$i; } $query .= ' WHERE '; $i = 0; foreach( $conditions as $conditionKey => $condition ) { if ( $i > 0 ) $query .= ' AND '; if ( is_array( $condition ) ) { $query .= $conditionKey . ' IN ('; $j = 0; foreach( $condition as $conditionValue ) { if ( $j > 0 ) $query .= ', '; $query .= "'" . $db->escapeString( $conditionValue ) . "'"; ++$j; } $query .= ')'; } else $query .= $conditionKey . "='" . $db->escapeString( $condition ) . "'"; ++$i; } $db->query( $query ); }
[ "public", "static", "function", "updateObjectList", "(", "$", "parameters", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "def", "=", "$", "parameters", "[", "'definition'", "]", ";", "$", "table", "=", "$", "def", "[", "'na...
Updates rows matching the given parameters Note: Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit. @param array $parameters @return void
[ "Updates", "rows", "matching", "the", "given", "parameters" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L1202-L1275
train
ezsystems/ezpublish-legacy
kernel/classes/ezpersistentobject.php
eZPersistentObject.attributes
public function attributes() { $def = $this->definition(); $attrs = array_keys( $def["fields"] ); if ( isset( $def["function_attributes"] ) ) $attrs = array_unique( array_merge( $attrs, array_keys( $def["function_attributes"] ) ) ); if ( isset( $def["functions"] ) ) $attrs = array_unique( array_merge( $attrs, array_keys( $def["functions"] ) ) ); return $attrs; }
php
public function attributes() { $def = $this->definition(); $attrs = array_keys( $def["fields"] ); if ( isset( $def["function_attributes"] ) ) $attrs = array_unique( array_merge( $attrs, array_keys( $def["function_attributes"] ) ) ); if ( isset( $def["functions"] ) ) $attrs = array_unique( array_merge( $attrs, array_keys( $def["functions"] ) ) ); return $attrs; }
[ "public", "function", "attributes", "(", ")", "{", "$", "def", "=", "$", "this", "->", "definition", "(", ")", ";", "$", "attrs", "=", "array_keys", "(", "$", "def", "[", "\"fields\"", "]", ")", ";", "if", "(", "isset", "(", "$", "def", "[", "\"f...
Returns the attributes for this object, taken from the definition fields and function attributes. @see eZPersistentObject::definition() @return array
[ "Returns", "the", "attributes", "for", "this", "object", "taken", "from", "the", "definition", "fields", "and", "function", "attributes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpersistentobject.php#L1285-L1294
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezptopologicalsortnode.php
ezpTopologicalSortNode.registerChild
public function registerChild( ezpTopologicalSortNode $childNode ) { if (! $this->children->contains( $childNode ) ) $this->children->attach( $childNode ); }
php
public function registerChild( ezpTopologicalSortNode $childNode ) { if (! $this->children->contains( $childNode ) ) $this->children->attach( $childNode ); }
[ "public", "function", "registerChild", "(", "ezpTopologicalSortNode", "$", "childNode", ")", "{", "if", "(", "!", "$", "this", "->", "children", "->", "contains", "(", "$", "childNode", ")", ")", "$", "this", "->", "children", "->", "attach", "(", "$", "...
Register a child node. @param ezpTopologicalSortNode $childNode Child node to register
[ "Register", "a", "child", "node", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezptopologicalsortnode.php#L40-L44
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezptopologicalsortnode.php
ezpTopologicalSortNode.registerParent
public function registerParent( ezpTopologicalSortNode $parentNode ) { if (! $this->parents->contains( $parentNode ) ) $this->parents->attach( $parentNode ); }
php
public function registerParent( ezpTopologicalSortNode $parentNode ) { if (! $this->parents->contains( $parentNode ) ) $this->parents->attach( $parentNode ); }
[ "public", "function", "registerParent", "(", "ezpTopologicalSortNode", "$", "parentNode", ")", "{", "if", "(", "!", "$", "this", "->", "parents", "->", "contains", "(", "$", "parentNode", ")", ")", "$", "this", "->", "parents", "->", "attach", "(", "$", ...
Register a parent node. @param ezpTopologicalSortNode $parentNode Parent node to register
[ "Register", "a", "parent", "node", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezptopologicalsortnode.php#L51-L55
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezptopologicalsortnode.php
ezpTopologicalSortNode.popChild
public function popChild() { // Rewind if current iterator is not valid if (! $this->children->valid() ) $this->children->rewind(); // If current iterator is still not valid it means there are no children anymore if (! $this->children->valid() ) return false; $child = $this->children->current(); $this->children->detach( $child ); return $child; }
php
public function popChild() { // Rewind if current iterator is not valid if (! $this->children->valid() ) $this->children->rewind(); // If current iterator is still not valid it means there are no children anymore if (! $this->children->valid() ) return false; $child = $this->children->current(); $this->children->detach( $child ); return $child; }
[ "public", "function", "popChild", "(", ")", "{", "// Rewind if current iterator is not valid", "if", "(", "!", "$", "this", "->", "children", "->", "valid", "(", ")", ")", "$", "this", "->", "children", "->", "rewind", "(", ")", ";", "// If current iterator is...
Pop a child from the list of children. @return ezpTopologicalSortNode|false ezpTopologicalSortNode or false if list is empty
[ "Pop", "a", "child", "from", "the", "list", "of", "children", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezptopologicalsortnode.php#L82-L95
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezuser/ezusertype.php
eZUserType.serializeDraft
public static function serializeDraft( eZUser $user ) { return json_encode( array( 'login' => $user->attribute( 'login' ), 'password_hash' => $user->attribute( 'password_hash' ), 'email' => $user->attribute( 'email' ), 'password_hash_type' => $user->attribute( 'password_hash_type' ) ) ); }
php
public static function serializeDraft( eZUser $user ) { return json_encode( array( 'login' => $user->attribute( 'login' ), 'password_hash' => $user->attribute( 'password_hash' ), 'email' => $user->attribute( 'email' ), 'password_hash_type' => $user->attribute( 'password_hash_type' ) ) ); }
[ "public", "static", "function", "serializeDraft", "(", "eZUser", "$", "user", ")", "{", "return", "json_encode", "(", "array", "(", "'login'", "=>", "$", "user", "->", "attribute", "(", "'login'", ")", ",", "'password_hash'", "=>", "$", "user", "->", "attr...
Generates a serialized draft of the ezuser content @param eZUser $user @return string
[ "Generates", "a", "serialized", "draft", "of", "the", "ezuser", "content" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezuser/ezusertype.php#L304-L314
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexecution.php
eZExecution.defaultExceptionHandler
static public function defaultExceptionHandler( $e ) { if( PHP_SAPI != 'cli' ) { header( 'HTTP/1.x 500 Internal Server Error' ); header( 'Content-Type: text/html' ); echo "An unexpected error has occurred. Please contact the webmaster.<br />"; if( eZDebug::isDebugEnabled() ) { echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(); } } else { $cli = eZCLI::instance(); $cli->error( "An unexpected error has occurred. Please contact the webmaster."); if( eZDebug::isDebugEnabled() ) { $cli->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() ); } } eZLog::write( 'Unexpected error, the message was : ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(), 'error.log' ); eZExecution::cleanup(); eZExecution::setCleanExit(); exit( 1 ); }
php
static public function defaultExceptionHandler( $e ) { if( PHP_SAPI != 'cli' ) { header( 'HTTP/1.x 500 Internal Server Error' ); header( 'Content-Type: text/html' ); echo "An unexpected error has occurred. Please contact the webmaster.<br />"; if( eZDebug::isDebugEnabled() ) { echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(); } } else { $cli = eZCLI::instance(); $cli->error( "An unexpected error has occurred. Please contact the webmaster."); if( eZDebug::isDebugEnabled() ) { $cli->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() ); } } eZLog::write( 'Unexpected error, the message was : ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine(), 'error.log' ); eZExecution::cleanup(); eZExecution::setCleanExit(); exit( 1 ); }
[ "static", "public", "function", "defaultExceptionHandler", "(", "$", "e", ")", "{", "if", "(", "PHP_SAPI", "!=", "'cli'", ")", "{", "header", "(", "'HTTP/1.x 500 Internal Server Error'", ")", ";", "header", "(", "'Content-Type: text/html'", ")", ";", "echo", "\"...
Installs the default Exception handler @params Exception|Throwable the exception @return void
[ "Installs", "the", "default", "Exception", "handler" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexecution.php#L180-L210
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpkerneltreemenu.php
ezpKernelTreeMenu.exitWithInternalError
protected function exitWithInternalError( $errorMessage, $errorCode = 500 ) { if ( eZModule::$useExceptions ) { switch ( $errorCode ) { case 403: throw new ezpAccessDenied( $errorMessage ); case 500: default: throw new RuntimeException( $errorMessage, $errorCode ); } } else { header( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error' ); eZExecution::cleanup(); eZExecution::setCleanExit(); return new ezpKernelResult( json_encode( array( 'error' => $errorMessage, 'code' => $errorCode ) ) ); } }
php
protected function exitWithInternalError( $errorMessage, $errorCode = 500 ) { if ( eZModule::$useExceptions ) { switch ( $errorCode ) { case 403: throw new ezpAccessDenied( $errorMessage ); case 500: default: throw new RuntimeException( $errorMessage, $errorCode ); } } else { header( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error' ); eZExecution::cleanup(); eZExecution::setCleanExit(); return new ezpKernelResult( json_encode( array( 'error' => $errorMessage, 'code' => $errorCode ) ) ); } }
[ "protected", "function", "exitWithInternalError", "(", "$", "errorMessage", ",", "$", "errorCode", "=", "500", ")", "{", "if", "(", "eZModule", "::", "$", "useExceptions", ")", "{", "switch", "(", "$", "errorCode", ")", "{", "case", "403", ":", "throw", ...
Handles an internal error. If not using exceptions, will return an ezpKernelResult object with JSON encoded message. @param string $errorMessage @param int $errorCode @return ezpKernelResult @throws RuntimeException @throws ezpAccessDenied @see setUseExceptions()
[ "Handles", "an", "internal", "error", ".", "If", "not", "using", "exceptions", "will", "return", "an", "ezpKernelResult", "object", "with", "JSON", "encoded", "message", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpkerneltreemenu.php#L341-L370
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpcontentpublishingqueue.php
ezpContentPublishingQueue.initHooks
protected final static function initHooks() { if ( isset( $init ) ) return; static $init = true; $ini = eZINI::instance( 'content.ini' ); self::attachHooks( 'preQueue', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPreQueueHooks' ) ); self::attachHooks( 'postHandling', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPostHandlingHooks' ) ); }
php
protected final static function initHooks() { if ( isset( $init ) ) return; static $init = true; $ini = eZINI::instance( 'content.ini' ); self::attachHooks( 'preQueue', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPreQueueHooks' ) ); self::attachHooks( 'postHandling', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPostHandlingHooks' ) ); }
[ "protected", "final", "static", "function", "initHooks", "(", ")", "{", "if", "(", "isset", "(", "$", "init", ")", ")", "return", ";", "static", "$", "init", "=", "true", ";", "$", "ini", "=", "eZINI", "::", "instance", "(", "'content.ini'", ")", ";"...
Initializes queue hooks from INI settings
[ "Initializes", "queue", "hooks", "from", "INI", "settings" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpcontentpublishingqueue.php#L37-L48
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpcontentpublishingqueue.php
ezpContentPublishingQueue.attachHooks
protected final static function attachHooks( $connector, $hooksList ) { if ( is_array( $hooksList ) && count( $hooksList ) ) { foreach( $hooksList as $hook ) { self::signals()->connect( $connector, $hook ); } } }
php
protected final static function attachHooks( $connector, $hooksList ) { if ( is_array( $hooksList ) && count( $hooksList ) ) { foreach( $hooksList as $hook ) { self::signals()->connect( $connector, $hook ); } } }
[ "protected", "final", "static", "function", "attachHooks", "(", "$", "connector", ",", "$", "hooksList", ")", "{", "if", "(", "is_array", "(", "$", "hooksList", ")", "&&", "count", "(", "$", "hooksList", ")", ")", "{", "foreach", "(", "$", "hooksList", ...
Attaches hooks to a signal slot @param string $connector slot name (preQueue/postQueue) @param array $hooks list of hooks (callbacks) to attach
[ "Attaches", "hooks", "to", "a", "signal", "slot" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpcontentpublishingqueue.php#L61-L70
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpcontentpublishingqueue.php
ezpContentPublishingQueue.add
public static function add( $objectId, $version ) { self::init(); self::signals()->emit( 'preQueue', $version, $objectId ); $processObject = ezpContentPublishingProcess::queue( eZContentObjectVersion::fetchVersion( $version, $objectId ) ); return $processObject; }
php
public static function add( $objectId, $version ) { self::init(); self::signals()->emit( 'preQueue', $version, $objectId ); $processObject = ezpContentPublishingProcess::queue( eZContentObjectVersion::fetchVersion( $version, $objectId ) ); return $processObject; }
[ "public", "static", "function", "add", "(", "$", "objectId", ",", "$", "version", ")", "{", "self", "::", "init", "(", ")", ";", "self", "::", "signals", "(", ")", "->", "emit", "(", "'preQueue'", ",", "$", "version", ",", "$", "objectId", ")", ";"...
Adds a draft to the publishing queue @param int $objectId @param int $version @return ezpContentPublishingProcess
[ "Adds", "a", "draft", "to", "the", "publishing", "queue" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpcontentpublishingqueue.php#L80-L87
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpcontentpublishingqueue.php
ezpContentPublishingQueue.isQueued
public static function isQueued( $objectId, $version ) { $process = ezpContentPublishingProcess::fetchByContentObjectVersion( $objectId, $version ); return ( $process instanceof ezpContentPublishingProcess ); }
php
public static function isQueued( $objectId, $version ) { $process = ezpContentPublishingProcess::fetchByContentObjectVersion( $objectId, $version ); return ( $process instanceof ezpContentPublishingProcess ); }
[ "public", "static", "function", "isQueued", "(", "$", "objectId", ",", "$", "version", ")", "{", "$", "process", "=", "ezpContentPublishingProcess", "::", "fetchByContentObjectVersion", "(", "$", "objectId", ",", "$", "version", ")", ";", "return", "(", "$", ...
Checks if an object exists in the queue, whatever the status is @param int $objectId @param int $version @return bool
[ "Checks", "if", "an", "object", "exists", "in", "the", "queue", "whatever", "the", "status", "is" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpcontentpublishingqueue.php#L95-L99
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpcontentpublishingqueue.php
ezpContentPublishingQueue.getNextItem
private static function getNextItem() { $pendingStatusValue = ezpContentPublishingProcess::STATUS_PENDING; $workingStatusValue = ezpContentPublishingProcess::STATUS_WORKING; $sql = <<< SQL SELECT * FROM ezpublishingqueueprocesses p, ezcontentobject_version v WHERE p.status = $pendingStatusValue AND p.ezcontentobject_version_id = v.id AND v.contentobject_id NOT IN ( SELECT v.contentobject_id FROM ezpublishingqueueprocesses p, ezcontentobject_version v WHERE p.ezcontentobject_version_id = v.id AND p.status = $workingStatusValue ) ORDER BY p.created, p.ezcontentobject_version_id ASC SQL; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql, array( 'offset' => 0, 'limit' => 1 ) ); if ( count( $rows ) == 0 ) return false; /** @var ezpContentPublishingProcess[] $persistentObjects */ $persistentObjects = eZPersistentObject::handleRows( $rows, 'ezpContentPublishingProcess', true ); return $persistentObjects[0]; }
php
private static function getNextItem() { $pendingStatusValue = ezpContentPublishingProcess::STATUS_PENDING; $workingStatusValue = ezpContentPublishingProcess::STATUS_WORKING; $sql = <<< SQL SELECT * FROM ezpublishingqueueprocesses p, ezcontentobject_version v WHERE p.status = $pendingStatusValue AND p.ezcontentobject_version_id = v.id AND v.contentobject_id NOT IN ( SELECT v.contentobject_id FROM ezpublishingqueueprocesses p, ezcontentobject_version v WHERE p.ezcontentobject_version_id = v.id AND p.status = $workingStatusValue ) ORDER BY p.created, p.ezcontentobject_version_id ASC SQL; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql, array( 'offset' => 0, 'limit' => 1 ) ); if ( count( $rows ) == 0 ) return false; /** @var ezpContentPublishingProcess[] $persistentObjects */ $persistentObjects = eZPersistentObject::handleRows( $rows, 'ezpContentPublishingProcess', true ); return $persistentObjects[0]; }
[ "private", "static", "function", "getNextItem", "(", ")", "{", "$", "pendingStatusValue", "=", "ezpContentPublishingProcess", "::", "STATUS_PENDING", ";", "$", "workingStatusValue", "=", "ezpContentPublishingProcess", "::", "STATUS_WORKING", ";", "$", "sql", "=", " <<...
Returns the next queued item, excluding those for which another version of the same content is being published. @return ezpContentPublishingProcess|false
[ "Returns", "the", "next", "queued", "item", "excluding", "those", "for", "which", "another", "version", "of", "the", "same", "content", "is", "being", "published", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpcontentpublishingqueue.php#L120-L150
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/routes/versioned_route.php
ezpRestVersionedRoute.generateUrl
public function generateUrl( array $arguments = null ) { // ezpRestPrefixFilterInterface::getScheme() ==> '/v' $apiPrefix = ezpRestPrefixFilterInterface::getApiPrefix() . '/'; $apiProviderName = ezpRestPrefixFilterInterface::getApiProviderName(); return $apiPrefix . ( !$apiProviderName ? '' : $apiProviderName . '/' ) . 'v' . $this->version . '/' . str_replace( $apiPrefix, '', $this->route->generateUrl( $arguments ) ); }
php
public function generateUrl( array $arguments = null ) { // ezpRestPrefixFilterInterface::getScheme() ==> '/v' $apiPrefix = ezpRestPrefixFilterInterface::getApiPrefix() . '/'; $apiProviderName = ezpRestPrefixFilterInterface::getApiProviderName(); return $apiPrefix . ( !$apiProviderName ? '' : $apiProviderName . '/' ) . 'v' . $this->version . '/' . str_replace( $apiPrefix, '', $this->route->generateUrl( $arguments ) ); }
[ "public", "function", "generateUrl", "(", "array", "$", "arguments", "=", "null", ")", "{", "// ezpRestPrefixFilterInterface::getScheme() ==> '/v'", "$", "apiPrefix", "=", "ezpRestPrefixFilterInterface", "::", "getApiPrefix", "(", ")", ".", "'/'", ";", "$", "apiProvid...
Generates an URL back out of a route, including possible arguments @param array $arguments
[ "Generates", "an", "URL", "back", "out", "of", "a", "route", "including", "possible", "arguments" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/routes/versioned_route.php#L69-L76
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
eZXMLOutputHandler.prefetch
function prefetch() { $relatedObjectIDArray = array(); $nodeIDArray = array(); // Fetch all links and cache urls $linkIDArray = $this->getAttributeValueArray( 'link', 'url_id' ); if ( count( $linkIDArray ) > 0 ) { $inIDSQL = implode( ', ', $linkIDArray ); $db = eZDB::instance(); $linkArray = $db->arrayQuery( "SELECT * FROM ezurl WHERE id IN ( $inIDSQL ) " ); foreach ( $linkArray as $linkRow ) { $url = str_replace( '&', '&amp;', $linkRow['url'] ); $this->LinkArray[$linkRow['id']] = $url; } } $linkRelatedObjectIDArray = $this->getAttributeValueArray( 'link', 'object_id' ); $linkNodeIDArray = $this->getAttributeValueArray( 'link', 'node_id' ); // Fetch all embeded objects and cache by ID $objectRelatedObjectIDArray = $this->getAttributeValueArray( 'object', 'id' ); $embedRelatedObjectIDArray = $this->getAttributeValueArray( 'embed', 'object_id' ); $embedInlineRelatedObjectIDArray = $this->getAttributeValueArray( 'embed-inline', 'object_id' ); $embedNodeIDArray = $this->getAttributeValueArray( 'embed', 'node_id' ); $embedInlineNodeIDArray = $this->getAttributeValueArray( 'embed-inline', 'node_id' ); $relatedObjectIDArray = array_merge( $linkRelatedObjectIDArray, $objectRelatedObjectIDArray, $embedRelatedObjectIDArray, $embedInlineRelatedObjectIDArray ); $relatedObjectIDArray = array_unique( $relatedObjectIDArray ); if ( count( $relatedObjectIDArray ) > 0 ) { if ( $this->ContentObjectAttribute instanceof eZContentObjectAttribute ) { $this->ObjectArray = eZContentObject::fetchIDArray( $relatedObjectIDArray, true, $this->ContentObjectAttribute->attribute( 'language_code' ) ); } else { $this->ObjectArray = eZContentObject::fetchIDArray( $relatedObjectIDArray ); } } $nodeIDArray = array_merge( $linkNodeIDArray, $embedNodeIDArray, $embedInlineNodeIDArray ); $nodeIDArray = array_unique( $nodeIDArray ); if ( count( $nodeIDArray ) > 0 ) { $nodes = eZContentObjectTreeNode::fetch( $nodeIDArray ); if ( is_array( $nodes ) ) { foreach( $nodes as $node ) { $nodeID = $node->attribute( 'node_id' ); $this->NodeArray[$nodeID] = $node; } } elseif ( $nodes ) { $node = $nodes; $nodeID = $node->attribute( 'node_id' ); $this->NodeArray[$nodeID] = $node; } } }
php
function prefetch() { $relatedObjectIDArray = array(); $nodeIDArray = array(); // Fetch all links and cache urls $linkIDArray = $this->getAttributeValueArray( 'link', 'url_id' ); if ( count( $linkIDArray ) > 0 ) { $inIDSQL = implode( ', ', $linkIDArray ); $db = eZDB::instance(); $linkArray = $db->arrayQuery( "SELECT * FROM ezurl WHERE id IN ( $inIDSQL ) " ); foreach ( $linkArray as $linkRow ) { $url = str_replace( '&', '&amp;', $linkRow['url'] ); $this->LinkArray[$linkRow['id']] = $url; } } $linkRelatedObjectIDArray = $this->getAttributeValueArray( 'link', 'object_id' ); $linkNodeIDArray = $this->getAttributeValueArray( 'link', 'node_id' ); // Fetch all embeded objects and cache by ID $objectRelatedObjectIDArray = $this->getAttributeValueArray( 'object', 'id' ); $embedRelatedObjectIDArray = $this->getAttributeValueArray( 'embed', 'object_id' ); $embedInlineRelatedObjectIDArray = $this->getAttributeValueArray( 'embed-inline', 'object_id' ); $embedNodeIDArray = $this->getAttributeValueArray( 'embed', 'node_id' ); $embedInlineNodeIDArray = $this->getAttributeValueArray( 'embed-inline', 'node_id' ); $relatedObjectIDArray = array_merge( $linkRelatedObjectIDArray, $objectRelatedObjectIDArray, $embedRelatedObjectIDArray, $embedInlineRelatedObjectIDArray ); $relatedObjectIDArray = array_unique( $relatedObjectIDArray ); if ( count( $relatedObjectIDArray ) > 0 ) { if ( $this->ContentObjectAttribute instanceof eZContentObjectAttribute ) { $this->ObjectArray = eZContentObject::fetchIDArray( $relatedObjectIDArray, true, $this->ContentObjectAttribute->attribute( 'language_code' ) ); } else { $this->ObjectArray = eZContentObject::fetchIDArray( $relatedObjectIDArray ); } } $nodeIDArray = array_merge( $linkNodeIDArray, $embedNodeIDArray, $embedInlineNodeIDArray ); $nodeIDArray = array_unique( $nodeIDArray ); if ( count( $nodeIDArray ) > 0 ) { $nodes = eZContentObjectTreeNode::fetch( $nodeIDArray ); if ( is_array( $nodes ) ) { foreach( $nodes as $node ) { $nodeID = $node->attribute( 'node_id' ); $this->NodeArray[$nodeID] = $node; } } elseif ( $nodes ) { $node = $nodes; $nodeID = $node->attribute( 'node_id' ); $this->NodeArray[$nodeID] = $node; } } }
[ "function", "prefetch", "(", ")", "{", "$", "relatedObjectIDArray", "=", "array", "(", ")", ";", "$", "nodeIDArray", "=", "array", "(", ")", ";", "// Fetch all links and cache urls", "$", "linkIDArray", "=", "$", "this", "->", "getAttributeValueArray", "(", "'...
Prefetch objects, nodes and urls for further rendering
[ "Prefetch", "objects", "nodes", "and", "urls", "for", "further", "rendering" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php#L207-L288
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
eZXMLOutputHandler.renderAll
function renderAll( $element, $childrenOutput, $vars ) { $tagText = ''; foreach( $childrenOutput as $childOutput ) { $tagText .= $childOutput[1]; } $tagText = $this->renderTag( $element, $tagText, $vars ); return array( false, $tagText ); }
php
function renderAll( $element, $childrenOutput, $vars ) { $tagText = ''; foreach( $childrenOutput as $childOutput ) { $tagText .= $childOutput[1]; } $tagText = $this->renderTag( $element, $tagText, $vars ); return array( false, $tagText ); }
[ "function", "renderAll", "(", "$", "element", ",", "$", "childrenOutput", ",", "$", "vars", ")", "{", "$", "tagText", "=", "''", ";", "foreach", "(", "$", "childrenOutput", "as", "$", "childOutput", ")", "{", "$", "tagText", ".=", "$", "childOutput", "...
Renders all the content of children tags inside the current tag
[ "Renders", "all", "the", "content", "of", "children", "tags", "inside", "the", "current", "tag" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php#L598-L607
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.attribute
function attribute( $name ) { if ( $name === 'is_editor_enabled' ) $attr = self::isEditorEnabled(); else if ( $name === 'can_disable' ) $attr = $this->currentUserHasAccess( 'disable_editor' ); else if ( $name === 'editor_layout_settings' ) $attr = $this->getEditorLayoutSettings(); else if ( $name === 'browser_supports_dhtml_type' ) $attr = self::browserSupportsDHTMLType(); else if ( $name === 'is_compatible_version' ) $attr = $this->isCompatibleVersion(); else if ( $name === 'version' ) $attr = self::version(); else if ( $name === 'ezpublish_version' ) $attr = $this->eZPublishVersion; else if ( $name === 'xml_tag_alias' ) $attr = self::getXmlTagAliasList(); else if ( $name === 'json_xml_tag_alias' ) $attr = json_encode( self::getXmlTagAliasList() ); else $attr = parent::attribute( $name ); return $attr; }
php
function attribute( $name ) { if ( $name === 'is_editor_enabled' ) $attr = self::isEditorEnabled(); else if ( $name === 'can_disable' ) $attr = $this->currentUserHasAccess( 'disable_editor' ); else if ( $name === 'editor_layout_settings' ) $attr = $this->getEditorLayoutSettings(); else if ( $name === 'browser_supports_dhtml_type' ) $attr = self::browserSupportsDHTMLType(); else if ( $name === 'is_compatible_version' ) $attr = $this->isCompatibleVersion(); else if ( $name === 'version' ) $attr = self::version(); else if ( $name === 'ezpublish_version' ) $attr = $this->eZPublishVersion; else if ( $name === 'xml_tag_alias' ) $attr = self::getXmlTagAliasList(); else if ( $name === 'json_xml_tag_alias' ) $attr = json_encode( self::getXmlTagAliasList() ); else $attr = parent::attribute( $name ); return $attr; }
[ "function", "attribute", "(", "$", "name", ")", "{", "if", "(", "$", "name", "===", "'is_editor_enabled'", ")", "$", "attr", "=", "self", "::", "isEditorEnabled", "(", ")", ";", "else", "if", "(", "$", "name", "===", "'can_disable'", ")", "$", "attr", ...
Function used by template system to call ezoe functions @param string $name @return mixed
[ "Function", "used", "by", "template", "system", "to", "call", "ezoe", "functions" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L106-L129
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.browserSupportsDHTMLType
public static function browserSupportsDHTMLType() { if ( self::$browserType === null ) { self::$browserType = false; $userAgent = eZSys::serverVariable( 'HTTP_USER_AGENT' ); // Opera 9.6+ if ( strpos( $userAgent, 'Presto' ) !== false && preg_match('/Presto\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 2.1 ) self::$browserType = 'Presto'; } // IE 8.0+ else if ( strpos( $userAgent, 'Trident' ) !== false && preg_match('/Trident\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 4.0 ) self::$browserType = 'Trident'; } // IE 6 & 7 else if ( strpos( $userAgent, 'MSIE' ) !== false && preg_match('/MSIE[ \/]([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 6.0 ) self::$browserType = 'Trident'; } // Firefox 3+ else if ( strpos( $userAgent, 'Gecko' ) !== false && preg_match('/rv:([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 1.9 ) self::$browserType = 'Gecko'; } // Safari 4+ (and Chrome) else if ( strpos( $userAgent, 'WebKit' ) !== false && strpos( $userAgent, 'Mobile' ) === false && strpos( $userAgent, 'Android' ) === false && strpos( $userAgent, 'iPad' ) === false && strpos( $userAgent, 'iPhone' ) === false && strpos( $userAgent, 'iPod' ) === false && preg_match('/WebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 528.16 ) self::$browserType = 'WebKit'; } // iOS 5+ else if ( strpos( $userAgent, 'AppleWebKit' ) !== false && strpos( $userAgent, 'Mobile' ) !== false && preg_match('/AppleWebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 534.46 ) self::$browserType = 'MobileWebKit'; } if ( self::$browserType === false ) eZDebug::writeNotice( 'Browser not supported: ' . $userAgent, __METHOD__ ); } return self::$browserType; }
php
public static function browserSupportsDHTMLType() { if ( self::$browserType === null ) { self::$browserType = false; $userAgent = eZSys::serverVariable( 'HTTP_USER_AGENT' ); // Opera 9.6+ if ( strpos( $userAgent, 'Presto' ) !== false && preg_match('/Presto\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 2.1 ) self::$browserType = 'Presto'; } // IE 8.0+ else if ( strpos( $userAgent, 'Trident' ) !== false && preg_match('/Trident\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 4.0 ) self::$browserType = 'Trident'; } // IE 6 & 7 else if ( strpos( $userAgent, 'MSIE' ) !== false && preg_match('/MSIE[ \/]([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 6.0 ) self::$browserType = 'Trident'; } // Firefox 3+ else if ( strpos( $userAgent, 'Gecko' ) !== false && preg_match('/rv:([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 1.9 ) self::$browserType = 'Gecko'; } // Safari 4+ (and Chrome) else if ( strpos( $userAgent, 'WebKit' ) !== false && strpos( $userAgent, 'Mobile' ) === false && strpos( $userAgent, 'Android' ) === false && strpos( $userAgent, 'iPad' ) === false && strpos( $userAgent, 'iPhone' ) === false && strpos( $userAgent, 'iPod' ) === false && preg_match('/WebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 528.16 ) self::$browserType = 'WebKit'; } // iOS 5+ else if ( strpos( $userAgent, 'AppleWebKit' ) !== false && strpos( $userAgent, 'Mobile' ) !== false && preg_match('/AppleWebKit\/([0-9\.]+)/i', $userAgent, $browserInfo ) ) { if ( $browserInfo[1] >= 534.46 ) self::$browserType = 'MobileWebKit'; } if ( self::$browserType === false ) eZDebug::writeNotice( 'Browser not supported: ' . $userAgent, __METHOD__ ); } return self::$browserType; }
[ "public", "static", "function", "browserSupportsDHTMLType", "(", ")", "{", "if", "(", "self", "::", "$", "browserType", "===", "null", ")", "{", "self", "::", "$", "browserType", "=", "false", ";", "$", "userAgent", "=", "eZSys", "::", "serverVariable", "(...
browserSupportsDHTMLType Identify supported browser by layout engine using user agent string. @static @return string|false Name of supported layout engine or false
[ "browserSupportsDHTMLType", "Identify", "supported", "browser", "by", "layout", "engine", "using", "user", "agent", "string", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L138-L196
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.getXmlTagAliasList
public static function getXmlTagAliasList() { if ( self::$xmlTagAliasList === null ) { $ezoeIni = eZINI::instance( 'ezoe.ini' ); self::$xmlTagAliasList = $ezoeIni->variable( 'EditorSettings', 'XmlTagNameAlias' ); } return self::$xmlTagAliasList; }
php
public static function getXmlTagAliasList() { if ( self::$xmlTagAliasList === null ) { $ezoeIni = eZINI::instance( 'ezoe.ini' ); self::$xmlTagAliasList = $ezoeIni->variable( 'EditorSettings', 'XmlTagNameAlias' ); } return self::$xmlTagAliasList; }
[ "public", "static", "function", "getXmlTagAliasList", "(", ")", "{", "if", "(", "self", "::", "$", "xmlTagAliasList", "===", "null", ")", "{", "$", "ezoeIni", "=", "eZINI", "::", "instance", "(", "'ezoe.ini'", ")", ";", "self", "::", "$", "xmlTagAliasList"...
getXmlTagAliasList Get and chache XmlTagNameAlias from ezoe.ini @static @return array
[ "getXmlTagAliasList", "Get", "and", "chache", "XmlTagNameAlias", "from", "ezoe", ".", "ini" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L205-L213
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.isValid
function isValid() { if ( !$this->currentUserHasAccess() ) { eZDebug::writeNotice('Current user does not have access to ezoe, falling back to normal xml editor!', __METHOD__ ); return false; } if ( !self::browserSupportsDHTMLType() ) { if ( $this->currentUserHasAccess( 'disable_editor' ) ) { eZDebug::writeNotice('Current browser is not supported by ezoe, falling back to normal xml editor!', __METHOD__ ); return false; } eZDebug::writeWarning('Current browser is not supported by ezoe, but user does not have access to disable editor!', __METHOD__ ); } return true; }
php
function isValid() { if ( !$this->currentUserHasAccess() ) { eZDebug::writeNotice('Current user does not have access to ezoe, falling back to normal xml editor!', __METHOD__ ); return false; } if ( !self::browserSupportsDHTMLType() ) { if ( $this->currentUserHasAccess( 'disable_editor' ) ) { eZDebug::writeNotice('Current browser is not supported by ezoe, falling back to normal xml editor!', __METHOD__ ); return false; } eZDebug::writeWarning('Current browser is not supported by ezoe, but user does not have access to disable editor!', __METHOD__ ); } return true; }
[ "function", "isValid", "(", ")", "{", "if", "(", "!", "$", "this", "->", "currentUserHasAccess", "(", ")", ")", "{", "eZDebug", "::", "writeNotice", "(", "'Current user does not have access to ezoe, falling back to normal xml editor!'", ",", "__METHOD__", ")", ";", ...
isValid Called by handler loading code to see if this is a valid handler. @return bool
[ "isValid", "Called", "by", "handler", "loading", "code", "to", "see", "if", "this", "is", "a", "valid", "handler", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L243-L262
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.customObjectAttributeHTTPAction
function customObjectAttributeHTTPAction( $http, $action, $contentObjectAttribute ) { switch ( $action ) { case 'enable_editor': { self::setIsEditorEnabled( true ); } break; case 'disable_editor': { if ( $this->currentUserHasAccess( 'disable_editor' ) ) self::setIsEditorEnabled( false ); else eZDebug::writeError( 'Current user does not have access to disable editor, but trying anyway!', __METHOD__ ); } break; default : { eZDebug::writeError( 'Unknown custom HTTP action: ' . $action, __METHOD__ ); } break; } }
php
function customObjectAttributeHTTPAction( $http, $action, $contentObjectAttribute ) { switch ( $action ) { case 'enable_editor': { self::setIsEditorEnabled( true ); } break; case 'disable_editor': { if ( $this->currentUserHasAccess( 'disable_editor' ) ) self::setIsEditorEnabled( false ); else eZDebug::writeError( 'Current user does not have access to disable editor, but trying anyway!', __METHOD__ ); } break; default : { eZDebug::writeError( 'Unknown custom HTTP action: ' . $action, __METHOD__ ); } break; } }
[ "function", "customObjectAttributeHTTPAction", "(", "$", "http", ",", "$", "action", ",", "$", "contentObjectAttribute", ")", "{", "switch", "(", "$", "action", ")", "{", "case", "'enable_editor'", ":", "{", "self", "::", "setIsEditorEnabled", "(", "true", ")"...
customObjectAttributeHTTPAction Custom http actions exposed by the editor. @param eZHTTPTool $http @param string $action @param eZContentObjectAttribute $contentObjectAttribute
[ "customObjectAttributeHTTPAction", "Custom", "http", "actions", "exposed", "by", "the", "editor", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L272-L292
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php
eZOEXMLInput.updateUrlObjectLinks
public static function updateUrlObjectLinks( $contentObjectAttribute, $urlIDArray ) { $objectAttributeID = $contentObjectAttribute->attribute( 'id' ); $objectAttributeVersion = $contentObjectAttribute->attribute('version'); foreach( $urlIDArray as $urlID ) { $linkObjectLink = eZURLObjectLink::fetch( $urlID, $objectAttributeID, $objectAttributeVersion ); if ( $linkObjectLink == null ) { $linkObjectLink = eZURLObjectLink::create( $urlID, $objectAttributeID, $objectAttributeVersion ); $linkObjectLink->store(); } } }
php
public static function updateUrlObjectLinks( $contentObjectAttribute, $urlIDArray ) { $objectAttributeID = $contentObjectAttribute->attribute( 'id' ); $objectAttributeVersion = $contentObjectAttribute->attribute('version'); foreach( $urlIDArray as $urlID ) { $linkObjectLink = eZURLObjectLink::fetch( $urlID, $objectAttributeID, $objectAttributeVersion ); if ( $linkObjectLink == null ) { $linkObjectLink = eZURLObjectLink::create( $urlID, $objectAttributeID, $objectAttributeVersion ); $linkObjectLink->store(); } } }
[ "public", "static", "function", "updateUrlObjectLinks", "(", "$", "contentObjectAttribute", ",", "$", "urlIDArray", ")", "{", "$", "objectAttributeID", "=", "$", "contentObjectAttribute", "->", "attribute", "(", "'id'", ")", ";", "$", "objectAttributeVersion", "=", ...
updateUrlObjectLinks Updates URL to object links. @static @param eZContentObjectAttribute $contentObjectAttribute @param array $urlIDArray
[ "updateUrlObjectLinks", "Updates", "URL", "to", "object", "links", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php#L521-L535
train