/** * This method is called, when the widget should generate it's content. * Return the complete content using the methods provided by the base class. * Do NOT use the toolkit right here! * @return string */ public function getWidgetOutput() { $strReturn = ""; if (!class_module_system_module::getModuleByName("system")->rightRight3() || !class_carrier::getInstance()->getObjSession()->isSuperAdmin()) { return $this->getLang("commons_error_permissions"); } $objFilesystem = new class_filesystem(); $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/log", array(".log")); foreach ($arrFiles as $strName) { $objFilesystem->openFilePointer(_projectpath_ . "/log/" . $strName, "r"); $strLogContent = $objFilesystem->readLastLinesFromFile($this->getFieldValue("nrofrows")); $objFilesystem->closeFilePointer(); $strLogContent = str_replace(array("INFO", "ERROR"), array("INFO ", "ERROR "), $strLogContent); $arrLogEntries = explode("\r", $strLogContent); $strReturn .= $this->objToolkit->getPreformatted($arrLogEntries); } return $strReturn; }
/** * Returns the complete log-file as one string * * @return string */ public function getPhpLogFileContent() { $objFile = new class_filesystem(); $objFile->openFilePointer("/project/log/php.log", "r"); return $objFile->readLastLinesFromFile(25); }
/** * Fetches the entries from the system-log an prints them as preformatted text * * @return string * @autoTestable * @permissions right3 */ protected function actionSystemlog() { //load logfiles available $objFilesystem = new class_filesystem(); $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/log", array(".log")); $arrTabs = array(); foreach ($arrFiles as $strName) { $objFilesystem->openFilePointer(_projectpath_ . "/log/" . $strName, "r"); $strLogContent = $objFilesystem->readLastLinesFromFile(20); $strLogContent = str_replace(array("INFO", "ERROR"), array("INFO ", "ERROR "), $strLogContent); $arrLogEntries = explode("\r", $strLogContent); $objFilesystem->closeFilePointer(); $arrTabs[$strName] = $this->objToolkit->getPreformatted($arrLogEntries); } return $this->objToolkit->getTabbedContent($arrTabs); }