Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsyoshida2015-10-12 08:11:51 +0000
committersyoshida2015-10-12 08:11:51 +0000
commit7da3d82415e1582f59a67cb603450b3912b4e3d7 (patch)
tree6c07adf4d6d061e7a137b637b245fcca773bb3f0
parent90ca1df6d1e7bddb06c3f9a96963b31f540d2351 (diff)
downloadserver-7da3d82415e1582f59a67cb603450b3912b4e3d7.tar.gz
server-7da3d82415e1582f59a67cb603450b3912b4e3d7.tar.xz
server-7da3d82415e1582f59a67cb603450b3912b4e3d7.zip
[470121] scoreboard could be removed if no needed
-rw-r--r--classes/system/scoreboard.class.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/classes/system/scoreboard.class.php b/classes/system/scoreboard.class.php
index d547945..7733d54 100644
--- a/classes/system/scoreboard.class.php
+++ b/classes/system/scoreboard.class.php
@@ -8,31 +8,28 @@
*
* Contributors:
* Foundation - initial API and implementation
- *
+ * Satoru Yoshida - [470121] scoreboard could be removed if no needed
*******************************************************************************/
class Scoreboard {
public function refresh() {
global $dbh;
- $sql = "SELECT MAX(translation_id) as t, quantity FROM translations, scoreboard WHERE itemid = 'LASGEN' GROUP BY quantity HAVING t > quantity";
-
- $t = 0;
-
+ $sql = "SELECT quantity FROM scoreboard " .
+ "WHERE itemid = 'LASGEN' " .
+ "AND quantity < (SELECT MAX(translation_id) as t FROM translations)";
+
$result = mysql_query($sql, $dbh);
if($result && mysql_num_rows($result) > 0) {
- $myrow = mysql_fetch_assoc($result);
-
- $t = $myrow['t'];
# "lock" the scoreboard so that 2 clients don't update it simultaneously
mysql_query("UPDATE scoreboard SET quantity = 9999999999 WHERE itemid = 'LASGEN'", $dbh);
# rebuilding the scoreboard takes time ... dump stuff to tmp
mysql_query("CREATE TEMPORARY TABLE _tmp_scoreboard LIKE scoreboard", $dbh);
- $sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LANGPR', IF(ISNULL(b.locale),b.name,CONCAT(b.name, CONCAT(' (', CONCAT(b.locale, ')')))), count(*) as StringCount from translations as a inner join languages as b on b.language_id = a.language_id where a.value <> '' and a.is_active = 1 group by a.language_id order by StringCount desc";
+ $sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LANGPR', IF(ISNULL(b.locale),b.name,CONCAT(b.name, CONCAT(' (', CONCAT(b.locale, ')')))), count(a.string_id) as cnt from translations as a inner join languages as b on b.language_id = a.language_id where a.created_on > (NOW() - INTERVAL 1 YEAR) and a.value <> '' and a.is_active = 1 group by a.language_id order by cnt desc limit 20";
mysql_query($sql, $dbh);
- $sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'TOPTR', CONCAT(first_name, IF(ISNULL(last_name),'',CONCAT(' ', last_name))), count(translations.string_id) as cnt from translations inner join users on users.userid = translations.userid where is_active=1 group by first_name, last_name order by cnt desc limit 20";
+ $sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'TOPTR', CONCAT(first_name, IF(ISNULL(last_name),'',CONCAT(' ', last_name))), count(t.string_id) as cnt from translations as t inner join users as u on u.userid = t.userid where t.created_on > (NOW() - INTERVAL 1 YEAR) and t.value <> '' and t.is_active=1 group by first_name, last_name order by cnt desc limit 20";
mysql_query($sql, $dbh);
$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LASGEN', 'Scoreboard Last Generated', MAX(translation_id) FROM translations";
@@ -49,4 +46,4 @@ class Scoreboard {
}
}
}
-?>
+?> \ No newline at end of file

Back to the top