Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cLog
  • cLogWriter
  • cLogWriterFile
  • cModuleLog
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: /**
 4:  * This file contains the log file writer class.
 5:  *
 6:  * @package    Core
 7:  * @subpackage Log
 8:  * @author     Dominik Ziegler
 9:  * @copyright  four for business AG <www.4fb.de>
10:  * @license    http://www.contenido.org/license/LIZENZ.txt
11:  * @link       http://www.4fb.de
12:  * @link       http://www.contenido.org
13:  */
14: 
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16: 
17: /**
18:  * This class contains the file writer class for the logging mechanism.
19:  *
20:  * @package    Core
21:  * @subpackage Log
22:  */
23: class cLogWriterFile extends cLogWriter {
24: 
25:     /**
26:      * Destination handle.
27:      *
28:      * @var resource
29:      */
30:     protected $_handle = NULL;
31: 
32:     /**
33:      * Constructor to create an instance of this class.
34:      *
35:      * @param array $options [optional]
36:      *                       Array with options for the writer instance (optional)
37:      *
38:      * @throws cException
39:      * @throws cFileNotFoundException
40:      */
41:     public function __construct($options = array()) {
42:         parent::__construct($options);
43: 
44:         $this->_createHandle();
45:     }
46: 
47:     /**
48:      * Checks destination and creates the handle for the write process.
49:      *
50:      * @throws cException
51:      *         if not destination is specified
52:      * @throws cFileNotFoundException
53:      *         if the destination file could not be read
54:      */
55:     protected function _createHandle() {
56:         $destination = $this->getOption('destination');
57:         if ($destination == '') {
58:             throw new cException('No destination was specified.');
59:         }
60: 
61:         if (($this->_handle = fopen($destination, 'a')) === false) {
62:             throw new cFileNotFoundException('Destination handle could not be created.');
63:         }
64:     }
65: 
66:     /**
67:      * Writes the content to file handle.
68:      *
69:      * @param string $message
70:      *         Message to write
71:      * @param int $priority
72:      *         Priority of the log entry
73:      * @return bool
74:      *         State of the write process
75:      */
76:     public function write($message, $priority) {
77:         return fwrite($this->_handle, $message) != false;
78:     }
79: }
80: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0