idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
54,700
public function getEntityManager ( ) { if ( $ this -> getDatasourceNode ( ) == null ) { return ; } $ absolutePaths = array ( ) ; if ( $ relativePaths = $ this -> getStepNode ( ) -> getParam ( AbstractDatabaseStep :: PARAM_PATH_TO_ENTITIES ) ) { foreach ( explode ( PATH_SEPARATOR , $ relativePaths ) as $ relativePath ) ...
Initializes and returns the Doctrine EntityManager instance .
54,701
public function getConnectionParameters ( ) { $ datasourceNode = $ this -> getDatasourceNode ( ) ; $ databaseNode = $ datasourceNode -> getDatabase ( ) ; $ connectionParameters = array ( AbstractDatabaseStep :: CONNECTION_PARAM_DRIVER => $ databaseNode -> getDriver ( ) -> getNodeValue ( ) -> __toString ( ) , AbstractDa...
Initializes an returns an array with the database connection parameters necessary to connect to the database using Doctrine .
54,702
public static function factoryFromScheduleExpression ( ScheduleExpression $ scheduleExpression ) { $ cronExpression = sprintf ( '%s %s %s %s %s %s %s' , $ scheduleExpression -> getSecond ( ) , $ scheduleExpression -> getMinute ( ) , $ scheduleExpression -> getHour ( ) , $ scheduleExpression -> getDayOfMonth ( ) , $ sch...
Additional factory method that creates a new instance from the passed schedule expression .
54,703
public function mapAuthenticator ( $ shortname ) { if ( $ managerNode = $ this -> getAuthenticationContext ( ) -> getManagerConfiguration ( ) ) { foreach ( $ managerNode -> getAuthenticators ( ) as $ authenticatorNode ) { if ( strcasecmp ( $ authenticatorNode -> getName ( ) , $ shortname ) === 0 ) { return $ authentica...
Returns the authenticator class name for the passed shortname .
54,704
public function normalize ( ConfigurationInterface $ configuration ) { $ node = parent :: normalize ( $ configuration ) ; foreach ( $ configuration -> getChildren ( ) as $ child ) { $ node -> { $ configuration -> getNodeName ( ) } -> children [ ] = $ this -> normalize ( $ child ) ; } return $ node ; }
Normalizes the passed configuration node recursive and returns a \ stdClass representation of it .
54,705
public function addMember ( PrincipalInterface $ pricipal ) { $ isMember = $ this -> members -> exists ( $ pricipal -> getName ( ) ) ; if ( $ isMember === false ) { $ this -> members -> add ( $ pricipal -> getName ( ) , $ pricipal ) ; } return $ isMember === false ; }
Adds the passed principal to the group .
54,706
public function removeMember ( PrincipalInterface $ principal ) { if ( $ this -> members -> exists ( $ principal -> getName ( ) ) ) { $ this -> members -> remove ( $ principal -> getName ( ) ) ; return true ; } return false ; }
Removes the passed principal from the group .
54,707
public function isMember ( PrincipalInterface $ principal ) { $ isMember = $ this -> members -> exists ( $ principal -> getName ( ) ) ; if ( $ isMember === false ) { $ isMember = ( $ principal instanceof AnybodyPrincipal ) ; if ( $ isMember === false ) { if ( $ principal instanceof NobodyPrincipal ) { return false ; } ...
Returns TRUE if the passed principal is a member of the group . This method does a recursive search so if a principal belongs to a group which is a member of this group true is returned .
54,708
public static function createPasswordHash ( $ hashAlgorithm , $ hashEncoding , $ hashCharset , String $ name , String $ password , $ callback ) { $ newPassword = clone $ password ; return $ newPassword -> md5 ( ) ; }
Creates and returns a hashed version of the passed password .
54,709
public function init ( ) { $ httpRequest = $ this -> getHttpRequest ( ) ; foreach ( $ httpRequest -> getParts ( ) as $ part ) { $ this -> addPart ( Part :: fromHttpRequest ( $ part ) ) ; } if ( $ httpRequest -> getHeader ( HttpProtocol :: HEADER_CONTENT_LENGTH ) > 0 ) { $ this -> setBodyStream ( $ httpRequest -> getBod...
Initializes the servlet request with the data from the injected HTTP request instance .
54,710
public function prepare ( ) { $ contextPath = str_replace ( $ this -> getContext ( ) -> getAppBase ( ) , '' , $ this -> getContext ( ) -> getWebappPath ( ) ) ; $ this -> setContextPath ( $ contextPath ) ; $ uri = $ this -> getRequestUri ( ) ; $ queryString = $ this -> getQueryString ( ) ; $ uriWithoutQueryString = str_...
Prepares the request instance .
54,711
public function getParameter ( $ name , $ filter = FILTER_SANITIZE_STRING ) { $ parameterMap = $ this -> getParameterMap ( ) ; if ( isset ( $ parameterMap [ $ name ] ) ) { return filter_var ( $ parameterMap [ $ name ] , $ filter ) ; } }
Returns the parameter with the passed name if available or null if the parameter not exists .
54,712
public function addPart ( PartInterface $ part , $ name = null ) { if ( $ name == null ) { $ name = $ part -> getName ( ) ; } $ this -> parts [ $ name ] = $ part ; }
Adds a part to the parts collection .
54,713
public function getProposedSessionId ( ) { $ manager = $ this -> getContext ( ) -> search ( SessionManagerInterface :: IDENTIFIER ) ; if ( $ manager == null ) { return ; } if ( $ this -> getRequestedSessionName ( ) == null ) { $ this -> setRequestedSessionName ( $ manager -> getSessionSettings ( ) -> getSessionName ( )...
Return the session identifier proposed by the actual configuration and request state .
54,714
public function getSession ( $ create = false ) { $ id = $ this -> getProposedSessionId ( ) ; $ sessionName = $ this -> getRequestedSessionName ( ) ; $ manager = $ this -> getSessionManager ( ) ; if ( $ manager == null ) { return ; } $ session = $ manager -> find ( $ id ) ; if ( $ session == null && $ create === true )...
Returns the session for this request .
54,715
public function isUserInRole ( String $ role ) { if ( $ principal = $ this -> getUserPrincipal ( ) ) { return $ principal -> getRoles ( ) -> contains ( $ role ) ; } return false ; }
Return_s a boolean indicating whether the authenticated user is included in the specified logical role .
54,716
public function authenticate ( HttpServletResponseInterface $ servletResponse ) { if ( $ authenticationManager = $ this -> getAuthenticationManager ( ) ) { return $ authenticationManager -> handleRequest ( $ this , $ servletResponse ) ; } return true ; }
Use the container login mechanism configured for the servlet context to authenticate the user making this request . This method may modify and commit the passed servlet response .
54,717
public function login ( String $ username , String $ password ) { if ( $ this -> getAuthType ( ) != null || $ this -> getRemoteUser ( ) != null || $ this -> getUserPrincipal ( ) != null ) { throw new ServletException ( 'Already authenticated' ) ; } if ( $ authenticationManager = $ this -> getAuthenticationManager ( ) )...
Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext .
54,718
public function logout ( ) { if ( $ authenticationManager = $ this -> getAuthenticationManager ( ) ) { if ( ( $ authenticator = $ authenticationManager -> getAuthenticator ( ) ) == null ) { throw new ServletException ( 'Can\'t find default authenticator' ) ; } $ authenticator -> logout ( $ this ) ; } }
Establish null as the value returned when getUserPrincipal getRemoteUser and getAuthType is called on the request .
54,719
public function add ( $ key , $ object , $ lifetime = 0 ) { if ( is_null ( $ key ) ) { throw new NullPointerException ( 'Passed key is null' ) ; } if ( is_integer ( $ lifetime ) === false ) { throw new InvalidLifetimeException ( sprintf ( 'Passed lifetime must be an integer, but is %s instead' , $ lifetime ) ) ; } if (...
This method adds the passed object with the passed key to the instance .
54,720
public function get ( $ key ) { if ( is_null ( $ key ) ) { throw new NullPointerException ( 'Passed key is null' ) ; } if ( is_integer ( $ key ) || is_string ( $ key ) || is_double ( $ key ) || is_bool ( $ key ) ) { if ( array_key_exists ( $ key , $ this -> items ) && ! $ this -> isTimedOut ( $ key ) ) { return $ this ...
This method returns the element with the passed key from the Collection .
54,721
public function remove ( $ key , callable $ beforeRemove = null ) { if ( is_null ( $ key ) ) { throw new NullPointerException ( 'Passed key is null' ) ; } if ( is_integer ( $ key ) || is_string ( $ key ) || is_double ( $ key ) || is_bool ( $ key ) ) { if ( array_key_exists ( $ key , $ this -> items ) ) { if ( is_callab...
This method removes the element with the passed key that has to be an integer from the IndexedCollection .
54,722
public function isTimedOut ( $ key ) { if ( array_key_exists ( $ key , $ this -> lifetime ) && $ this -> lifetime [ $ key ] < time ( ) ) { return true ; } return false ; }
Returns TRUE if an lifetime value for the passed key is available and the item has timed out .
54,723
public function shutdown ( ) { if ( $ lastError = error_get_last ( ) ) { $ type = 0 ; $ message = '' ; extract ( $ lastError ) ; if ( $ type === E_ERROR || $ type === E_USER_ERROR ) { $ this -> log ( LogLevel :: ERROR , $ message ) ; } } }
The shutdown method implementation .
54,724
protected function getUsersPassword ( ) { try { $ application = RequestHandler :: getApplicationContext ( ) ; return new String ( $ application -> search ( sprintf ( '%s/%s' , $ this -> userPathPrefix , $ this -> getUsername ( ) ) ) ) ; } catch ( \ Exception $ e ) { throw new LoginException ( 'No matching username foun...
Returns the password for the user from the naming directory .
54,725
public function registerReferences ( DescriptorInterface $ descriptor ) { foreach ( $ descriptor -> getEpbReferences ( ) as $ epbReference ) { $ this -> registerEpbReference ( $ epbReference ) ; } foreach ( $ descriptor -> getResReferences ( ) as $ resReference ) { $ this -> registerResReference ( $ resReference ) ; } ...
Register s the references of the passed descriptor .
54,726
public function registerEpbReference ( EpbReferenceDescriptorInterface $ epbReference ) { try { $ application = $ this -> getApplication ( ) ; $ name = $ epbReference -> getRefName ( ) ; $ uri = sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ name ) ; if ( $ application -> getNamingDirectory ( ) -...
Registers the passed EPB reference in the applications directory .
54,727
public function registerResReference ( ResReferenceDescriptorInterface $ resReference ) { try { $ application = $ this -> getApplication ( ) ; $ uri = sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ resReference -> getRefName ( ) ) ; if ( $ application -> getNamingDirectory ( ) -> isBound ( $ uri ...
Registers the passed resource reference in the applications directory .
54,728
public function registerBeanReference ( BeanReferenceDescriptorInterface $ beanReference ) { try { $ application = $ this -> getApplication ( ) ; $ uri = sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ beanReference -> getRefName ( ) ) ; if ( $ application -> getNamingDirectory ( ) -> isBound ( $ ...
Registers the passed bean reference in the applications directory .
54,729
public function registerPersistenceUnitReference ( PersistenceUnitReferenceDescriptorInterface $ persistenceUnitReference ) { try { $ application = $ this -> getApplication ( ) ; $ uri = sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ persistenceUnitReference -> getRefName ( ) ) ; if ( $ applicati...
Registers the passed persistence unit reference in the applications directory .
54,730
public function lookupProxy ( $ lookupName ) { $ initialContext = $ this -> getInitialContext ( ) ; if ( $ servletRequest = RequestHandler :: getRequestContext ( ) ) { $ initialContext -> injectServletRequest ( $ servletRequest ) ; } return $ initialContext -> lookup ( $ lookupName ) ; }
This returns a proxy to the requested session bean . If the proxy has already been instanciated for the actual request the existing instance will be returned .
54,731
public function lookupLocalProxy ( $ lookupName ) { $ beanName = str_replace ( '/local' , '' , $ lookupName ) ; $ application = $ this -> getApplication ( ) ; $ beanManager = $ application -> search ( BeanContextInterface :: IDENTIFIER ) ; $ objectManager = $ application -> search ( ObjectManagerInterface :: IDENTIFIER...
This returns a local proxy to the requested session bean .
54,732
public function execute ( ) { $ descriptor = $ this -> descriptor ; $ application = $ this -> application ; if ( $ descriptor instanceof SingletonSessionBeanDescriptorInterface && $ descriptor -> isInitOnStartup ( ) ) { $ application -> search ( $ descriptor -> getName ( ) ) ; } }
This method is the threads main method that ll be invoked once and has to provide the threads business logic .
54,733
public function getContext ( $ name ) { foreach ( $ this -> getContexts ( ) as $ context ) { if ( $ context -> getName ( ) === $ name ) { return $ context ; } } }
Returns the context with the passed name .
54,734
public function getHeadersAsArray ( ) { $ headers = array ( ) ; foreach ( $ this -> getHeaders ( ) as $ headerNode ) { $ header = array ( 'type' => $ headerNode -> getType ( ) , 'name' => $ headerNode -> getName ( ) , 'value' => $ headerNode -> getValue ( ) , 'uri' => $ headerNode -> getUri ( ) , 'override' => $ header...
Returns the headers as an associative array .
54,735
public function getBaseDirectory ( $ directoryToAppend = null ) { $ baseDirectory = $ this -> getNamingDirectory ( ) -> search ( 'php:env/baseDirectory' ) ; if ( $ directoryToAppend != null ) { $ baseDirectory .= $ directoryToAppend ; } return $ baseDirectory ; }
Returns the absolute path to the servers document root directory
54,736
public function getSystemProperties ( ) { $ service = $ this -> newService ( ConfigurationService :: class ) ; $ systemProperties = $ service -> getSystemProperties ( $ this -> getContainer ( ) -> getContainerNode ( ) ) ; $ systemProperties -> add ( SystemPropertyKeys :: WEBAPP , $ webappPath = $ this -> getWebappPath ...
Return s the system properties enriched with the application specific properties like webapp . dir etc .
54,737
public function getLogger ( $ name = LoggerUtils :: SYSTEM_LOGGER ) { if ( isset ( $ this -> loggers [ $ name ] ) ) { return $ this -> loggers [ $ name ] ; } return null ; }
Return the requested logger instance by default the application s system logger .
54,738
public function addClassLoader ( ClassLoaderInterface $ classLoader , ClassLoaderNodeInterface $ configuration ) { $ this -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%s' , $ this -> getUniqueName ( ) , $ configuration -> getName ( ) ) , array ( & $ this , 'getClassLoader' ) , array ( $ configuration ->...
Injects an additional class loader .
54,739
public function addManager ( ManagerInterface $ manager , ManagerNodeInterface $ configuration ) { $ this -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%s' , $ this -> getUniqueName ( ) , $ configuration -> getName ( ) ) , array ( & $ this , 'getManager' ) , array ( $ configuration -> getName ( ) ) ) ; $...
Injects manager instance and the configuration .
54,740
public function addProvisioner ( ProvisionerInterface $ provisioner , ProvisionerConfigurationInterface $ configuration ) { $ this -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%s' , $ this -> getUniqueName ( ) , $ configuration -> getName ( ) ) , array ( & $ this , 'getProvisioner' ) , array ( $ configu...
Injects the provisioner instance and the configuration .
54,741
public function addLogger ( LoggerInterface $ logger , LoggerNodeInterface $ configuration ) { $ this -> getNamingDirectory ( ) -> bind ( $ name = sprintf ( 'php:global/log/%s/%s' , $ this -> getUniqueName ( ) , $ configuration -> getName ( ) ) , array ( & $ this , 'getLogger' ) , array ( $ configuration -> getName ( )...
Injects the logger instance and the configuration .
54,742
public function prepare ( ContainerInterface $ container , ContextNode $ contextNode ) { $ this -> contextNode = $ contextNode ; $ uniqueName = $ this -> getUniqueName ( ) ; $ namingDirectory = $ this -> getNamingDirectory ( ) ; $ namingDirectory -> createSubdirectory ( sprintf ( 'php:global/%s' , $ uniqueName ) ) ; $ ...
Prepares the application with the specific data found in the passed context node .
54,743
public function unload ( ) { $ uniqueName = $ this -> getUniqueName ( ) ; $ namingDirectory = $ this -> getNamingDirectory ( ) ; $ namingDirectory -> unbind ( sprintf ( 'php:env/%s/webappPath' , $ uniqueName ) ) ; $ namingDirectory -> unbind ( sprintf ( 'php:env/%s/tmpDirectory' , $ uniqueName ) ) ; $ namingDirectory -...
Cleanup the naming directory from the application entries .
54,744
public function isConnected ( ) { return $ this -> synchronized ( function ( $ self ) { return $ self -> applicationState -> equals ( ApplicationStateKeys :: get ( ApplicationStateKeys :: INITIALIZATION_SUCCESSFUL ) ) ; } , $ this ) ; }
TRUE if the application has been connected else FALSE .
54,745
public function registerClassLoaders ( ) { foreach ( $ this -> getClassLoaders ( ) as $ classLoader ) { $ this -> getInitialContext ( ) -> getSystemLogger ( ) -> debug ( sprintf ( 'Now register classloader %s for application %s' , get_class ( $ classLoader ) , $ this -> getName ( ) ) ) ; $ classLoader -> register ( tru...
Registers all class loaders injected to the applications in the opposite order as they have been injected .
54,746
public function registerAnnotationRegistries ( ) { AnnotationRegistry :: reset ( ) ; foreach ( $ this -> getContextNode ( ) -> getAnnotationRegistries ( ) as $ annotationRegistry ) { $ annotationRegistryType = $ annotationRegistry -> getType ( ) ; $ registry = new $ annotationRegistryType ( ) ; $ registry -> register (...
Registers additional annotation registries defined in the configuration .
54,747
public function registerEnvironment ( ) { Environment :: singleton ( ) -> setAttribute ( EnvironmentKeys :: APPLICATION , $ this ) ; Environment :: singleton ( ) -> setAttribute ( EnvironmentKeys :: SESSION_ID , $ sessionId = SessionUtils :: generateRandomString ( ) ) ; Environment :: singleton ( ) -> setAttribute ( En...
Registers the the application in the environment .
54,748
public function provision ( ) { foreach ( $ this -> getProvisioners ( ) as $ provisioner ) { \ debug ( sprintf ( 'Now invoking provisioner %s for application %s' , get_class ( $ provisioner ) , $ this -> getName ( ) ) ) ; $ provisioner -> provision ( $ this ) ; \ debug ( sprintf ( 'Successfully invoked provisioner %s f...
Provisions the initialized application .
54,749
public function initializeManagers ( ) { foreach ( $ this -> getManagers ( ) as $ manager ) { \ debug ( sprintf ( 'Now register manager %s for application %s' , get_class ( $ manager ) , $ this -> getName ( ) ) ) ; $ manager -> initialize ( $ this ) ; \ debug ( sprintf ( 'Now registered manager %s for application %s' ,...
Registers all managers in the application .
54,750
public function stop ( ) { $ this -> synchronized ( function ( $ self ) { $ self -> applicationState = ApplicationStateKeys :: get ( ApplicationStateKeys :: HALT ) ; } , $ this ) ; do { \ info ( sprintf ( 'Wait for application %s to be shutdown' , $ this -> getName ( ) ) ) ; $ waitForShutdown = $ this -> synchronized (...
Stops the application instance .
54,751
public function shutdown ( ) { if ( $ lastError = error_get_last ( ) ) { $ type = 0 ; $ message = '' ; extract ( $ lastError ) ; if ( $ type === E_ERROR || $ type === E_USER_ERROR ) { LoggerUtils :: log ( LogLevel :: CRITICAL , $ message ) ; } } }
Shutdown function to log unexpected errors .
54,752
protected function createPrincipal ( String $ username , Subject $ subject , LoginContextInterface $ loginContext ) { $ roles = new ArrayList ( ) ; $ userPrincipal = null ; foreach ( $ subject -> getPrincipals ( ) as $ principal ) { if ( $ principal instanceof GroupInterface && $ principal -> getName ( ) -> equals ( ne...
Identify and return an instance implementing the PrincipalInterface that represens the authenticated user for the specified Subject . The Principal is constructed by scanning the list of Principals returned by the LoginModule . The first Principal object that matches one of the class names supplied as a user class is t...
54,753
protected function initExtensionType ( ) { $ class = '' ; if ( ! class_exists ( $ class = $ this -> extensionType ) && ! class_exists ( $ class = strstr ( $ this -> extensionType , '(' , true ) ) ) { throw new \ Exception ( 'Unknown injector class ' . $ class ) ; } $ parameters = array ( ) ; preg_match ( '`\((.+)\)`' ,...
Will init the injector from the given extensionType
54,754
public static function cleanUpDir ( \ SplFileInfo $ dir , $ alsoRemoveFiles = true ) { if ( $ dir -> isDir ( ) === false ) { return ; } $ files = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ dir -> getPathname ( ) ) , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ files as $ file )...
Deletes all files and subdirectories from the passed directory .
54,755
public static function copyDir ( $ src , $ dst ) { if ( is_link ( $ src ) ) { symlink ( readlink ( $ src ) , $ dst ) ; } elseif ( is_dir ( $ src ) ) { if ( is_dir ( $ dst ) === false ) { mkdir ( $ dst , 0775 , true ) ; } foreach ( scandir ( $ src ) as $ file ) { if ( $ file != '.' && $ file != '..' ) { FileSystem :: co...
Copies a directory recursively .
54,756
public static function createDirectory ( $ directoryToCreate , $ mode = 0775 , $ recursive = false ) { if ( is_dir ( $ directoryToCreate ) === false ) { if ( mkdir ( $ directoryToCreate , $ mode , $ recursive ) === false ) { throw new \ Exception ( sprintf ( 'Directory %s can\'t be created' , $ directoryToCreate ) ) ; ...
Creates the passed directory .
54,757
public static function recursiveChown ( $ path , $ user , $ group = null ) { if ( FileSystem :: getOsIdentifier ( ) === self :: OS_IDENTIFIER_WIN ) { return ; } if ( is_dir ( $ path ) === false ) { return ; } $ files = FileSystem :: globDir ( $ path . '/*' ) ; if ( empty ( $ user ) === false ) { foreach ( $ files as $ ...
Will set the owner and group on the passed directory .
54,758
public static function recursiveChmod ( $ path , $ filePerm = 0644 , $ dirPerm = 0755 ) { if ( FileSystem :: getOsIdentifier ( ) === self :: OS_IDENTIFIER_WIN ) { return ; } if ( is_dir ( $ path ) === false ) { return false ; } $ files = FileSystem :: globDir ( $ path . '/*' ) ; foreach ( $ files as $ file ) { if ( is_...
Chmods files and folders with different permissions .
54,759
public function init ( $ id , $ name , $ lifetime , $ maximumAge , $ domain , $ path , $ secure , $ httpOnly , $ lastActivityTimestamp = null ) { $ this -> id = $ id ; $ this -> name = $ name ; $ this -> lifetime = $ lifetime ; $ this -> maximumAge = $ maximumAge ; $ this -> domain = $ domain ; $ this -> path = $ path ...
Initializes the session with the passed data .
54,760
public function checksum ( ) { $ checksumData = array ( $ this -> started , $ this -> id , $ this -> name , $ this -> data ) ; return md5 ( json_encode ( $ checksumData ) ) ; }
Returns the checksum for this session instance .
54,761
public static function emptyInstance ( ) { $ id = null ; $ name = 'empty' ; $ lifetime = - 1 ; $ maximumAge = - 1 ; $ domain = '' ; $ path = '' ; $ secure = false ; $ httpOnly = false ; return new Session ( $ id , $ name , $ lifetime , $ maximumAge , $ domain , $ path , $ secure , $ httpOnly ) ; }
Creates a new and empty session instance .
54,762
public function destroy ( $ reason ) { $ this -> id = null ; $ this -> lifetime = 0 ; $ this -> lastActivityTimestamp = 0 ; $ this -> maximumAge = - 1 ; }
Explicitly destroys all session data .
54,763
public function init ( ) { $ this -> service = $ this -> newService ( 'AppserverIo\Appserver\Core\Api\ContainerService' ) ; $ this -> distroMapping = array ( "Arch" => "arch-release" , "Debian" => "debian_version" , "Fedora" => "fedora-release" , "Ubuntu" => "lsb-release" , 'Redhat' => 'redhat-release' , 'CentOS' => 'c...
Initalizes the scanner with the necessary service instance .
54,764
public function getRestartCommand ( $ os , $ distVersion = null ) { if ( array_key_exists ( $ os , $ this -> restartCommands ) ) { $ command = $ this -> restartCommands [ $ os ] ; if ( is_array ( $ command ) ) { if ( ! is_null ( $ distVersion ) ) { $ distVersion = ( int ) floor ( ( float ) $ distVersion ) ; foreach ( $...
Returns the restart command for the passed OS if available .
54,765
public function restart ( ) { $ os = php_uname ( 's' ) ; $ this -> getSystemLogger ( ) -> debug ( "Found operating system: $os" ) ; switch ( $ os ) { case DeploymentScanner :: LINUX : $ distribution = $ this -> getLinuxDistribution ( ) ; if ( ! $ distribution ) { $ this -> getSystemLogger ( ) -> error ( "The used Linux...
Restart the appserver using the appserverctl file in the sbin folder .
54,766
protected function getLastFileTouch ( $ file ) { $ mtime = 0 ; clearstatcache ( ) ; if ( is_file ( $ file ) ) { $ mtime = filemtime ( $ file ) ; } return $ mtime ; }
Returns the time when the contents of the file were changed . The time returned is a UNIX timestamp .
54,767
public function getReflectionClass ( $ className ) { if ( isset ( $ this -> reflectionClasses [ $ className ] ) === false ) { $ this -> reflectionClasses [ $ className ] = $ this -> newReflectionClass ( $ className ) ; } return $ this -> reflectionClasses [ $ className ] ; }
Returns a new reflection class intance for the passed class name .
54,768
public function loadDependencies ( NameAwareDescriptorInterface $ objectDescriptor ) { if ( $ objectDescriptor instanceof \ AppserverIo \ Description \ FactoryDescriptor ) { throw new \ Exception ( print_r ( $ objectDescriptor , true ) ) ; } if ( isset ( $ this -> dependencies [ $ name = $ objectDescriptor -> getName (...
Loads the dependencies for the passed object descriptor .
54,769
public function loadDependency ( ReferenceDescriptorInterface $ referenceDescriptor ) { $ sessionId = Environment :: singleton ( ) -> getAttribute ( EnvironmentKeys :: SESSION_ID ) ; $ lookupName = sprintf ( 'php:global/%s/%s' , $ this -> getApplication ( ) -> getUniqueName ( ) , $ referenceDescriptor -> getRefName ( )...
Load s and return s the dependency instance for the passed reference .
54,770
public function loadDependenciesByReflectionMethod ( ReflectionMethod $ reflectionMethod ) { $ dependencies = array ( ) ; $ objectManager = $ this -> getNamingDirectory ( ) -> search ( sprintf ( 'php:global/%s/%s' , $ this -> getApplication ( ) -> getUniqueName ( ) , ObjectManagerInterface :: IDENTIFIER ) ) ; foreach (...
Loads the dependencies for the passed reflection method .
54,771
public function loadDependenciesByMethodInvocation ( MethodInvocationDescriptorInterface $ descriptor ) { $ dependencies = array ( ) ; foreach ( $ descriptor -> getArguments ( ) as $ argument ) { $ dependencies [ ] = $ this -> get ( ( string ) $ argument ) ; } return $ dependencies ; }
Loads the dependencies for the passed method invocation descriptor .
54,772
public function createInstance ( NameAwareDescriptorInterface $ objectDescriptor ) { $ reflectionClass = $ this -> getReflectionClass ( $ objectDescriptor -> getClassName ( ) ) ; $ dependencies = $ this -> loadDependencies ( $ objectDescriptor ) ; if ( $ reflectionClass -> hasMethod ( $ methodName = '__construct' ) && ...
Creates a new instance with the dependencies defined by the passed descriptor .
54,773
public function injectDependencies ( DescriptorInterface $ objectDescriptor , $ instance ) { $ reflectionClass = $ this -> getReflectionClass ( $ objectDescriptor -> getClassName ( ) ) ; $ dependencies = $ this -> loadDependencies ( $ objectDescriptor ) ; foreach ( $ dependencies [ 'method' ] as $ methodName => $ toInj...
Injects the dependencies of the passed instance defined in the object descriptor .
54,774
public function has ( $ id ) { $ objectManager = $ this -> getNamingDirectory ( ) -> search ( sprintf ( 'php:global/%s/%s' , $ this -> getApplication ( ) -> getUniqueName ( ) , ObjectManagerInterface :: IDENTIFIER ) ) ; return class_exists ( $ id ) || $ objectManager -> hasObjectDescriptor ( $ id ) || Environment :: si...
Returns TRUE if the container can return an entry for the given identifier . Returns FALSE otherwise .
54,775
public function initFromApplication ( ApplicationInterface $ application ) { $ this -> setNodeName ( self :: NODE_NAME ) ; $ this -> name = $ application -> getName ( ) ; $ this -> webappPath = $ application -> getWebappPath ( ) ; $ this -> setUuid ( $ this -> newUuid ( ) ) ; }
Will initialize an existing app node from a given application
54,776
public function generate ( DescriptorInterface $ descriptor ) { ob_start ( ) ; require __DIR__ . DIRECTORY_SEPARATOR . 'Proxy' . DIRECTORY_SEPARATOR . 'RemoteProxy.dhtml' ; $ content = ob_get_clean ( ) ; $ filename = sprintf ( '%s/%s' , $ this -> getApplication ( ) -> getCacheDir ( ) , $ this -> generateRemoteProxyFile...
Generate s a RMI proxy based on the passe descriptor information and registers it in the naming directory .
54,777
protected function generateMethodSignature ( \ ReflectionMethod $ reflectionMethod ) { $ params = array ( ) ; foreach ( $ reflectionMethod -> getParameters ( ) as $ reflectionParameter ) { $ param = '' ; if ( $ typeHint = $ reflectionParameter -> getClass ( ) ) { $ param .= sprintf ( '\%s ' , $ typeHint -> getName ( ) ...
Generates the method signature based on the passed reflection method .
54,778
protected function generateImplements ( \ ReflectionClass $ reflectionClass ) { $ interfaces = $ reflectionClass -> getInterfaces ( ) ; $ generateInterfaces = array ( ) ; foreach ( $ interfaces as $ interfaceName => $ interface ) { foreach ( $ generateInterfaces as $ obj ) { if ( $ obj -> isSubclassOf ( $ interface ) )...
Generate the implements part of the class definition .
54,779
public function getAuthenticator ( MappingInterface $ mapping = null ) { if ( $ mapping != null ) { if ( isset ( $ this -> authenticators [ $ authenticatorSerial = $ mapping -> getAuthenticatorSerial ( ) ] ) ) { return $ this -> authenticators [ $ authenticatorSerial ] ; } throw new AuthenticationException ( sprintf ( ...
Returns the configured authenticator for the passed URL pattern authenticator mapping .
54,780
public function handleRequest ( HttpServletRequestInterface $ servletRequest , HttpServletResponseInterface $ servletResponse ) { $ authenticated = true ; foreach ( $ this -> getMappings ( ) as $ mapping ) { if ( $ mapping -> match ( $ servletRequest ) ) { if ( in_array ( $ servletRequest -> getMethod ( ) , $ mapping -...
Handles request in order to authenticate .
54,781
public function initialize ( ApplicationInterface $ application ) { if ( is_dir ( $ this -> getWebappPath ( ) ) === false ) { return ; } $ realms = new HashMap ( ) ; if ( $ managerNode = $ this -> getManagerConfiguration ( ) ) { foreach ( $ this -> getManagerConfiguration ( ) -> getSecurityDomains ( ) as $ securityDoma...
Initializes the manager instance .
54,782
public function getEnvironmentVariable ( $ definition ) { foreach ( $ this -> getEnvironmentVariables ( ) as $ environmentVariableNode ) { if ( $ environmentVariableNode -> getDefinition ( ) === $ definition ) { return $ environmentVariableNode ; } } return false ; }
Will return the environmentVariable node with the specified definition and if nothing could be found we will return false .
54,783
public function getEnvironmentVariablesAsArray ( ) { $ environmentVariables = array ( ) ; foreach ( $ this -> getEnvironmentVariables ( ) as $ environmentVariableNode ) { $ environmentVariables [ ] = array ( 'condition' => $ environmentVariableNode -> getCondition ( ) , 'definition' => $ environmentVariableNode -> getD...
Returns the environmentVariables as an associative array .
54,784
public static function factory ( $ loggerNode ) { $ processors = array ( ) ; foreach ( $ loggerNode -> getProcessors ( ) as $ processorNode ) { $ reflectionClass = new \ ReflectionClass ( $ processorNode -> getType ( ) ) ; $ processors [ ] = $ reflectionClass -> newInstanceArgs ( $ processorNode -> getParamsAsArray ( )...
Creates a new logger instance based on the passed logger configuration .
54,785
public function delete ( $ id ) { $ filename = $ this -> getSessionSettings ( ) -> getSessionFilePrefix ( ) . $ id ; $ pathname = $ this -> getSessionSavePath ( $ filename ) ; if ( $ this -> removeSessionFile ( $ pathname ) === false ) { throw new SessionCanNotBeDeletedException ( sprintf ( 'Session with ID %s can not ...
Deletes the session with the passed ID from the persistence layer .
54,786
protected function unpersist ( $ pathname ) { if ( $ this -> sessionFileExists ( $ pathname ) === false ) { return ; } $ marshalled = null ; $ fh = fopen ( $ pathname , 'r' ) ; if ( flock ( $ fh , LOCK_EX ) === false ) { throw new SessionDataNotReadableException ( sprintf ( 'Can\'t get lock to load session data from fi...
Tries to load the session data from the passed filename .
54,787
protected function getSessionSavePath ( $ toAppend = null ) { $ sessionSavePath = $ this -> getSessionSettings ( ) -> getSessionSavePath ( ) ; if ( $ toAppend != null ) { $ sessionSavePath = $ sessionSavePath . DIRECTORY_SEPARATOR . $ toAppend ; } return $ sessionSavePath ; }
Returns the default path to persist sessions .
54,788
public function getVirtualHostsAsArray ( ) { $ virtualHosts = array ( ) ; foreach ( $ this -> getVirtualHosts ( ) as $ virtualHost ) { $ virtualHostNames = explode ( ' ' , $ virtualHost -> getName ( ) ) ; if ( $ virtualHost -> hasInjector ( ) ) { $ virtualHostNames = array_merge ( $ virtualHostNames , explode ( ' ' , $...
Returns the virtual hosts as an associative array
54,789
public function bind ( $ name , $ value , array $ args = array ( ) ) { try { $ key = $ this -> stripSchema ( $ name ) ; if ( $ this -> hasAttribute ( $ key ) === false ) { $ this -> setAttribute ( $ key , array ( $ value , $ args ) ) ; return ; } throw new \ Exception ( sprintf ( 'A value with name %s has already been ...
Binds the passed instance with the name to the naming directory .
54,790
public function unbind ( $ name ) { try { $ key = $ this -> stripSchema ( $ name ) ; $ this -> removeAttribute ( $ key ) ; } catch ( \ Exception $ e ) { throw new NamingException ( sprintf ( 'Cant\'t unbind %s from naming directory %s' , $ name , $ this -> getIdentifier ( ) ) , null , $ e ) ; } }
Unbinds the named object from the naming directory .
54,791
public function getIdentifier ( ) { if ( $ parent = $ this -> getParent ( ) ) { return $ parent -> getIdentifier ( ) . $ this -> getName ( ) . '/' ; } if ( $ scheme = $ this -> getScheme ( ) ) { return $ scheme . ':' . $ this -> getName ( ) ; } throw new NamingException ( sprintf ( 'Missing scheme for naming directory'...
The unique identifier of this directory . That ll be build up recursive from the scheme and the root directory .
54,792
public function createSubdirectory ( $ name , array $ filter = array ( ) ) { try { if ( $ this -> containsScheme ( $ name ) ) { $ this -> setAttribute ( $ this -> stripSchema ( $ name ) , '.' ) ; } else { if ( $ directory = $ this -> getDirectory ( ) ) { $ directory = $ this -> appendDirectory ( $ name ) ; } else { $ t...
Create and return a new naming subdirectory with the attributes of this one .
54,793
public function prepareDirectory ( $ name ) { if ( $ this -> containsScheme ( $ name ) ) { return $ this -> stripSchema ( $ name ) ; } return $ this -> appendDirectory ( $ name ) ; }
Prepare s and return s the path either by stripping of the scheme if it is absolute or append the name if it is relative .
54,794
public function match ( HttpServletRequestInterface $ servletRequest ) { return fnmatch ( $ this -> getUrlPattern ( ) , $ servletRequest -> getServletPath ( ) . $ servletRequest -> getPathInfo ( ) ) ; }
Return s TRUE if the passed request matches the mappings URL patter .
54,795
public function lookup ( BeanContextInterface $ beanManager , $ className , array $ args = array ( ) ) { $ objectManager = $ beanManager -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; $ sessionId = Environment :: singleton ( ) -> getAttribute ( EnvironmentKeys :: SESSION_ID ) ; if ( $ object...
Runs a lookup for the session bean with the passed class name
54,796
public function get ( $ serviceType , $ refInstance = null ) { if ( ! isset ( $ this -> services [ $ serviceType :: getName ( ) ] ) ) { if ( is_null ( $ refInstance ) ) { $ this -> services [ $ serviceType :: getName ( ) ] = new $ serviceType ( ) ; } else { $ this -> services [ $ serviceType :: getName ( ) ] = new $ se...
Returns or creates the given service type instance with optional refInstance injection on ctor
54,797
public function setUserRights ( \ SplFileInfo $ targetDir , $ user = null , $ group = null ) { $ systemConfiguration = $ this -> getInitialContext ( ) -> getSystemConfiguration ( ) ; if ( $ user == null ) { $ user = $ systemConfiguration -> getParam ( 'user' ) ; } if ( $ group == null ) { $ group = $ systemConfiguratio...
Will set the owner and group on the passed directory recursively .
54,798
public function createDirectory ( \ SplFileInfo $ directoryToCreate , $ mode = 0775 , $ recursively = true , $ user = null , $ group = null , $ umask = null ) { $ this -> initUmask ( $ umask ) ; FileSystem :: createDirectory ( $ directoryToCreate , $ mode , $ recursively ) ; $ this -> setUserRights ( $ directoryToCreat...
Creates the passed directory recursively with the umask specified in the system configuration and sets the user permissions .
54,799
public function getServerNodeConfiguration ( ServerNodeInterface $ serverNode ) { if ( $ serverNode -> getParam ( 'software' ) == null ) { $ serverNode -> setParam ( 'software' , ParamNode :: TYPE_STRING , $ this -> getService ( ) -> getServerSignature ( ) ) ; } return new ServerNodeConfiguration ( $ serverNode ) ; }
Return s the prepared server node configuration .