/** * Send notification to subscribers * * @param int $logs_count */ function sendToSubscribers($logs_count, &$repository_engine, $params = array(), $exclude = null) { if (!is_array($params)) { $params = array(); } // if $params['commit_count'] = $logs_count; $params['commits_body'] = ""; if ($logs_count <= 10) { $commits = Commits::find(array('conditions' => "parent_id = '" . $this->getId() . "'", 'order' => 'created_on DESC', 'limit' => $logs_count)); if (is_foreachable($commits)) { foreach ($commits as $key => $commit) { $paths = $commit->getPaths(); $params['commits_body'] .= "<hr/>"; $params['commits_body'] .= "<p><a href=\"" . $commit->getViewUrl() . "\">" . lang("<b>Commit #:revision</b>", array('revision' => $commit->getRevision(), false)) . '</a> ' . lang('by :author', array('author' => $commit->getAuthor()), false) . "</p>\n"; $params['commits_body'] .= nl2br(trim($commit->getMessage())) . "\n"; $params['commits_body'] .= $repository_engine->getCommitTemplateBit($paths); } // foreach $params['commits_body'] .= "<hr/>"; } // if } // if parent::sendToSubscribers("source/repository_updated", $params, get_logged_user_id()); }
/** * Find last commit * * @param Repository $repository * @return mixed */ function findLastCommit($repository) { return Commits::find(array('conditions' => array('parent_id = ? AND type = ?', $repository->getId(), 'Commit'), 'order' => 'integer_field_1 DESC', 'one' => true)); }