Пример #1
0
 /**
  * Constructor
  *
  * Sets whether to log daily and sets the directory to log to
  */
 public function __construct()
 {
     if ($this->_config->has('debug/zula_log_daily')) {
         $this->logDaily = (bool) $this->_config->get('debug/zula_log_daily');
     }
     if ($this->_config->has('debug/zula_log_ttl')) {
         $this->ttl = (int) $this->_config->get('debug/zula_log_ttl');
     }
     $this->logDir = $this->_zula->getDir('logs');
     foreach (new DirectoryIterator($this->logDir) as $file) {
         // Remove all *old* log files
         $fnStart = substr($file->getFileName(), -8);
         if ($fnStart == 'zula.log' && $file->isFile() && zula_is_deletable($file->getPathName()) && $file->getCTime() + $this->ttl < time()) {
             unlink($file->getPathName());
         }
     }
 }
Пример #2
0
 /**
  * Delete
  *  - Delete the given item from a feed
  *    if no item is given, the feed is deleted
  *
  * @param string $id
  * @return bool
  */
 public function delete($id = null)
 {
     if ($this->isRemote) {
         throw new Rss_RemoteFeed();
     }
     if (is_null($id)) {
         if (zula_is_deletable($this->rssDir . $this->name)) {
             // Call hooks
             Hooks::notifyAll('rss_feed_delete', $this->rssDir, $this->name);
             return unlink($this->rssDir . $this->name);
         }
         $this->_log->message('Unable to delete RSS Feed "' . $this->name . '".', LOG::L_WARNING);
         return false;
     }
     $channels = $this->feed->getElementsByTagName('channel');
     if ($channels->length == 0) {
         throw new Rss_NoFeedInfo();
     }
     $channel = $channels->item(0);
     // Find element to delete
     $node = $this->feed->getElementById($id);
     if (is_null($node)) {
         return false;
     }
     $channel->removeChild($node);
     unset($this->items[$id]);
     Hooks::notifyAll('rss_item_delete', $this->name, $id);
     return true;
 }
Пример #3
0
 /**
  * Deletes the layout file and any SQL entry
  *
  * @return bool
  */
 public function delete()
 {
     if (zula_is_deletable($this->path) && unlink($this->path)) {
         $pdoSt = $this->_sql->prepare('DELETE FROM {PREFIX}layouts WHERE name = ?');
         $pdoSt->execute(array($this->name));
         return true;
     } else {
         return false;
     }
 }