fixed error messages and wrong error log
Dieser Commit ist enthalten in:
Ursprung
0aac19b33d
Commit
a7f1f3edb4
|
@ -120,6 +120,7 @@ class cApiModule extends Item {
|
||||||
*/
|
*/
|
||||||
public function __construct($mId = false) {
|
public function __construct($mId = false) {
|
||||||
global $cfg, $cfgClient, $client;
|
global $cfg, $cfgClient, $client;
|
||||||
|
|
||||||
parent::__construct($cfg["tab"]["mod"], "idmod");
|
parent::__construct($cfg["tab"]["mod"], "idmod");
|
||||||
|
|
||||||
// Using no filters is just for compatibility reasons.
|
// Using no filters is just for compatibility reasons.
|
||||||
|
@ -142,10 +143,10 @@ class cApiModule extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
$oClient = new cApiClient($client);
|
$oClient = new cApiClient($client);
|
||||||
$aClientProp = $oClient->getPropertiesByType('modfileedit');
|
$aClientProp = $oClient->getPropertiesByType('modfileedit');
|
||||||
if (count($aClientProp) > 0) {
|
if (count($aClientProp) > 0) {
|
||||||
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $aClientProp);
|
$this->_aModFileEditConf = array_merge($this->_aModFileEditConf, $aClientProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mId !== false) {
|
if ($mId !== false) {
|
||||||
$this->loadByPrimaryKey($mId);
|
$this->loadByPrimaryKey($mId);
|
||||||
|
@ -154,23 +155,38 @@ class cApiModule extends Item {
|
||||||
|
|
||||||
public function createModuleFolder() {
|
public function createModuleFolder() {
|
||||||
//echo $this->_aModFileEditConf['modPath'];
|
//echo $this->_aModFileEditConf['modPath'];
|
||||||
|
$sPathErrorLog = cRegistry::getConfigValue('path', 'logs').'errorlog.txt';
|
||||||
|
|
||||||
if (is_writable($this->_aModFileEditConf['clientPath']) && !file_exists($this->_aModFileEditConf['modPath'])) {
|
if (is_writable($this->_aModFileEditConf['clientPath']) && !file_exists($this->_aModFileEditConf['modPath'])) {
|
||||||
try {
|
try {
|
||||||
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
|
mkdir($this->_aModFileEditConf['modPath'], 0777, true);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$oWriter = cLogWriter::factory("File", array('destination' => 'contenido.log'));
|
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||||
$oLog = new cLog($oWriter);
|
$oLog = new cLog($oWriter);
|
||||||
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->_aModFileEditConf['use'] == TRUE && is_writable($this->_aModFileEditConf['modPath'])) {
|
|
||||||
|
if ($this->_aModFileEditConf['use'] == true && is_writable($this->_aModFileEditConf['modPath'])) {
|
||||||
if (!is_dir($this->getModulePath())) {
|
if (!is_dir($this->getModulePath())) {
|
||||||
$this->_oldumask = umask(0);
|
$this->_oldumask = umask(0);
|
||||||
if (mkdir($this->getModulePath(), 0777)) {
|
try {
|
||||||
|
mkdir($this->getModulePath(), 0777);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||||
|
$oLog = new cLog($oWriter);
|
||||||
|
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_writable($this->getModulePath())) {
|
||||||
return $this->_createModuleStruct();
|
return $this->_createModuleStruct();
|
||||||
}
|
}
|
||||||
umask($this->_oldumask);
|
umask($this->_oldumask);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$oWriter = cLogWriter::factory("File", array('destination' => $sPathErrorLog));
|
||||||
|
$oLog = new cLog($oWriter);
|
||||||
|
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -299,9 +315,7 @@ class cApiModule extends Item {
|
||||||
// if the class exists, has the method "addModuleTranslations"
|
// if the class exists, has the method "addModuleTranslations"
|
||||||
// and the current module contains this cms content type we
|
// and the current module contains this cms content type we
|
||||||
// add the additional translations for the module
|
// add the additional translations for the module
|
||||||
if (class_exists($sContentType) &&
|
if (class_exists($sContentType) && method_exists($sContentType, 'addModuleTranslations') && preg_match('/' . strtoupper($sContentType) . '\[\d+\]/', $code)) {
|
||||||
method_exists($sContentType, 'addModuleTranslations') &&
|
|
||||||
preg_match('/' . strtoupper($sContentType) . '\[\d+\]/', $code)) {
|
|
||||||
|
|
||||||
$strings = call_user_func(array($sContentType, 'addModuleTranslations'), $strings);
|
$strings = call_user_func(array($sContentType, 'addModuleTranslations'), $strings);
|
||||||
}
|
}
|
||||||
|
@ -679,8 +693,7 @@ class cApiModule extends Item {
|
||||||
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
|
foreach ($this->_packageStructure as $sFileType => $sFilePath) {
|
||||||
if (is_array($_mImport["items"][$sFileType])) {
|
if (is_array($_mImport["items"][$sFileType])) {
|
||||||
foreach ($_mImport["items"][$sFileType] as $sFileName => $aContent) {
|
foreach ($_mImport["items"][$sFileType] as $sFileName => $aContent) {
|
||||||
if (!array_key_exists(clHtmlSpecialChars($sFileName), $aOptions["items"][$sFileType]) ||
|
if (!array_key_exists(clHtmlSpecialChars($sFileName), $aOptions["items"][$sFileType]) || $aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "overwrite") {
|
||||||
$aOptions["items"][$sFileType][clHtmlSpecialChars($sFileName)] == "overwrite") {
|
|
||||||
if (!file_exists($sFilePath . $sFileName)) {
|
if (!file_exists($sFilePath . $sFileName)) {
|
||||||
createFile($sFileName, $sFilePath);
|
createFile($sFileName, $sFilePath);
|
||||||
}
|
}
|
||||||
|
@ -696,8 +709,7 @@ class cApiModule extends Item {
|
||||||
// Layouts
|
// Layouts
|
||||||
if (is_array($_mImport["items"]["layouts"])) {
|
if (is_array($_mImport["items"]["layouts"])) {
|
||||||
foreach ($_mImport["items"]["layouts"] as $sLayout => $aContent) {
|
foreach ($_mImport["items"]["layouts"] as $sLayout => $aContent) {
|
||||||
if (!array_key_exists(clHtmlSpecialChars($sLayout), $aOptions["items"]["layouts"]) ||
|
if (!array_key_exists(clHtmlSpecialChars($sLayout), $aOptions["items"]["layouts"]) || $aOptions["items"]["layouts"][clHtmlSpecialChars($sLayout)] == "overwrite") {
|
||||||
$aOptions["items"]["layouts"][clHtmlSpecialChars($sLayout)] == "overwrite") {
|
|
||||||
$oLayouts = new cApiLayoutCollection;
|
$oLayouts = new cApiLayoutCollection;
|
||||||
$oLayouts->setWhere("idclient", $client);
|
$oLayouts->setWhere("idclient", $client);
|
||||||
$oLayouts->setWhere("name", $sLayout);
|
$oLayouts->setWhere("name", $sLayout);
|
||||||
|
@ -882,7 +894,7 @@ class cApiModule extends Item {
|
||||||
if ($this->_aModFileEditConf['use'] !== true) {
|
if ($this->_aModFileEditConf['use'] !== true) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->_setFieldFromFile('output', $this->_sModAlias."_output.php");
|
return $this->_setFieldFromFile('output', $this->_sModAlias . "_output.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -896,7 +908,7 @@ class cApiModule extends Item {
|
||||||
if ($this->_aModFileEditConf['use'] !== true) {
|
if ($this->_aModFileEditConf['use'] !== true) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->_setFieldFromFile('input', $this->_sModAlias."_input.php");
|
return $this->_setFieldFromFile('input', $this->_sModAlias . "_input.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _displayNoteFromFile($bIsOldPath = FALSE) {
|
private function _displayNoteFromFile($bIsOldPath = FALSE) {
|
||||||
|
|
Laden…
In neuem Issue referenzieren