public
boolean
|
#
checkAppDirPresence( string $dirPath )
Check whether directory $dirPath exists
Check whether directory $dirPath exists
Parameters
Returns
boolean
|
public
boolean
|
#
checkAppFilePresence( string $filePath )
Check whether file $filePath exists
Check whether file $filePath exists
Parameters
Returns
boolean
|
public
string
|
#
checkAppDirPerms( string $dirPath, integer $mask = 511 )
Check permissions for directory
Check permissions for directory
Parameters
Returns
string
|
public
boolean
|
#
createFileFromSample( string $filePath )
Create file $filePath from $filePath.sample
Create file $filePath from $filePath.sample
Parameters
Returns
boolean
|
public
|
#
checkWritable( string $filename )
Check whether file $filename is writable
Check whether file $filename is writable
Parameters
|
public
array,
|
#
emptyLogs( string $filename = null, string $basePath = LOGS )
delete log files
Parameters
- $filename
- $filename, filename to delete i.e. error.log
- $basePath
- $basePath, path to file (default is logs path)
Returns
array, it contains
'failed' => array of errors, empty if no errors occured
'success' => array of file deleted
|
public
array,
|
#
cleanupCache( string $basePath = TMP, boolean $frontendsToo = true, boolean $cleanAll = false )
cleanup cached files
Parameters
- $basePath
- $basePath, base path on which build cake cache dir and smarty cache dir
- $frontendsToo
- $frontendsToo, true (default) to delete also all frontends cached files
- $cleanAll
- $cleanAll, false (default) clean all folders in tmp/cache not just 'models', 'persistent' and 'views'
Returns
array, it contains
'failed' => array of errors, empty if no errors occured
'success' => array deleted files
|
public
array,
|
#
cleanUpDir( string $basePath, boolean $recursive = false, boolean $removeDirs = false )
clean directory deleting files and eventully subdirs
clean directory deleting files and eventully subdirs
Parameters
- $basePath
- $basePath, the starting directory path
- $recursive
- $recursive, true to deleting files recursively on subdirs
- $removeDirs
- $removeDirs, true to remove all subdirs too
Returns
array, it contains
'failed' => array of errors, empty if no errors occured
'success' => array of file deleted
|
public
mixed
|
#
writeConfigFile( type $filepath, array $dataToWrite, boolean $insertNewVar = false )
edit cakephp config file
Parameters
- $filepath
- $dataToWrite
- (see BeSystem::writePHPfile)
- $insertNewVar
- $insertNewVar, if 'true' write new var (if not already in config file)
Returns
mixed true on success
|
public
mixed
|
#
writePHPfile( string $filepath, array $dataToWrite, boolean $insertNewVar = true )
edit an existing php file writing data from $dataToWrite array
edit an existing php file writing data from $dataToWrite array
Parameters
- $filepath
- $dataToWrite
example of $dataToWrite
1)
"config" => array(
"beditaUrl" => "http://localhost/workspace/bedita",
'smtpOptions'=> array(
'port' => '25',
'timeout' => '30',
'host' => 'your.smtp.server',
'username' => 'your_smtp_username',
'password' => 'your_smtp_password'
),
...
)
will be generate var as
$config['beditaUrl'] = 'http://localhost/workspace/bedita';
...
2)
"myvar" => "this is my var"
will be generate var as
$myvar = 'this is my var';
- $insertNewVar
- true to permitt writing new var (not already present in original file)
Returns
mixed true on success
|
public
boolean
|
#
checkFileSyntax( string $fileName )
Check for syntax error in file
Check for syntax error in file
To check syntax it uses 'php -l' command (cli)
Parameters
- $fileName
- the complete file name
Returns
boolean true on check success
|
public
boolean
|
#
checkCodeSyntax( array|string $sourceCode, boolean $addPHPtag = false )
Return true if no syntax errors are present in $sourceCode.
Return true if no syntax errors are present in $sourceCode.
To check syntax it uses BeSystem::checkFileSyntax()
Since 'php -l' works against files a temporary file is created in (bedita-app/tmp) and removed only if the check is correct.
If BeSystem::checkFileSyntax() or file creation fails the method returns false
Parameters
- $sourceCode
- the source code to test
- $addPHPtag
- true to add '<?php' at the begin of $sourceCode
Returns
boolean
See
BeSystem::checkFileSyntax()
|
private
|
#
parsePHPFile( array & $fileLines, array $params )
parse file as array (returned from file() php function) and replace/insert var defined in $params
parse file as array (returned from file() php function) and replace/insert var defined in $params
Parameters
- $fileLines
- returned from file() php function
- $params
can contain
"varName" => name of php variable (without $) that has to be searched in $fileLines [required]
"keyName" => key name of $varName array. Empty if $varName isn't an associative array
"varValue" => value of $varName[$keyName] or $varName
"patternVar" => custom regexp pattern to search var. If empty is built automatically
"insertNewVar" => boolean, it says if add or less variable not already in $fileLines [default is true]
|
private
string
|
#
generateVarCodeLine( array $params )
generate a php var code line according to $params
generate a php var code line according to $params
Parameters
- $params
"varName" => name of php var without $
"keyName" => key name of varName array (can be empty)
"varValue" => value of $varName or $varName[$keyName]
Returns
string
|
public
integer
|
#
systemUserId( )
Get system user ID.
Returns
integer
See
BeSystem::SYSTEM_USER_ID
|