svn: /web/doc-editor/trunk/ install/doc-editor.sql php/LogManager.php

From: Date: Thu, 08 Dec 2011 19:56:08 +0000
Subject: svn: /web/doc-editor/trunk/ install/doc-editor.sql php/LogManager.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-2241@lists.php.net to get a copy of this message
yannick Thu, 08 Dec 2011 19:56:08 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320693 Log: We display logMessage order by popularity. Changed paths: U web/doc-editor/trunk/install/doc-editor.sql U web/doc-editor/trunk/php/LogManager.php Modified: web/doc-editor/trunk/install/doc-editor.sql =================================================================== --- web/doc-editor/trunk/install/doc-editor.sql 2011-12-08 19:46:35 UTC (rev 320692) +++ web/doc-editor/trunk/install/doc-editor.sql 2011-12-08 19:56:08 UTC (rev 320693) @@ -47,6 +47,7 @@ project varchar(255) NOT NULL, text text NOT NULL, user varchar(255) NOT NULL, + used int(11) NOT NULL DEFAULT '0', KEY id (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; Modified: web/doc-editor/trunk/php/LogManager.php =================================================================== --- web/doc-editor/trunk/php/LogManager.php 2011-12-08 19:46:35 UTC (rev 320692) +++ web/doc-editor/trunk/php/LogManager.php 2011-12-08 19:56:08 UTC (rev 320693) @@ -41,7 +41,7 @@ $result = array(); - $s = 'SELECT id, text FROM commitMessage WHERE project="%s" AND user="%s"'; + $s = 'SELECT id, text FROM commitMessage WHERE project="%s" AND user="%s" ORDER BY use DESC'; $params = array($project, $vcsLogin); $r = $this->conn->query($s, $params); while ($a = $r->fetch_assoc()) { @@ -63,7 +63,7 @@ $project = $am->project; $vcsLogin = $am->vcsLogin; - $s = 'SELECT id FROM commitMessage WHERE project="%s" AND text="%s" AND user="%s"'; + $s = 'SELECT id, used FROM commitMessage WHERE project="%s" AND text="%s" AND user="%s"'; $params = array($project, $log, $vcsLogin); $r = $this->conn->query($s, $params); @@ -71,6 +71,12 @@ $s = 'INSERT INTO commitMessage (project, text,user) VALUES ("%s", "%s", "%s")'; $params = array($project, $log, $vcsLogin); $this->conn->query($s, $params); + } else { + $a = $r->fetch_object(); + $s = 'UPDATE commitMessage SET used = %d WHERE id=%d'; + $newUsed = $a->used + 1; + $params = array($newUsed, $a->id); + $this->conn->query($s, $params); } }

« previous php.doc.web (#2241) next »