Skip to content

Commit

Permalink
AricleInfo: Hotfix for T170808, prepare page title
Browse files Browse the repository at this point in the history
  • Loading branch information
MusikAnimal committed Jul 17, 2017
1 parent 98a2139 commit cc61c38
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/AppBundle/Controller/ArticleInfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function resultAction(Request $request)
if ($assessments) {
$this->pageInfo['assessments'] = $assessments;
}
$this->setLogsEvents();
$this->setLogsEvents($page);

$bugs = $page->getErrors();
if (!empty($bugs)) {
Expand Down Expand Up @@ -310,17 +310,21 @@ private function getTopTenCount()
/**
* Query for log events during each year of the article's history,
* and set the results in $this->pageInfo['year_count']
* @param Page $page
*/
private function setLogsEvents()
private function setLogsEvents($page)
{
$loggingTable = $this->projectRepo->getTableName($this->dbName, 'logging', 'logindex');
$title = str_replace(' ', '_', $this->pageInfo['page']->getTitle());
$query = "SELECT log_action, log_type, log_timestamp AS timestamp
FROM $loggingTable
WHERE log_namespace = '" . $this->pageInfo['page']->getNamespace() . "'
AND log_title = '$title' AND log_timestamp > 1
AND log_type IN ('delete', 'move', 'protect', 'stable')";
$events = $this->conn->query($query)->fetchAll();
$title = str_replace(' ', '_', $page->getTitle());
$sql = "SELECT log_action, log_type, log_timestamp AS timestamp
FROM $loggingTable
WHERE log_namespace = '" . $page->getNamespace() . "'
AND log_title = :title AND log_timestamp > 1
AND log_type IN ('delete', 'move', 'protect', 'stable')";
$resultQuery = $this->conn->prepare($sql);
$resultQuery->bindParam(':title', $title);
$resultQuery->execute();
$events = $resultQuery->fetchAll();

foreach ($events as $event) {
$time = strtotime($event['timestamp']);
Expand Down

0 comments on commit cc61c38

Please sign in to comment.