This class synchronized the contents of modul dir with the table
$cfg['tab']['mod'].
If a module exist in module directory but not in
$cfg['tab']['mod'] this class will insert the modul in the table.
Methods
Construct for the class cModuleHandler.
__construct() : void
With this class you can
make a new Modul, rename a Modul. You can save a Output from Modul and
Input in a
file. The save rules are [Modulname] (is uneque) the files input and
output will be named
[Modulname]_input.php , [Modulname]_output.php
deprecated |
[2012-07-24] class was renamed to cModuleSynchronizer |
Exceptions
Set the new modul name.
changeModuleName($name)
Inherited
var |
string |
inherited_from |
\cModuleHandler::changeModuleName() |
inherited_from |
\cModuleSynchronizer::changeModuleName() |
Parameters
$name
Compare file change timestemp and the timestemp in ['tab']['mod'].
compareFileAndModulTimestamp() : int
Inherited
If file had changed make new code :conGenerateCodeForAllArtsUsingMod
inherited_from |
\cModuleSynchronizer::compareFileAndModulTimestamp() |
Returns
int
id of last update module
Make in all clients the module directory
createAllMainDirectories() : void
Inherited
inherited_from |
\cModuleHandler::createAllMainDirectories() |
inherited_from |
\cModuleSynchronizer::createAllMainDirectories() |
Exceptions
\cException |
if the frontend path can not be found or the module
directory cann ot be created |
Make a new module into the modul dir.
createModule($input, $output) : bool
Inherited
The modul name will be [ModulName] example
Contact_Form or GoogleMaps2.
inherited_from |
\cModuleHandler::createModule() |
inherited_from |
\cModuleSynchronizer::createModule() |
Parameters
$input
$output
Returns
bool
if modul exist or mkdir and saveInput and saveOutput success
return true.
Else if the mkdir or saveInput or saveOutput not success return
false.
Make and save new file
createModuleFile(string $type, string $fileName, string $content)
Inherited
inherited_from |
\cModuleHandler::createModuleFile() |
inherited_from |
\cModuleSynchronizer::createModuleFile() |
Parameters
$type
string
css | js | template directory of the file
$fileName
string
file name
$content
string
content of the file
Delete file
deleteFile(string $type, string $fileName)
Inherited
inherited_from |
\cModuleHandler::deleteFile() |
inherited_from |
\cModuleSynchronizer::deleteFile() |
Parameters
$type
string
js |template | css directory of the file
$fileName
string
file name
Removes this module from the filesystem.
eraseModule() : bool
Inherited
Also deletes the version files.
inherited_from |
\cModuleHandler::eraseModule() |
inherited_from |
\cModuleSynchronizer::eraseModule() |
Returns
bool
true on success or false on failure
Check if exist a file
existFile(string $type, string $fileName)
Inherited
inherited_from |
\cModuleHandler::existFile() |
inherited_from |
\cModuleSynchronizer::existFile() |
Parameters
$type
string
js | template | css the directory of the file
$fileName
string
file name
Get all files from a module directory
getAllFilesFromDirectory(string $moduleDirectory) : array
Inherited
inherited_from |
\cModuleHandler::getAllFilesFromDirectory() |
inherited_from |
\cModuleSynchronizer::getAllFilesFromDirectory() |
Parameters
$moduleDirectory
string
template css or js...
Returns
array
Get the cleaned name
getCleanName($name, $defaultChar)
InheritedStatic
inherited_from |
\cModuleHandler::getCleanName() |
inherited_from |
\cModuleSynchronizer::getCleanName() |
Parameters
$name
$defaultChar
Get the main css file modulenam.css
getCssFileName() : string
Inherited
inherited_from |
\cModuleHandler::getCssFileName() |
inherited_from |
\cModuleSynchronizer::getCssFileName() |
Returns
string
Get the css path of the modul
getCssPath() : string
Inherited
inherited_from |
\cModuleHandler::getCssPath() |
inherited_from |
\cModuleSynchronizer::getCssPath() |
Returns
string
getEncoding()
getEncoding()
InheritedStatic
inherited_from |
\cModuleHandler::getEncoding() |
inherited_from |
\cModuleSynchronizer::getEncoding() |
Get the content of file, modul js or css or template or php
getFilesContent(string $directory, string $fileTyp, $fileName)
Inherited
inherited_from |
\cModuleHandler::getFilesContent() |
inherited_from |
\cModuleSynchronizer::getFilesContent() |
Parameters
$directory
string
where in module should we look
$fileName
Get the name of the main js file (modulname.js)
getJsFileName() : string
Inherited
inherited_from |
\cModuleHandler::getJsFileName() |
inherited_from |
\cModuleSynchronizer::getJsFileName() |
Returns
string
the name of the js file
Get the js path of the modul
getJsPath() : string
Inherited
inherited_from |
\cModuleHandler::getJsPath() |
inherited_from |
\cModuleSynchronizer::getJsPath() |
Returns
string
Get the Modul Path also cms path + module + module name.
getModulePath() : string
Inherited
inherited_from |
\cModuleHandler::getModulePath() |
inherited_from |
\cModuleSynchronizer::getModulePath() |
Returns
string
Get the php path of the modul
getPhpPath() : string
Inherited
inherited_from |
\cModuleHandler::getPhpPath() |
inherited_from |
\cModuleSynchronizer::getPhpPath() |
Returns
string
Get the template path.
getTemplatePath(string $file) : string
Inherited
If file is set it will
return the complete paht + file
inherited_from |
\cModuleHandler::getTemplatePath() |
inherited_from |
\cModuleSynchronizer::getTemplatePath() |
Parameters
$file
string
Returns
string
Init the vars of the class.
initWithDatabaseRow($db)
Inherited
inherited_from |
\cModuleHandler::initWithDatabaseRow() |
inherited_from |
\cModuleSynchronizer::initWithDatabaseRow() |
Parameters
$db
Can write/create a file
isWritable(string $fileName, string $directory) : \bool,
Inherited
inherited_from |
\cModuleHandler::isWritable() |
inherited_from |
\cModuleSynchronizer::isWritable() |
Parameters
$fileName
string
file name
$directory
string
directory where is the file
Returns
\bool,
success true else false
Show if the Modul with the modul name exist in modul dir.
modulePathExists()
Inherited
return bool if the modul exist return true, else false
inherited_from |
\cModuleHandler::modulePathExists() |
inherited_from |
\cModuleSynchronizer::modulePathExists() |
Exist the modulname in directory
modulePathExistsInDirectory(string $name)
Inherited
inherited_from |
\cModuleHandler::modulePathExistsInDirectory() |
inherited_from |
\cModuleSynchronizer::modulePathExistsInDirectory() |
Parameters
$name
string
Read the output of the file _output.php
readOutput() : string
Inherited
inherited_from |
\cModuleHandler::readOutput() |
inherited_from |
\cModuleSynchronizer::readOutput() |
Returns
string
Contents of the Module file( _output.php)
Rename a modul and the input and output files.
renameModul(string $old, string $new) : bool
Inherited
inherited_from |
\cModuleHandler::renameModul() |
inherited_from |
\cModuleSynchronizer::renameModul() |
Parameters
$old
string
old name of the modul
$new
string
new name of the modul
Returns
bool
true if success
Rename a file
renameModuleFile(string $type, string $oldFileName, string $newFileName) : boolean
Inherited
inherited_from |
\cModuleHandler::renameModuleFile() |
inherited_from |
\cModuleSynchronizer::renameModuleFile() |
Parameters
$type
string
css | js | template directory of the file
$oldFileName
string
old name of the file
$newFileName
string
the new name of the file
Returns
boolean
by success return true
Save a content in the file, use for css/js
saveContentToFile(\unknown_type $templateName, \unknown_type $fileType, \unknown_type $fileContent, $saveDirectory) : false
Inherited
inherited_from |
\cModuleHandler::saveContentToFile() |
inherited_from |
\cModuleSynchronizer::saveContentToFile() |
Parameters
$templateName
\unknown_type
$fileType
\unknown_type
$fileContent
\unknown_type
$saveDirectory
Returns
false
or string
This method save a xml file with modul information.
saveInfoXML(string $moduleName, string $description, string $type, $alias) : true
Inherited
If the params not set, get the value from this
inherited_from |
\cModuleHandler::saveInfoXML() |
inherited_from |
\cModuleSynchronizer::saveInfoXML() |
Parameters
$moduleName
string
name of the modul
$description
string
description of the modul
$type
string
type of the modul
$alias
Returns
true
if success else false
Save a string into the file (_output.php).
saveOutput(string $output) : bool
Inherited
inherited_from |
\cModuleHandler::saveOutput() |
inherited_from |
\cModuleSynchronizer::saveOutput() |
Parameters
$output
string
Returns
bool
if the action (save contents into the file _output.php is
success) return true else false
setEncoding()
setEncoding($encoding)
InheritedStatic
inherited_from |
\cModuleHandler::setEncoding() |
inherited_from |
\cModuleSynchronizer::setEncoding() |
Parameters
$encoding
Update the con_mod, the field lastmodified
setLastModified(int $timestamp, int $idmod)
Inherited
inherited_from |
\cModuleSynchronizer::setLastModified() |
Parameters
$timestamp
int
timestamp of last modification
Depend from client, this method
will check the modul dir of the client and if found
a Modul(Dir) that not exist in Db-table this method will
insert the Modul in Db-table ([tab][mod]).
synchronize() : int
Inherited
inherited_from |
\cModuleSynchronizer::synchronize() |
Returns
int
last id of synchronized module
Init the vars of the class, make a query to the Db
_initByModule(int $idmod)
Inherited
inherited_from |
\cModuleHandler::_initByModule() |
inherited_from |
\cModuleSynchronizer::_initByModule() |
Parameters
$idmod
int
the id of the modul
_initWithDatabaseRow()
_initWithDatabaseRow($db)
Inherited
inherited_from |
\cModuleHandler::_initWithDatabaseRow() |
inherited_from |
\cModuleSynchronizer::_initWithDatabaseRow() |
Parameters
$db
Make main module directory.
_makeModuleDirectory() : boolean
Inherited
inherited_from |
\cModuleHandler::_makeModuleDirectory() |
inherited_from |
\cModuleSynchronizer::_makeModuleDirectory() |
Returns
boolean
Make a directory template/css/image/js/php if not exist
createModuleDirectory(string $type)
Inherited
inherited_from |
\cModuleHandler::createModuleDirectory() |
inherited_from |
\cModuleSynchronizer::createModuleDirectory() |
Parameters
$type
string
Returns random characters
getRandomCharacters(integer $count) : string
Inherited
inherited_from |
\cModuleHandler::getRandomCharacters() |
inherited_from |
\cModuleSynchronizer::getRandomCharacters() |
Parameters
$count
integer
amount of characters
Returns
string
This method add a new Modul in the table $cfg['tab']['mod'].
_addModul(string $name, int $idclient)
Inherited
inherited_from |
\cModuleSynchronizer::_addModul() |
Parameters
$name
string
neme of the new module
$idclient
int
mandant of the module
This method look in the db-table $cfg['tab']['mod'] for a modul
name.
_isExistInTable($alias, int $idclient) : \if
Inherited
If the modul name exist it will return true
inherited_from |
\cModuleSynchronizer::_isExistInTable() |
Parameters
$alias
Returns
\if
a modul with the $name exist in the $cfg['tab']['mod'] table
return true else false
If the first char a '.' return false else true
_isValidFirstChar(string $file) : boolean
Inherited
inherited_from |
\cModuleSynchronizer::_isValidFirstChar() |
Parameters
$file
string
Returns
boolean
true if the first char !='.' else false
_rec_rmdir()
_rec_rmdir($path)
Inherited
inherited_from |
\cModuleHandler::_rec_rmdir() |
inherited_from |
\cModuleSynchronizer::_rec_rmdir() |
Parameters
$path
Rename the Modul files and Modul dir
_renameFileAndDir(string $dir, string $dirNameOld, string $dirNameNew, int $client) : boolean
Inherited
inherited_from |
\cModuleSynchronizer::_renameFileAndDir() |
Parameters
$dir
string
path the the moduls
$dirNameOld
string
old dir name
$dirNameNew
string
new dir name
Returns
boolean
true if succes (rename file and directories)
Rename css, js and input/output file
_renameFiles(\unknown_type $dir, \unknown_type $oldModulName, \unknown_type $newModulName)
Inherited
inherited_from |
\cModuleSynchronizer::_renameFiles() |
Parameters
$dir
\unknown_type
$oldModulName
\unknown_type
$newModulName
\unknown_type
This method insert a new modul in $cfg['tab']['mod'] table, if
the name of modul dont exist
_syncModule(\unknown_type $dir, \unknown_type $oldModulName, \unknown_type $newModulName)
Inherited
inherited_from |
\cModuleSynchronizer::_syncModule() |
Parameters
$dir
\unknown_type
$oldModulName
\unknown_type
$newModulName
\unknown_type
If someone delete a moduldir with ftp/ssh.
_synchronizeFilesystemAndDb($db) : int
Inherited
We have a modul
in db but not in directory, if the modul in use make a new modul in
fileystem but if not
clear it from filesystem.
inherited_from |
\cModuleSynchronizer::_synchronizeFilesystemAndDb() |
Parameters
$db
Returns
int
id of last update module
Update the name of module (if the name not allowes)
_updateModulnameInDb(string $oldName, string $newName, int $idclient)
Inherited
inherited_from |
\cModuleSynchronizer::_updateModulnameInDb() |
Parameters
$newName
string
new module name
$idclient
int
id of client
Properties
$_cfg : array
Inherited
inherited_from |
\cModuleHandler::$$_cfg |
inherited_from |
\cModuleSynchronizer::$$_cfg |
$_cfgClient : array
Inherited
inherited_from |
\cModuleHandler::$$_cfgClient |
inherited_from |
\cModuleSynchronizer::$$_cfgClient |
$_client : int
Inherited
inherited_from |
\cModuleHandler::$$_client |
inherited_from |
\cModuleSynchronizer::$$_client |
$_description : string
Inherited
inherited_from |
\cModuleHandler::$$_description |
inherited_from |
\cModuleSynchronizer::$$_description |
$_directories : array
Inherited
inherited_from |
\cModuleHandler::$$_directories |
inherited_from |
\cModuleSynchronizer::$$_directories |
$_encoding : string
Inherited
inherited_from |
\cModuleHandler::$$_encoding |
inherited_from |
\cModuleSynchronizer::$$_encoding |
$_encodingStore
Inherited
inherited_from |
\cModuleHandler::$$_encodingStore |
inherited_from |
\cModuleSynchronizer::$$_encodingStore |
$_fileEncoding : string
Inherited
..)
getEffectiveSetting('encoding', 'file_encoding','UTF-8')
inherited_from |
\cModuleHandler::$$_fileEncoding |
inherited_from |
\cModuleSynchronizer::$$_fileEncoding |
$_idlang : int
Inherited
inherited_from |
\cModuleHandler::$$_idlang |
inherited_from |
\cModuleSynchronizer::$$_idlang |
$_idmod : int
Inherited
inherited_from |
\cModuleHandler::$$_idmod |
inherited_from |
\cModuleSynchronizer::$$_idmod |
$_moduleAlias : string
Inherited
inherited_from |
\cModuleHandler::$$_moduleAlias |
inherited_from |
\cModuleSynchronizer::$$_moduleAlias |
$_output : string
Inherited
inherited_from |
\cModuleHandler::$$_output |
inherited_from |
\cModuleSynchronizer::$$_output |
$_overrideEncoding
Inherited
inherited_from |
\cModuleHandler::$$_overrideEncoding |
inherited_from |
\cModuleSynchronizer::$$_overrideEncoding |
$_type : string
Inherited
inherited_from |
\cModuleHandler::$$_type |
inherited_from |
\cModuleSynchronizer::$$_type |
$_db : \DB_Contenido
Inherited
inherited_from |
\cModuleHandler::$$_db |
inherited_from |
\cModuleSynchronizer::$$_db |
$_lastIdMod : int
Inherited
inherited_from |
\cModuleSynchronizer::$$_lastIdMod |
$_moduleName : string
Inherited
inherited_from |
\cModuleHandler::$$_moduleName |
inherited_from |
\cModuleSynchronizer::$$_moduleName |
$_modulePath : string
Inherited
inherited_from |
\cModuleHandler::$$_modulePath |
inherited_from |
\cModuleSynchronizer::$$_modulePath |
$_path : string
Inherited
inherited_from |
\cModuleHandler::$$_path |
inherited_from |
\cModuleSynchronizer::$$_path |