/** * Daily update of repositories * * @param null * @return void */ function source_handle_on_frequently() { require_once ANGIE_PATH . '/classes/xml/xml2array.php'; $results = 'Repositories updated: '; $repositories = Repositories::findByUpdateType(REPOSITORY_UPDATE_FREQUENTLY); foreach ($repositories as $repository) { // don't update projects other than active ones $project = Projects::findById($repository->getProjectId()); if ($project->getStatus() !== PROJECT_STATUS_ACTIVE) { continue; } // if $repository->loadEngine(); $repository_engine = new RepositoryEngine($repository, true); $last_commit = $repository->getLastCommit(); $revision_to = is_null($last_commit) ? 1 : $last_commit->getRevision() + 1; $logs = $repository_engine->getLogs($revision_to); if (!$repository_engine->has_errors) { $repository->update($logs['data']); $total_commits = $logs['total']; $results .= $repository->getName() . ' (' . $total_commits . ' new commits); '; if ($total_commits > 0) { $repository->sendToSubscribers($total_commits, $repository_engine); $repository->createActivityLog($total_commits); } // if } // if } // foreach return is_foreachable($repositories) && count($repositories) > 0 ? $results : 'No repositories for frequently update'; }
/** * Ajax that will return response from command line * * @param void * @return null */ function test_svn() { $path = array_var($_GET, 'svn_path', null); $check_executable = RepositoryEngine::executableExists($path); echo $check_executable === true ? 'true' : $check_executable; die; }
/** * Commit info * * @param null * @return void */ function commit() { if (!$this->active_repository->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if (!instance_of($this->active_commit, 'Commit')) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if $this->wireframe->addPageAction(lang('Revision history'), $this->active_repository->getHistoryUrl()); $this->wireframe->addPageAction(lang('Browse repository'), $this->active_repository->getBrowseUrl()); $grouped_paths = RepositoryEngine::groupPaths($this->active_commit->getPaths()); ksort($grouped_paths); $diff = $this->active_commit->getDiff(); if (!is_array($diff)) { $diff = $this->repository_engine->getCommitDiff($this->active_revision, $this->active_file); if (is_array($diff)) { $this->active_commit->setDiff($diff); $this->active_commit->setCreatedBy(new AnonymousUser($this->active_commit->getCreatedByName(), '*****@*****.**')); $save = $this->active_commit->save(); } else { flash_error("Unable to retrieve diff information for selected commit"); $this->redirectToReferer(source_module_url($this->active_project)); } // if } // if $parsed = $this->repository_engine->parseDiff($diff); if (is_foreachable($parsed)) { for ($x = 0; $x < count($parsed); $x++) { $filename = substr($parsed[$x]['file'], 0, 1) == '/' ? substr($parsed[$x]['file'], 1) : '/' . $parsed[$x]['file']; if (!in_array($filename, $grouped_paths[SOURCE_MODULE_STATE_MODIFIED])) { unset($parsed[$x]); } // if } // for } // if $parsed = array_values($parsed); ProjectObjectViews::log($this->active_commit, $this->logged_user); $this->smarty->assign(array('grouped_paths' => $grouped_paths, 'diff' => $parsed)); }