TYPO3  7.6
Public Member Functions | Public Attributes | Protected Attributes | List of all members
AbstractService Class Reference
Inheritance diagram for AbstractService:
AbstractAuthenticationService SaltedPasswordService AuthenticationService RsaAuthService

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

Parent class for "Services" classes

Definition at line 20 of file AbstractService.php.

Constructor & Destructor Documentation

__destruct ( )

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

Returns
void

Definition at line 556 of file AbstractService.php.

References AbstractService\unlinkTempFiles().

Member Function Documentation

checkExec (   $progList)

check the availability of external programs

Parameters
string$progListComma list of programs 'perl,python,pdftotext'
Returns
bool Return FALSE if one program was not found

Definition at line 261 of file AbstractService.php.

References AbstractService\errorPush().

Referenced by AbstractService\init().

checkInputFile (   $absFile)

Check if a file exists and is readable.

Parameters
string$absFileFile name with absolute path.
Returns
string|boolean File name or FALSE.

Definition at line 296 of file AbstractService.php.

References AbstractService\errorPush(), and GeneralUtility\isAllowedAbsPath().

Referenced by AbstractService\getInputFile(), and AbstractService\readFile().

deactivateService ( )

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

Returns
void

Definition at line 280 of file AbstractService.php.

devLog (   $msg,
  $severity = 0,
  $dataVar = false 
)

Logs debug messages to ::devLog()

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

Definition at line 151 of file AbstractService.php.

errorPull ( )

Removes the last error from the error stack.

Returns
void

Definition at line 178 of file AbstractService.php.

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
int$errNumError number (see T3_ERR_SV_* constants)
string$errMsgError message
Returns
void

Definition at line 165 of file AbstractService.php.

References $GLOBALS.

Referenced by AbstractService\checkExec(), AbstractService\checkInputFile(), AbstractService\readFile(), AbstractService\tempFile(), and AbstractService\writeFile().

getErrorMsgArray ( )

Returns all error messages as array.

Returns
array Error messages

Definition at line 219 of file AbstractService.php.

References AbstractService\$error.

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

Definition at line 440 of file AbstractService.php.

References AbstractService\$inputContent, and AbstractService\readFile().

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.

Definition at line 455 of file AbstractService.php.

References AbstractService\$inputFile, AbstractService\checkInputFile(), elseif, and AbstractService\writeFile().

getLastError ( )

Returns the last error number from the error stack.

Returns
int|bool Error number (or TRUE if no error)

Definition at line 188 of file AbstractService.php.

References AbstractService\$error.

Referenced by AbstractService\init().

getLastErrorArray ( )

Returns the last array from the error stack.

Returns
array Error number and message

Definition at line 235 of file AbstractService.php.

getLastErrorMsg ( )

Returns the last message from the error stack.

Returns
string Error message

Definition at line 204 of file AbstractService.php.

References AbstractService\$error.

getOutput ( )

Get the output content.

Returns
mixed

Definition at line 486 of file AbstractService.php.

References AbstractService\$out, and AbstractService\readFile().

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

Definition at line 500 of file AbstractService.php.

References AbstractService\$outputFile, and AbstractService\writeFile().

getServiceInfo ( )

Returns internal information array for service

Returns
array Service description array

Definition at line 90 of file AbstractService.php.

References AbstractService\$info.

getServiceKey ( )

Returns the service key of the service

Returns
string Service key

Definition at line 100 of file AbstractService.php.

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
bool$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

Definition at line 123 of file AbstractService.php.

References $GLOBALS, and elseif.

Referenced by AbstractAuthenticationService\initAuth().

getServiceTitle ( )

Returns the title of the service

Returns
string Service title

Definition at line 110 of file AbstractService.php.

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
bool TRUE if the service is available

Definition at line 521 of file AbstractService.php.

References AbstractService\checkExec(), AbstractService\getLastError(), and AbstractService\reset().

readFile (   $absFile,
  $length = 0 
)

Read content from a file a file.

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

Definition at line 318 of file AbstractService.php.

References AbstractService\$out, AbstractService\checkInputFile(), and AbstractService\errorPush().

Referenced by AbstractService\getInput(), and AbstractService\getOutput().

registerTempFile (   $absFile)

Register file which should be deleted afterwards.

Parameters
stringFile name with absolute path.
Returns
void

Definition at line 379 of file AbstractService.php.

Referenced by AbstractService\tempFile().

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

Definition at line 539 of file AbstractService.php.

References AbstractService\resetErrors(), and AbstractService\unlinkTempFiles().

Referenced by AbstractService\init().

resetErrors ( )

Reset the error stack.

Returns
void

Definition at line 245 of file AbstractService.php.

Referenced by AbstractService\reset().

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

Definition at line 413 of file AbstractService.php.

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

Definition at line 427 of file AbstractService.php.

setOutputFile (   $absFile)

Set the output file name.

Parameters
string$absFileFile name
Returns
void

Definition at line 476 of file AbstractService.php.

tempFile (   $filePrefix)

Create a temporary file.

Parameters
string$filePrefixFile prefix.
Returns
string|boolean File name or FALSE

Definition at line 360 of file AbstractService.php.

References AbstractService\errorPush(), and AbstractService\registerTempFile().

Referenced by AbstractService\writeFile().

unlinkTempFiles ( )

Delete registered temporary files.

Returns
void

Definition at line 393 of file AbstractService.php.

Referenced by AbstractService\__destruct(), and AbstractService\reset().

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

Definition at line 337 of file AbstractService.php.

References AbstractService\errorPush(), GeneralUtility\isAllowedAbsPath(), and AbstractService\tempFile().

Referenced by AbstractService\getInputFile(), and AbstractService\getOutputFile().

Member Data Documentation

$error = array()
$info = array()

Definition at line 25 of file AbstractService.php.

Referenced by AbstractService\getServiceInfo().

$inputContent = ''

Definition at line 50 of file AbstractService.php.

Referenced by AbstractService\getInput().

$inputFile = ''

Definition at line 45 of file AbstractService.php.

Referenced by AbstractService\getInputFile().

$inputType = ''

Definition at line 55 of file AbstractService.php.

$out = ''

Definition at line 40 of file AbstractService.php.

Referenced by AbstractService\getOutput(), and AbstractService\readFile().

$outputFile = ''

Definition at line 60 of file AbstractService.php.

Referenced by AbstractService\getOutputFile().

$prefixId = ''
protected

Definition at line 78 of file AbstractService.php.

$shutdownRegistry = array()
protected

Definition at line 73 of file AbstractService.php.

$tempFiles = array()

Definition at line 68 of file AbstractService.php.

$writeDevLog = false

Definition at line 35 of file AbstractService.php.