TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Service\AbstractService Class Reference
Inheritance diagram for TYPO3\CMS\Core\Service\AbstractService:
t3lib_svbase TYPO3\CMS\Openid\OpenidService TYPO3\CMS\Sv\AbstractAuthenticationService tx_openid_sv1 TYPO3\CMS\Openid\Wizard tx_sv_authbase TYPO3\CMS\Saltedpasswords\SaltedPasswordService TYPO3\CMS\Sv\AuthenticationService tx_saltedpasswords_sv1 tx_sv_auth TYPO3\CMS\Rsaauth\RsaAuthService tx_rsaauth_sv1

Public Member Functions

 getServiceInfo ()
 
 getServiceKey ()
 
 getServiceTitle ()
 
 getServiceOption ($optionName, $defaultValue='', $includeDefaultConfig=TRUE)
 
 devLog ($msg, $severity=0, $dataVar=FALSE)
 
 errorPush ($errNum=T3_ERR_SV_GENERAL, $errMsg='Unspecified error occurred')
 
 errorPull ()
 
 getLastError ()
 
 getLastErrorMsg ()
 
 getErrorMsgArray ()
 
 getLastErrorArray ()
 
 resetErrors ()
 
 checkExec ($progList)
 
 deactivateService ()
 
 checkInputFile ($absFile)
 
 readFile ($absFile, $length=0)
 
 writeFile ($content, $absFile='')
 
 tempFile ($filePrefix)
 
 registerTempFile ($absFile)
 
 unlinkTempFiles ()
 
 setInput ($content, $type='')
 
 setInputFile ($absFile, $type='')
 
 getInput ()
 
 getInputFile ($createFile='')
 
 setOutputFile ($absFile)
 
 getOutput ()
 
 getOutputFile ($absFile='')
 
 init ()
 
 reset ()
 
 __destruct ()
 

Public Attributes

 $info = array()
 
 $error = array()
 
 $writeDevLog = FALSE
 
 $out = ''
 
 $inputFile = ''
 
 $inputContent = ''
 
 $inputType = ''
 
 $outputFile = ''
 
 $tempFiles = array()
 

Protected Attributes

 $shutdownRegistry = array()
 
 $prefixId = ''
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Parent class for "Services" classes

Author
René Fritz r.fri.nosp@m.tz@c.nosp@m.olorc.nosp@m.ube..nosp@m.de

Definition at line 22 of file AbstractService.php.

Constructor & Destructor Documentation

◆ __destruct()

TYPO3\CMS\Core\Service\AbstractService::__destruct ( )

Clean up the service. Child classes should explicitly call parent::__destruct() in their destructors for this to work

Returns
void
Todo:
Define visibility

Definition at line 568 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\unlinkTempFiles().

Member Function Documentation

◆ checkExec()

TYPO3\CMS\Core\Service\AbstractService::checkExec (   $progList)

check the availability of external programs

Parameters
string$progListComma list of programs 'perl,python,pdftotext'
Returns
boolean Return FALSE if one program was not found
Todo:
Define visibility

Definition at line 272 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\errorPush(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Service\AbstractService\init().

◆ checkInputFile()

TYPO3\CMS\Core\Service\AbstractService::checkInputFile (   $absFile)

Check if a file exists and is readable.

Parameters
string$absFileFile name with absolute path.
Returns
string|boolean File name or FALSE.
Todo:
Define visibility

Definition at line 307 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\errorPush().

Referenced by TYPO3\CMS\Core\Service\AbstractService\getInputFile(), and TYPO3\CMS\Core\Service\AbstractService\readFile().

◆ deactivateService()

TYPO3\CMS\Core\Service\AbstractService::deactivateService ( )

Deactivate the service. Use this if the service fails at runtime and will not be available.

Returns
void
Todo:
Define visibility

Definition at line 291 of file AbstractService.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\deactivateService().

◆ devLog()

TYPO3\CMS\Core\Service\AbstractService::devLog (   $msg,
  $severity = 0,
  $dataVar = FALSE 
)

Logs debug messages to ::devLog()

Parameters
string$msgDebug message
integer$severitySeverity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
array | boolean$dataVardditional data you want to pass to the logger.
Returns
void
Todo:
Define visibility

Definition at line 162 of file AbstractService.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\devLog().

◆ errorPull()

TYPO3\CMS\Core\Service\AbstractService::errorPull ( )

Removes the last error from the error stack.

Returns
void
Todo:
Define visibility

Definition at line 189 of file AbstractService.php.

◆ errorPush()

TYPO3\CMS\Core\Service\AbstractService::errorPush (   $errNum = T3_ERR_SV_GENERAL,
  $errMsg = 'Unspecified error occurred' 
)

Puts an error on the error stack. Calling without parameter adds a general error.

Parameters
integer$errNumError number (see T3_ERR_SV_* constants)
string$errMsgError message
Returns
void
Todo:
Define visibility

Definition at line 176 of file AbstractService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Service\AbstractService\checkExec(), TYPO3\CMS\Core\Service\AbstractService\checkInputFile(), TYPO3\CMS\Core\Service\AbstractService\readFile(), TYPO3\CMS\Core\Service\AbstractService\tempFile(), and TYPO3\CMS\Core\Service\AbstractService\writeFile().

◆ getErrorMsgArray()

TYPO3\CMS\Core\Service\AbstractService::getErrorMsgArray ( )

Returns all error messages as array.

Returns
array Error messages
Todo:
Define visibility

Definition at line 230 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$error.

◆ getInput()

TYPO3\CMS\Core\Service\AbstractService::getInput ( )

Get the input content. Will be read from input file if needed. (That is if ->inputContent is empty and ->inputFile is not)

Returns
mixed
Todo:
Define visibility

Definition at line 451 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$inputContent, and TYPO3\CMS\Core\Service\AbstractService\readFile().

◆ getInputFile()

TYPO3\CMS\Core\Service\AbstractService::getInputFile (   $createFile = '')

Get the input file name. If the content was set by setContent a file will be created.

Parameters
string$createFileFile name. If empty a temp file will be created.
Returns
string File name or FALSE if no input or file error.
Todo:
Define visibility

Definition at line 466 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$inputFile, TYPO3\CMS\Core\Service\AbstractService\checkInputFile(), and TYPO3\CMS\Core\Service\AbstractService\writeFile().

◆ getLastError()

TYPO3\CMS\Core\Service\AbstractService::getLastError ( )

Returns the last error number from the error stack.

Returns
integer|boolean Error number (or TRUE if no error)
Todo:
Define visibility

Definition at line 199 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$error.

Referenced by TYPO3\CMS\Core\Service\AbstractService\init().

◆ getLastErrorArray()

TYPO3\CMS\Core\Service\AbstractService::getLastErrorArray ( )

Returns the last array from the error stack.

Returns
array Error number and message
Todo:
Define visibility

Definition at line 246 of file AbstractService.php.

◆ getLastErrorMsg()

TYPO3\CMS\Core\Service\AbstractService::getLastErrorMsg ( )

Returns the last message from the error stack.

Returns
string Error message
Todo:
Define visibility

Definition at line 215 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$error.

◆ getOutput()

TYPO3\CMS\Core\Service\AbstractService::getOutput ( )

Get the output content.

Returns
mixed
Todo:
Define visibility

Definition at line 497 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$out, and TYPO3\CMS\Core\Service\AbstractService\readFile().

◆ getOutputFile()

TYPO3\CMS\Core\Service\AbstractService::getOutputFile (   $absFile = '')

Get the output file name. If no output file is set, the ->out buffer is written to the file given by input parameter filename

Parameters
string$absFileAbsolute filename to write to
Returns
mixed
Todo:
Define visibility

Definition at line 511 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$outputFile, and TYPO3\CMS\Core\Service\AbstractService\writeFile().

◆ getServiceInfo()

TYPO3\CMS\Core\Service\AbstractService::getServiceInfo ( )

Returns internal information array for service

Returns
array Service description array
Todo:
Define visibility

Definition at line 101 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$info.

◆ getServiceKey()

TYPO3\CMS\Core\Service\AbstractService::getServiceKey ( )

Returns the service key of the service

Returns
string Service key
Todo:
Define visibility

Definition at line 111 of file AbstractService.php.

◆ getServiceOption()

TYPO3\CMS\Core\Service\AbstractService::getServiceOption (   $optionName,
  $defaultValue = '',
  $includeDefaultConfig = TRUE 
)

Returns service configuration values from the $TYPO3_CONF_VARS['SVCONF'] array

Parameters
string$optionNameName of the config option
mixed$defaultValueDefault configuration if no special config is available
boolean$includeDefaultConfigIf set the 'default' config will be returned if no special config for this service is available (default: TRUE)
Returns
mixed Configuration value for the service
Todo:
Define visibility

Definition at line 134 of file AbstractService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Sv\AbstractAuthenticationService\initAuth().

◆ getServiceTitle()

TYPO3\CMS\Core\Service\AbstractService::getServiceTitle ( )

Returns the title of the service

Returns
string Service title
Todo:
Define visibility

Definition at line 121 of file AbstractService.php.

◆ init()

TYPO3\CMS\Core\Service\AbstractService::init ( )

Initialization of the service.

The class have to do a strict check if the service is available. example: check if the perl interpreter is available which is needed to run an extern perl script.

Returns
boolean TRUE if the service is available
Todo:
Define visibility

Definition at line 532 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\checkExec(), TYPO3\CMS\Core\Service\AbstractService\getLastError(), and TYPO3\CMS\Core\Service\AbstractService\reset().

◆ readFile()

TYPO3\CMS\Core\Service\AbstractService::readFile (   $absFile,
  $length = 0 
)

Read content from a file a file.

Parameters
string$absFileFile name to read from.
integer$lengthMaximum length to read. If empty the whole file will be read.
Returns
string|boolean $content or FALSE
Todo:
Define visibility

Definition at line 329 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\$out, TYPO3\CMS\Core\Service\AbstractService\checkInputFile(), and TYPO3\CMS\Core\Service\AbstractService\errorPush().

Referenced by TYPO3\CMS\Core\Service\AbstractService\getInput(), and TYPO3\CMS\Core\Service\AbstractService\getOutput().

◆ registerTempFile()

TYPO3\CMS\Core\Service\AbstractService::registerTempFile (   $absFile)

Register file which should be deleted afterwards.

Parameters
stringFile name with absolute path.
Returns
void
Todo:
Define visibility

Definition at line 390 of file AbstractService.php.

Referenced by TYPO3\CMS\Core\Service\AbstractService\tempFile().

◆ reset()

TYPO3\CMS\Core\Service\AbstractService::reset ( )

Resets the service. Will be called by init(). Should be used before every use if a service instance is used multiple times.

Returns
void
Todo:
Define visibility

Definition at line 551 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\resetErrors(), and TYPO3\CMS\Core\Service\AbstractService\unlinkTempFiles().

Referenced by TYPO3\CMS\Core\Service\AbstractService\init().

◆ resetErrors()

TYPO3\CMS\Core\Service\AbstractService::resetErrors ( )

Reset the error stack.

Returns
void
Todo:
Define visibility

Definition at line 256 of file AbstractService.php.

Referenced by TYPO3\CMS\Core\Service\AbstractService\reset().

◆ setInput()

TYPO3\CMS\Core\Service\AbstractService::setInput (   $content,
  $type = '' 
)

Set the input content for service processing.

Parameters
mixed$contentInput content (going into ->inputContent)
string$typeThe type of the input content (or file). Might be the same as the service subtypes.
Returns
void
Todo:
Define visibility

Definition at line 424 of file AbstractService.php.

◆ setInputFile()

TYPO3\CMS\Core\Service\AbstractService::setInputFile (   $absFile,
  $type = '' 
)

Set the input file name for service processing.

Parameters
string$absFileFile name
string$typeThe type of the input content (or file). Might be the same as the service subtypes.
Returns
void
Todo:
Define visibility

Definition at line 438 of file AbstractService.php.

◆ setOutputFile()

TYPO3\CMS\Core\Service\AbstractService::setOutputFile (   $absFile)

Set the output file name.

Parameters
string$absFileFile name
Returns
void
Todo:
Define visibility

Definition at line 487 of file AbstractService.php.

◆ tempFile()

TYPO3\CMS\Core\Service\AbstractService::tempFile (   $filePrefix)

Create a temporary file.

Parameters
string$filePrefixFile prefix.
Returns
string|boolean File name or FALSE
Todo:
Define visibility

Definition at line 371 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\errorPush(), TYPO3\CMS\Core\Service\AbstractService\registerTempFile(), and TYPO3\CMS\Core\Utility\GeneralUtility\tempnam().

Referenced by TYPO3\CMS\Core\Service\AbstractService\writeFile().

◆ unlinkTempFiles()

TYPO3\CMS\Core\Service\AbstractService::unlinkTempFiles ( )

Delete registered temporary files.

Returns
void
Todo:
Define visibility

Definition at line 404 of file AbstractService.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\unlink_tempfile().

Referenced by TYPO3\CMS\Core\Service\AbstractService\__destruct(), and TYPO3\CMS\Core\Service\AbstractService\reset().

◆ writeFile()

TYPO3\CMS\Core\Service\AbstractService::writeFile (   $content,
  $absFile = '' 
)

Write content to a file.

Parameters
string$contentContent to write to the file
string$absFileFile name to write into. If empty a temp file will be created.
Returns
string|boolean File name or FALSE
Todo:
Define visibility

Definition at line 348 of file AbstractService.php.

References TYPO3\CMS\Core\Service\AbstractService\errorPush(), and TYPO3\CMS\Core\Service\AbstractService\tempFile().

Referenced by TYPO3\CMS\Core\Service\AbstractService\getInputFile(), and TYPO3\CMS\Core\Service\AbstractService\getOutputFile().

Member Data Documentation

◆ $error

◆ $info

TYPO3\CMS\Core\Service\AbstractService::$info = array()

◆ $inputContent

TYPO3\CMS\Core\Service\AbstractService::$inputContent = ''

Definition at line 58 of file AbstractService.php.

Referenced by TYPO3\CMS\Core\Service\AbstractService\getInput().

◆ $inputFile

TYPO3\CMS\Core\Service\AbstractService::$inputFile = ''

◆ $inputType

TYPO3\CMS\Core\Service\AbstractService::$inputType = ''

Definition at line 64 of file AbstractService.php.

◆ $out

TYPO3\CMS\Core\Service\AbstractService::$out = ''

◆ $outputFile

TYPO3\CMS\Core\Service\AbstractService::$outputFile = ''

◆ $prefixId

TYPO3\CMS\Core\Service\AbstractService::$prefixId = ''
protected

Definition at line 88 of file AbstractService.php.

◆ $shutdownRegistry

TYPO3\CMS\Core\Service\AbstractService::$shutdownRegistry = array()
protected

Definition at line 83 of file AbstractService.php.

◆ $tempFiles

TYPO3\CMS\Core\Service\AbstractService::$tempFiles = array()

Temporary files which have to be deleted

Todo:
Define visibility

Definition at line 78 of file AbstractService.php.

◆ $writeDevLog

TYPO3\CMS\Core\Service\AbstractService::$writeDevLog = FALSE

Definition at line 40 of file AbstractService.php.