Esempio n. 1
0
 /**
  *
  * @return Zupal_People
  */
 public static function getInstance()
 {
     if (is_null(self::$_Instance)) {
         // process
         self::$_Instance = new self();
     }
     return self::$_Instance;
 }
Esempio n. 2
0
 /**
  *
  * @return Zend_Log_Writer_Abstract
  */
 public function get_stream()
 {
     if (!Zupal_Bootstrap::$registry->configuration->logging->write) {
         return new Zend_Log_Writer_Null();
     }
     if (Zupal_Bootstrap::$registry->configuration->logging->log_to_db) {
         $table = Zupal_Eventlogs::getInstance()->table();
         $adapter = $table->getAdapter();
         return new Zend_Log_Writer_Db($adapter, $table->tableName());
     } else {
         if (!is_dir($this->module_dir())) {
             throw new Exception(__METHOD__ . ': Cannot find module ' . $this->get_name());
         }
         if (!is_dir($this->log_dir())) {
             mkdir($this->log_dir(), 0775);
         }
         if (!file_exists($this->file())) {
             touch($this->file());
         }
         return new Zend_Log_Writer_Stream($this->file());
     }
 }